Esempio n. 1
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. 2
0
static gboolean qq_tray_button_press(GtkStatusIcon *tray, GdkEvent *event
                                    , gpointer data)
{
    GdkEventButton *buttonevent = (GdkEventButton*)event;

	/* Only handle left clicked. */
	if(buttonevent -> button != 1 || buttonevent -> type != GDK_BUTTON_PRESS){
		return FALSE;
	}
    
    QQTrayPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE(tray, qq_tray_get_type()
                                                    , QQTrayPriv);
    gchar *uin = g_queue_pop_tail(priv -> blinking_queue);
    if(uin == NULL){
		/* If there is no new msg, show or hide the main window. */
		qq_mainwindow_show_hide(main_win);
        return FALSE;
    }
    GtkWidget *cw = gqq_config_lookup_ht(cfg, "chat_window_map", uin);
    if(cw != NULL){
        gtk_widget_show(cw);
    }
    g_free(uin);

    if(g_queue_is_empty(priv -> blinking_queue)){
        gtk_status_icon_set_blinking(tray, FALSE);
        GdkPixbuf *pb = gdk_pixbuf_new_from_file(IMGDIR"/webqq_icon.png"
                                                    , NULL);
        gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(tray), pb);
        g_object_unref(pb);
        return FALSE;
    }
    qq_tray_blinking(QQ_TRAY(tray), g_queue_peek_tail(priv -> blinking_queue));
    return FALSE;
}
Esempio n. 3
0
static int gtkDialogSetTrayImageAttrib(Ihandle *ih, const char *value)
{
  GtkStatusIcon* status_icon = gtkDialogGetStatusIcon(ih);
  GdkPixbuf* icon = (GdkPixbuf*)iupImageGetIcon(value);
  gtk_status_icon_set_from_pixbuf(status_icon, icon);
  return 1;
}
Esempio n. 4
0
/* Update the tray icon pixbuf according to the current audio state. */
static void
update_status_icon_pixbuf(GtkStatusIcon *status_icon,
                          GdkPixbuf **pixbufs, VolMeter *vol_meter,
                          gdouble volume, gboolean muted)
{
	GdkPixbuf *pixbuf;

	if (!muted) {
		if (volume == 0)
			pixbuf = pixbufs[VOLUME_OFF];
		else if (volume < 33)
			pixbuf = pixbufs[VOLUME_LOW];
		else if (volume < 66)
			pixbuf = pixbufs[VOLUME_MEDIUM];
		else
			pixbuf = pixbufs[VOLUME_HIGH];
	} else {
		pixbuf = pixbufs[VOLUME_MUTED];
	}

	if (vol_meter && muted == FALSE)
		pixbuf = vol_meter_draw(vol_meter, pixbuf, volume);

	gtk_status_icon_set_from_pixbuf(status_icon, pixbuf);
}
Esempio n. 5
0
void on_reactlist_start(struct s_gui_data *gui_data) 
{  
  gtk_action_set_label(gui_data->action_startPause, "Stop");    
  gtk_status_icon_set_from_pixbuf(gui_data->systrayIcon, gtk_image_get_pixbuf(gui_data->image_started));
  gtk_image_set_from_icon_name(gui_data->image_startStop, ICON_NAME_STOP, GTK_ICON_SIZE_BUTTON); 
  start_reading_event_log(gui_data);
}
Esempio n. 6
0
static int
tray_timeout_cb (TrayIcon icon)
{
	if (custom_icon1)
	{
		if (gtk_status_icon_get_pixbuf (sticon) == custom_icon1)
		{
			if (custom_icon2)
				gtk_status_icon_set_from_pixbuf (sticon, custom_icon2);
			else
				gtk_status_icon_set_from_pixbuf (sticon, ICON_NORMAL);
		}
		else
		{
			gtk_status_icon_set_from_pixbuf (sticon, custom_icon1);
		}
	}
	else if (icon != ICON_FILE)
	{
		if (gtk_status_icon_get_pixbuf (sticon) == ICON_NORMAL)
			gtk_status_icon_set_from_pixbuf (sticon, icon);
		else
			gtk_status_icon_set_from_pixbuf (sticon, ICON_NORMAL);
	}
	else if (icon == ICON_FILE)
	{
		if (gtk_status_icon_get_pixbuf (sticon) == ICON_FILE)
			gtk_status_icon_set_from_pixbuf (sticon, ICON_MSG);
		else
			gtk_status_icon_set_from_pixbuf (sticon, icon);
	}
	return 1;
}
Esempio n. 7
0
gboolean check_event_log(gpointer user_data)
{
  struct s_gui_data *gui_data = (struct s_gui_data *)user_data;    
  zmq_msg_t message;
  int msgsize;
  char *strmsg;
  char has_msg ;
  zmq_msg_init(&message);
  has_msg = !zmq_recv(gui_data->sub_event_log, &message, ZMQ_NOBLOCK);  
  gboolean found_msg = FALSE;
  while(has_msg) 
  {   
    found_msg = TRUE;
    msgsize = zmq_msg_size(&message);                      
    strmsg = (char *)malloc(msgsize);
    memcpy(strmsg, zmq_msg_data(&message), msgsize);
    GtkTextIter logIter;
    GtkTextMark *logMark = gtk_text_buffer_get_insert (gui_data->textbufferLog);
    gtk_text_buffer_get_iter_at_mark (gui_data->textbufferLog, &logIter, logMark);
    
    if (gtk_text_buffer_get_char_count(gui_data->textbufferLog))
	gtk_text_buffer_insert (gui_data->textbufferLog, &logIter, "\n", 1);

    gtk_text_buffer_insert (gui_data->textbufferLog, &logIter, strmsg, msgsize);      
    zmq_msg_close(&message);
    zmq_msg_init(&message);
    has_msg = !zmq_recv(gui_data->sub_event_log, &message, ZMQ_NOBLOCK);    
  }
  if(found_msg != gui_data->logged_event) 
  {
    gui_data->logged_event = found_msg;
    if(found_msg)
    {
      gtk_status_icon_set_from_pixbuf(gui_data->systrayIcon, gtk_image_get_pixbuf(gui_data->image_started_event));    
    }
    else
    {
      gtk_status_icon_set_from_pixbuf(gui_data->systrayIcon, gtk_image_get_pixbuf(gui_data->image_started));    
    }
  }
  if(gui_data->lstart.active)
    return TRUE;
  return FALSE;
}
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;
}
Esempio n. 9
0
/**
 * Updates the tray icon. Usually called after volume has been muted
 * or changed.
 */
void
update_tray_icon(void)
{
	int muted;
	int tmpvol = getvol();
	char tooltip[60];
	gchar *active_card_name = (alsa_get_active_card())->name;
	const char *active_channel = alsa_get_active_channel();

	muted = ismuted();

	if (muted == 1) {
		GdkPixbuf *icon;

		if (tmpvol == 0)
			icon = status_icons[VOLUME_OFF];
		else if (tmpvol < 33)
			icon = status_icons[VOLUME_LOW];
		else if (tmpvol < 66)
			icon = status_icons[VOLUME_MEDIUM];
		else
			icon = status_icons[VOLUME_HIGH];
		sprintf(tooltip, _("%s (%s)\nVolume: %d %%"), active_card_name,
			active_channel,
			tmpvol);

		if (vol_meter_row) {
			GdkPixbuf *old_icon = icon_copy;
			icon_copy = gdk_pixbuf_copy(icon);
			draw_vol_meter(icon_copy, draw_offset, 5,
				       (tmpvol * vol_div_factor));
			if (old_icon)
				g_object_unref(old_icon);
			gtk_status_icon_set_from_pixbuf(tray_icon, icon_copy);
		} else
			gtk_status_icon_set_from_pixbuf(tray_icon, icon);
	} else {
		gtk_status_icon_set_from_pixbuf(tray_icon, status_icons[VOLUME_MUTED]);
		sprintf(tooltip, _("%s (%s)\nVolume: %d %%\nMuted"), active_card_name,
			active_channel, tmpvol);
	}
	gtk_status_icon_set_tooltip_text(tray_icon, tooltip);
}
Esempio n. 10
0
static void draw_icon()
{
  gboolean tsin_pho_mode();

  if (!tray_icon)
    return;

  GdkPixbuf *pix =  ((! current_CS) ||
                     (current_CS->im_state != HIME_STATE_CHINESE)) ?
                    pixbuf : pixbuf_ch;

  int w = 0, h = 0;
  iw = gtk_status_icon_get_size(tray_icon), ih = gtk_status_icon_get_size(tray_icon);

  cairo_surface_t *cst = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, iw, ih);
  cr = cairo_create (cst);
  gdk_cairo_set_source_color (cr, &red_color_fg);

  if (pix) {
    gdk_cairo_set_source_pixbuf (cr, pix, 0, 0);
    cairo_paint (cr);
  } else {
    get_text_w_h(inmd[current_CS->in_method].cname, &w, &h);
    cairo_move_to (cr, 0, 0);
    pango_cairo_show_layout (cr, pango);
  }

  if (current_CS) {
    gdk_cairo_set_source_color (cr, &red_color_fg);
    if (current_shape_mode()) {
      get_text_w_h(full,  &w, &h);
      cairo_move_to (cr, iw - w, ih - h);
      pango_cairo_show_layout (cr, pango);
    }
    if (current_CS->im_state == HIME_STATE_CHINESE && !tsin_pho_mode()) {
      gdk_cairo_set_source_color (cr, &blue_color_fg);
      get_text_w_h(engst,  &w, &h);
      cairo_move_to (cr, 0, 0);
      pango_cairo_show_layout (cr, pango);
    }
  }

  if (gb_output) {
    gdk_cairo_set_source_color (cr, &red_color_fg);
    get_text_w_h(sim,  &w, &h);
    cairo_move_to (cr, 0, ih - h);
    pango_cairo_show_layout (cr, pango);
  }
  cairo_destroy(cr); cr = NULL;
  GdkPixbuf *icon_pixbuf_output = gdk_pixbuf_get_from_surface(cst, 0, 0, iw, ih);
  cairo_surface_destroy(cst); cst = NULL;
  gtk_status_icon_set_from_pixbuf(tray_icon, icon_pixbuf_output);
  g_object_unref(icon_pixbuf_output); icon_pixbuf_output = NULL;
  pix = NULL;
}
Esempio n. 11
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. 12
0
File: fbxkb.c Progetto: kba/fbxkb
static void
gui_update()
{
    ENTER;
    DBG("group=%d name=%s flag=%p\n", cur_group, group[cur_group].name, 
        group[cur_group].flag);
    gtk_status_icon_set_from_pixbuf(icon, group[cur_group].flag);
    if (hide_default) 
        gtk_status_icon_set_visible(icon, cur_group);
    RET();
}
Esempio n. 13
0
static void _linphone_status_icon_impl_enable_blinking(LinphoneStatusIcon *si, gboolean val) {
    GtkStatusIcon *icon = GTK_STATUS_ICON(si->data);
    guint tout;
    tout=(unsigned)GPOINTER_TO_INT(g_object_get_data(G_OBJECT(icon),"timeout"));
    if (val && tout==0) {
        tout=g_timeout_add(500,(GSourceFunc)_linphone_status_icon_impl_gtk_do_icon_blink_cb,icon);
        g_object_set_data(G_OBJECT(icon),"timeout",GINT_TO_POINTER(tout));
    } else if (!val && tout!=0) {
        GdkPixbuf *normal_icon=g_object_get_data(G_OBJECT(icon),"icon");
        g_source_remove(tout);
        g_object_set_data(G_OBJECT(icon),"timeout",NULL);
        gtk_status_icon_set_from_pixbuf(icon,normal_icon);
    }
}
Esempio n. 14
0
/**
 * Checks whether playback is muted, updates the icon
 * and returns the result of ismuted().
 *
 * @param set_check whether the GtkCheckButton 'Mute' on the
 * volume popup_window is updated
 * @return result of ismuted()
 */
int get_mute_state(gboolean set_check) {
  int muted;
  int tmpvol = getvol();
  char tooltip [60];

  muted = ismuted();

  if( muted == 1 ) {
    GdkPixbuf *icon;
    if (set_check)
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mute_check), FALSE);
    if (tmpvol < 33)
      icon = status_icons[1];
    else if (tmpvol < 66)
      icon = status_icons[2];
    else
      icon = status_icons[3];
    sprintf(tooltip, _("Volume: %d %%"), tmpvol);

    if (vol_meter_row) {
      GdkPixbuf* old_icon = icon_copy;
      icon_copy = gdk_pixbuf_copy(icon);
      draw_vol_meter(icon_copy,draw_offset,5,(tmpvol*vol_div_factor));
      if (old_icon)
	g_object_unref(old_icon);
      gtk_status_icon_set_from_pixbuf(tray_icon, icon_copy);
    } else
      gtk_status_icon_set_from_pixbuf(tray_icon, icon);
  } else {
    if (set_check)
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mute_check), TRUE);
    gtk_status_icon_set_from_pixbuf(tray_icon, status_icons[0]);
    sprintf(tooltip, _("Volume: %d %%\nMuted"), tmpvol);
  }
  gtk_status_icon_set_tooltip_text(tray_icon, tooltip);
  return muted;
}
Esempio n. 15
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);
}
Esempio n. 16
0
File: flag.c Progetto: morenko/sven
void update_flag(xkb_info *k,gpointer data)
{
	AConvert *aconv = (AConvert *)data;
	Sven *sven = (Sven *)aconv->sven;
	
	if((aconv->sxkb->view_flag_tray==1)&&(sven->tray_icon!=NULL))
	{
		//gtk_tooltips_set_tip (sven->tray->tooltip,GTK_WIDGET (sven->tray->eggtray),k->name,NULL);
		gtk_status_icon_set_tooltip (sven->tray_icon, k->name);
		if (k->flag_img)
		{
			gtk_status_icon_set_from_pixbuf(sven->tray_icon,k->flag_img);
		}
		else
		{
			GdkPixbuf *pixbuf=create_pixbuf_flag("zz",25,20);
			gtk_status_icon_set_from_pixbuf(sven->tray_icon,pixbuf);
			//gtk_image_set_from_pixbuf(GTK_IMAGE(sven->tray->image),pixbuf);
			g_object_unref(pixbuf);
		}
	}
	if(aconv->sxkb->view_flag==1)
		greate_win_flag(k,aconv);
}
Esempio n. 17
0
void
fe_tray_set_file (const char *filename)
{
	tray_apply_setup ();
	if (!sticon)
		return;

	tray_stop_flash ();

	if (filename)
	{
		custom_icon1 = tray_icon_from_file (filename);
		gtk_status_icon_set_from_pixbuf (sticon, custom_icon1);
		tray_status = TS_CUSTOM;
	}
}
Esempio n. 18
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. 19
0
void gTrayIcon::updatePicture()
{
	GdkPixbuf *pixbuf;

	if (!plug)
		return;

	if (_icon)
		pixbuf = _icon->getPixbuf();
	else
		pixbuf = defaultIcon()->getPixbuf();

	gtk_status_icon_set_from_pixbuf(plug, pixbuf);

	_iconw = gdk_pixbuf_get_width(pixbuf);
	_iconh = gdk_pixbuf_get_height(pixbuf);
}
Esempio n. 20
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);
}
Esempio n. 21
0
static void
tray_set_flash (TrayIcon icon)
{
	if (!sticon)
		return;

	/* already flashing the same icon */
	if (flash_tag && gtk_status_icon_get_pixbuf (sticon) == icon)
		return;

	/* no flashing if window is focused */
	if (tray_get_window_status () == WS_FOCUSED)
		return;

	tray_stop_flash ();

	gtk_status_icon_set_from_pixbuf (sticon, icon);
	flash_tag = g_timeout_add (TIMEOUT, (GSourceFunc) tray_timeout_cb, icon);
}
Esempio n. 22
0
//
// Blinking uin's face image
//
static void qq_tray_blinking(QQTray *tray, const gchar *uin)
{
    gchar buf[500];
    GdkPixbuf *pb;
    QQBuddy *bdy = qq_info_lookup_buddy_by_uin(info, uin);

    // blinking
    if(bdy == NULL){
        g_snprintf(buf, 500, IMGDIR"/webqq_icon.png%s", "");
    }else{
        g_snprintf(buf, 500, CONFIGDIR"/faces/%s", bdy -> qqnumber -> str);
    }
    pb = gdk_pixbuf_new_from_file(buf, NULL);
    if(pb == NULL){
        pb = gdk_pixbuf_new_from_file(IMGDIR"/webqq_icon.png", NULL);
    }
    gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(tray), pb);
    g_object_unref(pb);
    gtk_status_icon_set_blinking(GTK_STATUS_ICON(tray), 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. 24
0
void
fe_tray_set_flash (const char *filename1, const char *filename2, int tout)
{
	tray_apply_setup ();
	if (!sticon)
		return;

	tray_stop_flash ();

	if (tout == -1)
		tout = TIMEOUT;

	custom_icon1 = tray_icon_from_file (filename1);
	if (filename2)
		custom_icon2 = tray_icon_from_file (filename2);

	gtk_status_icon_set_from_pixbuf (sticon, custom_icon1);
	flash_tag = g_timeout_add (tout, (GSourceFunc) tray_timeout_cb, NULL);
	tray_status = TS_CUSTOM;
}
Esempio n. 25
0
static void
statusicon_on_notification_added (boost::shared_ptr<Ekiga::Notification> notification,
                                  gpointer data)
{
  StatusIcon *self = STATUSICON (data);
  GdkPixbuf* pixbuf = gtk_widget_render_icon_pixbuf (self->priv->chat_window,
						     GTK_STOCK_DIALOG_WARNING,
						     GTK_ICON_SIZE_MENU);

  gchar *current_tooltip = gtk_status_icon_get_tooltip_text (GTK_STATUS_ICON (self));
  gchar *tooltip = NULL;
  if (current_tooltip != NULL)
    tooltip = g_strdup_printf ("%s\n%s", current_tooltip, notification->get_title ().c_str ());
  else
    tooltip = g_strdup (notification->get_title ().c_str ());

  gtk_status_icon_set_from_pixbuf (GTK_STATUS_ICON (self), pixbuf);
  gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON (self), tooltip);
  g_object_unref (pixbuf);

  g_free (current_tooltip);
  g_free (tooltip);
}
Esempio n. 26
0
static void
tray_stop_flash (void)
{
	int nets, chans;

	if (flash_tag)
	{
		g_source_remove (flash_tag);
		flash_tag = 0;
	}

	if (sticon)
	{
		gtk_status_icon_set_from_pixbuf (sticon, ICON_NORMAL);
		nets = tray_count_networks ();
		chans = tray_count_channels ();
		if (nets)
			tray_set_tipf (_(DISPLAY_NAME": Connected to %u networks and %u channels"),
								nets, chans);
		else
			tray_set_tipf (DISPLAY_NAME": %s", _("Not connected."));
	}

	if (custom_icon1)
	{
		tray_icon_free (custom_icon1);
		custom_icon1 = NULL;
	}

	if (custom_icon2)
	{
		tray_icon_free (custom_icon2);
		custom_icon2 = NULL;
	}

	tray_status = TS_NONE;
}
Esempio n. 27
0
void qq_tray_stop_blinking_for(QQTray *tray, const gchar *uin)
{
    if(tray == NULL || uin == NULL){
        return;
    }

    QQTrayPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE(tray, qq_tray_get_type()
                                                    , QQTrayPriv);

    gchar *tmpuin = NULL;
    g_queue_clear(priv -> tmp_queue);
    while(!g_queue_is_empty(priv -> blinking_queue)){
        tmpuin = g_queue_pop_tail(priv -> blinking_queue);
        if(g_strcmp0(tmpuin, uin) == 0){
            //remove it
            g_free(tmpuin);
            break;
        }
        g_queue_push_head(priv -> tmp_queue, tmpuin);
    }
    while(!g_queue_is_empty(priv -> tmp_queue)){
        g_queue_push_tail(priv -> blinking_queue
                            , g_queue_pop_head(priv -> tmp_queue));
    }

    GdkPixbuf *pb;
    if(g_queue_is_empty(priv -> blinking_queue)){
        // no more blinking
        gtk_status_icon_set_blinking(GTK_STATUS_ICON(tray), FALSE);
        pb = gdk_pixbuf_new_from_file(IMGDIR"/webqq_icon.png", NULL);
        gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(tray), pb);
        g_object_unref(pb);
    }else{
        qq_tray_blinking(tray, g_queue_peek_tail(priv -> blinking_queue));
    }
}
Esempio n. 28
0
int main(int argc, char* argv[])
{
	signal(SIGPIPE, SIG_IGN);
	char path[PATH_MAX];
	bool foundConfig = false;
#ifdef TOOLBAR_ICON	
	bool userConfig = false;
#endif
	
	// store for later
	_argc = argc;
	_argv = argv;

	/* syslog */
	int logOpt = LOG_PID | LOG_CONS | LOG_PERROR;
	openlog("mmserver", logOpt, LOG_DAEMON); 

	/* parse configuration */
	Configuration appConfig;
	if (argc == 1) {
		/* look for config file in user or system directory */		
		if (CheckUserConfig(path, sizeof path)) {
			foundConfig = true;
#ifdef TOOLBAR_ICON
			userConfig = true;
#endif
		} else if (CheckSystemConfig(path, sizeof path)) {
			foundConfig = true;
		}
	} else if (argc == 2) {
		/* interpret the argument as the path to a particular config file */
		snprintf(path, sizeof path, "%s", argv[1]);
		foundConfig = true;
	} else {
		fprintf(stderr, "Mobile Mouse Server for Linux (%s.%s.%s)\n",
				MMSERVER_VERSION_MAJOR, MMSERVER_VERSION_MINOR, MMSERVER_VERSION_PATCH);
		fprintf(stderr, "Website: https://github.com/anoved/mmserver/\n");
		fprintf(stderr, "Usage: %s [/path/to/mmserver.conf]\n", argv[0]);
		return 1;
	}

	if (foundConfig) {
		syslog(LOG_INFO, "reading configuration from %s", path);
		try {
			appConfig.Read(path);
		}
		catch (const libconfig::FileIOException &err) {
			syslog(LOG_ERR, "Cannot read configuration from: %s", path);
			exit(1);
		}
	} else {
		syslog(LOG_INFO, "no configuration file found; using internal defaults");
	}

	if (!appConfig.getKeyboardEnabled()) {
		syslog(LOG_INFO, "keyboard input ignored");
	}

	syslog(LOG_INFO, "started on port %d", appConfig.getPort());
	daemon(1, 1);

	if (appConfig.getZeroconf()) {
		StartAvahi(appConfig);
	}
	
	/* bind.. */
	struct sockaddr_in serv_addr;
	bzero((char *)&serv_addr, sizeof serv_addr);
	serv_addr.sin_family = AF_INET;
	serv_addr.sin_addr.s_addr = INADDR_ANY;
	serv_addr.sin_port = htons(appConfig.getPort());

	/* setup network.. */
	int sockfd = socket(AF_INET, SOCK_STREAM, 0);
	if (sockfd < 0)
	{
		syslog(LOG_ERR, "socket: %s", strerror(errno));
		exit(1);
	}

	int optval = 1;
	if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof optval) < 0)
	{
		syslog(LOG_ERR, "setsockopt: %s", strerror(errno));
		exit(1);
	}

	if (bind(sockfd, (struct sockaddr *)&serv_addr, sizeof serv_addr) < 0)
	{
		syslog(LOG_ERR, "bind: %s", strerror(errno));
		exit(1);
	}

	if (listen(sockfd, 1) < 0)
	{
		syslog(LOG_ERR, "listen: %s", strerror(errno));
		exit(1);
	}

#ifdef TOOLBAR_ICON
	pthread_t toolbarpid;
	if (pthread_create(&toolbarpid, 0x0, GTKStartup, (void*)(userConfig ? path : NULL)) == -1)
	{
		syslog(LOG_WARNING, "pthread_create failed: %s", strerror(errno));
	}
#endif

	/* server loop.. */
	while(1)
	{
		struct sockaddr_in caddr;
		int clen = sizeof caddr;

		/* accept client.. */
		int client = accept(sockfd, (struct sockaddr *)&caddr, (socklen_t*)&clen);
		if (client < 0)
		{
			syslog(LOG_WARNING, "accept failed: %s", strerror(errno));
			continue;
		}

		/* start new session.. */
		SessionContext * clientContext = new SessionContext(appConfig,
				client,
				inet_ntoa(caddr.sin_addr));

#ifdef TOOLBAR_ICON
		gtk_status_icon_set_tooltip(tray, std::string(clientContext->m_address + " connected").c_str());
		gtk_status_icon_set_from_pixbuf(tray, connected_icon);
#endif

		pthread_t pid;
		if (pthread_create(&pid, 0x0, MobileMouseSession, (void*)clientContext) == -1)
		{
			syslog(LOG_WARNING, "pthread_create failed: %s", strerror(errno));
			delete clientContext;
			close(client);
		} else 
			pthread_join(pid, 0x0);

#ifdef TOOLBAR_ICON
		gtk_status_icon_set_tooltip(tray, TOOLBAR_LABEL_DEFAULT);
		gtk_status_icon_set_from_pixbuf(tray, idle_icon);
#endif
	}

	return 0;
}
Esempio n. 29
0
void icon_set()
{
  gtk_status_icon_set_from_pixbuf(status_icon, icon_alert);
}
Esempio n. 30
0
void icon_reset()
{
  gtk_status_icon_set_from_pixbuf(status_icon, icon_idle);
}