Exemplo n.º 1
0
int
main (int argc, char **argv)
{
  GtkStatusIcon *icon;

  gtk_init (&argc, &argv);

  icon = gtk_status_icon_new ();

  g_signal_connect (icon, "size-changed", G_CALLBACK (size_changed_cb), NULL);
  g_signal_connect (icon, "notify::embedded", G_CALLBACK (embedded_changed_cb), NULL);
  g_signal_connect (icon, "notify::orientation", G_CALLBACK (orientation_changed_cb), NULL);
  g_signal_connect (icon, "notify::screen", G_CALLBACK (screen_changed_cb), NULL);
  g_print ("icon size %d\n", gtk_status_icon_get_size (icon));

  g_signal_connect (icon, "activate",
                    G_CALLBACK (icon_activated), NULL);

  g_signal_connect (icon, "popup-menu",
                    G_CALLBACK (popup_menu), NULL);

  icons = g_slist_append (icons, icon);

  update_icon ();

  timeout = gdk_threads_add_timeout (2000, timeout_handler, icon);

  gtk_main ();

  return 0;
}
Exemplo n.º 2
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.º 3
0
int main(int argc, char *argv[]) {
    GtkStatusIcon *tray_icon = NULL;
    GtkMenu *menu = NULL;
    gchar *tray_icon_file = "/usr/share/pixmaps/gnome-tigert.png";

    gtk_init(&argc, &argv);

    /* builds the menus */
    menu = make_menu();

    tray_icon = gtk_status_icon_new();

    g_signal_connect(G_OBJECT(tray_icon), "activate",
                     G_CALLBACK(left_click), menu);

    g_signal_connect(G_OBJECT(tray_icon), "popup-menu",
                     G_CALLBACK(right_click), menu);

    gtk_status_icon_set_from_file(tray_icon, tray_icon_file);
    gtk_status_icon_set_visible(tray_icon, TRUE);

    gtk_main();

    return 0;
}
Exemplo n.º 4
0
static GObject * legacy_status_icon_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	LegacyStatusIcon * self;
	GtkStatusIcon* _tmp0_;
	GtkStatusIcon* _tmp1_;
	const gchar* _tmp2_ = NULL;
	GtkStatusIcon* _tmp3_;
	GtkStatusIcon* _tmp4_;
	parent_class = G_OBJECT_CLASS (legacy_status_icon_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = LEGACY_STATUS_ICON (obj);
	_tmp0_ = gtk_status_icon_new ();
	_g_object_unref0 (self->priv->icon);
	self->priv->icon = _tmp0_;
	_tmp1_ = self->priv->icon;
	_tmp2_ = g_get_application_name ();
	g_object_set ((GObject*) _tmp1_, "icon-name", "deja-dup-symbolic", "title", _tmp2_, NULL);
	legacy_status_icon_ensure_menu (self);
	_tmp3_ = self->priv->icon;
	g_signal_connect_object (_tmp3_, "popup-menu", (GCallback) _legacy_status_icon_show_menu_gtk_status_icon_popup_menu, self, 0);
	_tmp4_ = self->priv->icon;
	g_signal_connect_object (_tmp4_, "activate", (GCallback) __legacy_status_icon___lambda9__gtk_status_icon_activate, self, 0);
	return obj;
}
Exemplo n.º 5
0
gboolean cc_manager_applet_setup_widget(CCManagerApplet * applet)
{
    g_return_val_if_fail(CC_IS_MANAGERAPPLET(applet), FALSE);

    applet->status_icon = gtk_status_icon_new();
    if (!applet->status_icon)
	return FALSE;
    gtk_status_icon_set_from_file(applet->status_icon, STATUS_ICON);


    g_signal_connect(applet->status_icon, "activate",
		     G_CALLBACK(status_icon_activate_cb), applet);

//setting CCLogingWin
    applet->loging_win = cc_loging_win_new();
    g_message("dddddddddddddddddddddddddddddd");
    cc_loging_win_initialize(applet->loging_win);
    cc_loging_win_setup(applet->loging_win);
    g_message("win setuped in cc_manager_applet_setup_widget");
//    cc_loging_ovirt_get_domain_r(applet->loging_win->ovirt);
//    cc_loging_switch2win(applet->loging_win);
//    g_message("pppppppppppppppppppppppp%x ",applet->loging_win->info);
    cc_loging_info_print(applet->loging_win->info);

//    g_message("pppppppppppppppppppppppp");
//    g_print("     loging_win [%x]\n",applet->loging_win);
//    g_message("before switch2win  applet setup");
//    g_message("after switch2win  applet setup");
//    cc_loging_win_setup(applet->loging_win);


    return TRUE;
}
Exemplo n.º 6
0
Arquivo: ftmenu.c Projeto: 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;
}
Exemplo n.º 7
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.º 8
0
void create_tray_icon(void)
{
    tray_icon = gtk_status_icon_new();
    g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(on_activate), NULL);
    g_signal_connect(G_OBJECT(tray_icon), "popup-menu", G_CALLBACK(on_menu), NULL);
    g_signal_connect(G_OBJECT(tray_icon), "scroll_event", G_CALLBACK(on_scroll), NULL);
    g_signal_connect(G_OBJECT(tray_icon), "button-press-event", G_CALLBACK(on_button_release), NULL);
}
Exemplo n.º 9
0
void cgraphics_status_icon_create(status_icon_t * status, int flags)
{
    GtkStatusIcon * icon = gtk_status_icon_new(); 
    
    g_signal_connect(G_OBJECT(icon), "activate", G_CALLBACK(_on_status_icon_activate), (gpointer)status); 
    g_signal_connect(G_OBJECT(icon), "popup-menu", G_CALLBACK (_on_status_icon_popup_menu), (gpointer)status);
 
    status->native = (void*)icon;        
}
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.º 11
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;
}
Exemplo n.º 12
0
Arquivo: gtunet.c Projeto: 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;
}
Exemplo n.º 13
0
/**
 * Creates the tray icon and connects the signals 'scroll_event'
 * and 'size-changed'.
 *
 * @return the newly created tray icon
 */
GtkStatusIcon *create_tray_icon() {
  tray_icon = gtk_status_icon_new();

  /* catch scroll-wheel events */
  g_signal_connect ((gpointer) tray_icon, "scroll_event", G_CALLBACK (on_scroll), NULL);
  g_signal_connect ((gpointer) tray_icon, "size-changed", G_CALLBACK (tray_icon_resized), NULL);

  gtk_status_icon_set_visible(tray_icon, TRUE);
  return tray_icon;
}
Exemplo n.º 14
0
Arquivo: fbxkb.c Projeto: kba/fbxkb
static void
gui_create()
{
    ENTER;
    icon = gtk_status_icon_new();
    g_signal_connect(G_OBJECT(icon), "button-press-event", G_CALLBACK(clicked),
            NULL);
    g_object_set(gtk_settings_get_default(), "gtk-tooltip-timeout", 1500, NULL);
    RET();
}
Exemplo n.º 15
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.º 16
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);
    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;
}
Exemplo n.º 17
0
void gTrayIcon::setVisible(bool vl)
{
	if (vl)
	{
		if (!plug)
		{
			_loopLevel = gApplication::loopLevel() + 1;
			
			plug = gtk_status_icon_new();

			updatePicture();
			updateTooltip();

			#ifdef GDK_WINDOWING_X11
			// Needed, otherwise the icon does not appear in Gnome or XFCE notification area!
			XSizeHints hints;
			hints.flags = PMinSize;
			hints.min_width = _iconw;
			hints.min_height = _iconh;
			XSetWMNormalHints(gdk_x11_display_get_xdisplay(gdk_display_get_default()), gtk_status_icon_get_x11_window_id(plug), &hints);
			#endif

			gtk_status_icon_set_visible(plug, TRUE);

			//g_signal_connect(G_OBJECT(plug), "destroy", G_CALLBACK(cb_destroy),(gpointer)this);
			g_signal_connect(G_OBJECT(plug), "button-press-event", G_CALLBACK(cb_button_press), (gpointer)this);
			g_signal_connect(G_OBJECT(plug), "button-release-event", G_CALLBACK(cb_button_release),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug), "activate", G_CALLBACK(cb_activate),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"focus-in-event",G_CALLBACK(tray_focus_In),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"focus-out-event",G_CALLBACK(tray_focus_Out),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"enter-notify-event",G_CALLBACK(tray_enterleave),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"leave-notify-event",G_CALLBACK(tray_enterleave),(gpointer)this);
			g_signal_connect(G_OBJECT(plug), "popup-menu", G_CALLBACK(cb_menu), (gpointer)this);
			g_signal_connect(G_OBJECT(plug), "scroll-event", G_CALLBACK(cb_scroll), (gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"expose-event", G_CALLBACK(cb_expose), (gpointer)this);
			
			_visible_count++;

			usleep(10000); // BUG: Embedding too fast sometimes fails with GTK+
		}
	}
	else
	{
		if (plug)
		{
			GB.Post((void (*)())hide_icon, (intptr_t)plug);
			plug = NULL;
			_visible_count--;
		}
	}
}
Exemplo n.º 18
0
static void
empathy_status_icon_init (EmpathyStatusIcon *icon)
{
	EmpathyStatusIconPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (icon,
		EMPATHY_TYPE_STATUS_ICON, EmpathyStatusIconPriv);

	icon->priv = priv;
	priv->icon = gtk_status_icon_new ();
	priv->account_manager = empathy_account_manager_dup_singleton ();
	priv->idle = empathy_idle_dup_singleton ();
	priv->event_manager = empathy_event_manager_dup_singleton ();

	g_signal_connect (priv->account_manager,
			  "account-connection-changed",
			  G_CALLBACK (status_icon_connection_changed_cb), icon);

	/* make icon listen and respond to MAIN_WINDOW_HIDDEN changes */
	empathy_conf_notify_add (empathy_conf_get (),
				 EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
				 status_icon_notify_visibility_cb,
				 icon);

#ifdef HAVE_LIBINDICATE
	empathy_conf_notify_add (empathy_conf_get (),
				 EMPATHY_PREFS_UI_USE_LIBINDICATE,
				 status_icon_notify_libindicate_cb,
				 icon);
#endif

	status_icon_create_menu (icon);
	status_icon_idle_notify_cb (icon);

	g_signal_connect_swapped (priv->idle, "notify",
				  G_CALLBACK (status_icon_idle_notify_cb),
				  icon);
	g_signal_connect (priv->event_manager, "event-added",
			  G_CALLBACK (status_icon_event_added_cb),
			  icon);
	g_signal_connect (priv->event_manager, "event-removed",
			  G_CALLBACK (status_icon_event_removed_cb),
			  icon);
	g_signal_connect (priv->event_manager, "event-updated",
			  G_CALLBACK (status_icon_event_updated_cb),
			  icon);
	g_signal_connect (priv->icon, "activate",
			  G_CALLBACK (status_icon_activate_cb),
			  icon);
	g_signal_connect (priv->icon, "popup-menu",
			  G_CALLBACK (status_icon_popup_menu_cb),
			  icon);
}
Exemplo n.º 19
0
szTaskBarItem::szTaskBarItem() {
	wxTopLevelWindow::Create(
		NULL, wxID_ANY, _T("systray icon"),
		wxDefaultPosition, wxDefaultSize,
		wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR | wxSIMPLE_BORDER |
		wxFRAME_SHAPED,
		wxEmptyString /*eggtray doesn't like setting wmclass*/);

	m_status_icon = gtk_status_icon_new();

	g_signal_connect(G_OBJECT(m_status_icon), "activate", G_CALLBACK(status_icon_on_left_click), this);
	g_signal_connect(G_OBJECT(m_status_icon), "popup-menu", G_CALLBACK(status_icon_on_right_click), this);

}
Exemplo n.º 20
0
static GtkStatusIcon* gtkDialogGetStatusIcon(Ihandle *ih)
{
  GtkStatusIcon* status_icon = (GtkStatusIcon*)iupAttribGet(ih, "_IUPDLG_STATUSICON");
  if (!status_icon)
  {
    status_icon = gtk_status_icon_new();

    g_signal_connect(G_OBJECT(status_icon), "activate", G_CALLBACK(gtkDialogTaskAction), ih);
    g_signal_connect(G_OBJECT(status_icon), "popup-menu", G_CALLBACK(gtkDialogTaskPopupMenu), ih);

    iupAttribSetStr(ih, "_IUPDLG_STATUSICON", (char*)status_icon);
  }
  return status_icon;
}
Exemplo n.º 21
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);
    gtk_status_icon_set_from_icon_name(tray_icon, "stock_appointment-reminder");
    gtk_status_icon_set_title(tray_icon, "Eyerest");
    gtk_status_icon_set_visible(tray_icon, TRUE);

    return tray_icon;
}
Exemplo n.º 22
0
TrayItemGtk::TrayItemGtk(std::string& iconURL, KMethodRef cb)
    : TrayItem(iconURL)
    , item(gtk_status_icon_new())
    , menu(0)
    , callback(cb)
    , active(true)
{
    g_signal_connect(
        G_OBJECT(this->item), "activate",
        G_CALLBACK(TrayClickedCallback), this);
    g_signal_connect(
        G_OBJECT(this->item), "popup-menu",
        G_CALLBACK(TrayMenuCallback), this);

    this->SetIcon(this->iconPath);
    gtk_status_icon_set_visible(this->item, TRUE);
}
Exemplo n.º 23
0
static void
tray_provider_set_player (ParoleProviderPlugin *plugin, ParoleProviderPlayer *player)
{
    TrayProvider *tray;
    GdkPixbuf *pix;
    
    tray = TRAY_PROVIDER (plugin);
    
    tray->player = player;
    
    tray->state = PAROLE_STATE_STOPPED;
    
    tray->window = parole_provider_player_get_main_window (player);
    
    tray->tray = gtk_status_icon_new ();
    tray->player = player;
    tray->menu = NULL;

#ifdef HAVE_LIBNOTIFY
    tray->n = NULL;
    notify_init ("parole-tray-icon");
    tray->enabled = notify_enabled ();
    tray->notify = TRUE;
#endif
    
    pix = parole_icon_load ("parole", 48);
    
    if ( pix )
    {
	gtk_status_icon_set_from_pixbuf (tray->tray, pix);
	g_object_unref (pix);
    }
    
    g_signal_connect (tray->tray, "popup-menu",
		      G_CALLBACK (popup_menu_cb), tray);
    
    g_signal_connect (tray->tray, "activate",
		      G_CALLBACK (tray_activate_cb), tray);
    
    tray->sig = g_signal_connect (tray->window, "delete-event",
			          G_CALLBACK (delete_event_cb), NULL);
				  
    g_signal_connect (player, "state_changed", 
		      G_CALLBACK (state_changed_cb), tray);
}
Exemplo n.º 24
0
static void
empathy_status_icon_init (EmpathyStatusIcon *icon)
{
	EmpathyStatusIconPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (icon,
		EMPATHY_TYPE_STATUS_ICON, EmpathyStatusIconPriv);

	icon->priv = priv;
	priv->icon = gtk_status_icon_new ();
	priv->account_manager = tp_account_manager_dup ();
	priv->event_manager = empathy_event_manager_dup_singleton ();

	tp_account_manager_prepare_async (priv->account_manager, NULL,
	    account_manager_prepared_cb, icon);

	/* make icon listen and respond to MAIN_WINDOW_HIDDEN changes */
	empathy_conf_notify_add (empathy_conf_get (),
				 EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
				 status_icon_notify_visibility_cb,
				 icon);

	status_icon_create_menu (icon);

	g_signal_connect_swapped (priv->account_manager,
				  "most-available-presence-changed",
				  G_CALLBACK (status_icon_presence_changed_cb),
				  icon);
	g_signal_connect (priv->event_manager, "event-added",
			  G_CALLBACK (status_icon_event_added_cb),
			  icon);
	g_signal_connect (priv->event_manager, "event-removed",
			  G_CALLBACK (status_icon_event_removed_cb),
			  icon);
	g_signal_connect (priv->event_manager, "event-updated",
			  G_CALLBACK (status_icon_event_updated_cb),
			  icon);
	g_signal_connect (priv->icon, "activate",
			  G_CALLBACK (status_icon_activate_cb),
			  icon);
	g_signal_connect (priv->icon, "popup-menu",
			  G_CALLBACK (status_icon_popup_menu_cb),
			  icon);

	priv->notification = NULL;
	priv->notify_mgr = empathy_notify_manager_dup_singleton ();
}
Exemplo n.º 25
0
/**
 * Creates the tray icon and connects all the signals.
 *
 * @return the newly created TrayIcon instance.
 */
TrayIcon *
tray_icon_create(Audio *audio)
{
	TrayIcon *icon;

	DEBUG("Creating tray icon");

	icon = g_new0(TrayIcon, 1);

	/* Create everything */
	icon->vol_meter = vol_meter_new();
	icon->status_icon = gtk_status_icon_new();
	icon->status_icon_size = ICON_MIN_SIZE;

	/* Connect ui signal handlers */

	// Left-click
	g_signal_connect(icon->status_icon, "activate",
	                 G_CALLBACK(on_activate), icon);
	// Right-click
	g_signal_connect(icon->status_icon, "popup-menu",
	                 G_CALLBACK(on_popup_menu), icon);
	// Middle-click
	g_signal_connect(icon->status_icon, "button-release-event",
	                 G_CALLBACK(on_button_release_event), icon);
	// Mouse scrolling on the icon
	g_signal_connect(icon->status_icon, "scroll_event",
	                 G_CALLBACK(on_scroll_event), icon);
	// Change of size
	g_signal_connect(icon->status_icon, "size-changed",
	                 G_CALLBACK(on_size_changed), icon);

	/* Connect audio signals handlers */
	icon->audio = audio;
	audio_signals_connect(audio, on_audio_changed, icon);

	/* Display icon */
	gtk_status_icon_set_visible(icon->status_icon, TRUE);

	/* Load preferences */
	tray_icon_reload(icon);

	return icon;
}
Exemplo n.º 26
0
int
main (int argc, char **argv)
{
  GdkDisplay *display;
  guint n_screens, i;

  gtk_init (&argc, &argv);

  display = gdk_display_get_default ();

  n_screens = gdk_display_get_n_screens (display);

  for (i = 0; i < n_screens; i++)
    {
      GtkStatusIcon *icon;

      icon = gtk_status_icon_new ();
      gtk_status_icon_set_screen (icon, gdk_display_get_screen (display, i));
      update_icons ();

      g_signal_connect (icon, "size-changed", G_CALLBACK (size_changed_cb), NULL);
      g_signal_connect (icon, "notify::embedded", G_CALLBACK (embedded_changed_cb), NULL);
      g_signal_connect (icon, "notify::orientation", G_CALLBACK (orientation_changed_cb), NULL);
      g_signal_connect (icon, "notify::screen", G_CALLBACK (screen_changed_cb), NULL);
      g_print ("icon size %d\n", gtk_status_icon_get_size (icon));

      g_signal_connect (icon, "activate",
                        G_CALLBACK (icon_activated), NULL);

      g_signal_connect (icon, "popup-menu",
                        G_CALLBACK (popup_menu), NULL);

      icons = g_slist_append (icons, icon);
 
      update_icons ();

      timeout = gdk_threads_add_timeout (2000, timeout_handler, icon);
    }

  gtk_main ();

  return 0;
}
Exemplo n.º 27
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;
}
Exemplo n.º 28
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;
}
Exemplo n.º 29
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;
}
Exemplo n.º 30
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);
}