annotate src/statusicon/si_ui.c @ 453:60395c0d7587 trunk

[svn] - status icon plugin: use scroll wheel on the status icon to change volume
author giacomo
date Wed, 17 Jan 2007 03:34:44 -0800
parents 829f029fbd03
children 6c1c03111db4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
1 /*
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
2 *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
3 * Author: Giacomo Lozito <james@develia.org>, (C) 2005-2007
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
4 *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify it
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
6 * under the terms of the GNU General Public License as published by the
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
7 * Free Software Foundation; either version 2 of the License, or (at your
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
8 * option) any later version.
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
9 *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful, but
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
13 * General Public License for more details.
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
14 *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License along
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
16 * with this program; if not, write to the Free Software Foundation, Inc.,
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
18 *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
19 */
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
20
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
21 #include "si_ui.h"
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
22 #include "si_audacious.h"
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
23 #include "si_common.h"
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
24 #include "gtktrayicon.h"
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
25 #include "si.xpm"
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
26 #include <audacious/playlist.h>
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
27 #include <audacious/titlestring.h>
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
28 #include <audacious/ui_fileinfopopup.h>
452
829f029fbd03 [svn] - status icon plugin: display main menu on right click
giacomo
parents: 448
diff changeset
29 #include <audacious/util.h>
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
30 #include <glib.h>
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
31 #include <glib/gi18n.h>
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
32 #include <gdk/gdk.h>
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
33 #include <gtk/gtk.h>
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
34
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
35
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
36 static GtkWidget * si_evbox = NULL;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
37
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
38
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
39 static GtkTrayIcon *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
40 si_ui_statusicon_create ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
41 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
42 GtkTrayIcon *si_applet = NULL;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
43
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
44 si_applet = _gtk_tray_icon_new( "audacious" );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
45
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
46 gtk_widget_show( GTK_WIDGET(si_applet) );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
47
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
48 return si_applet;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
49 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
50
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
51
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
52 static gboolean
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
53 si_ui_statusicon_cb_btpress ( GtkWidget * evbox , GdkEventButton * event )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
54 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
55 switch ( event->button )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
56 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
57 case 1:
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
58 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
59 si_audacious_toggle_visibility();
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
60 break;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
61 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
62
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
63 case 3:
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
64 {
452
829f029fbd03 [svn] - status icon plugin: display main menu on right click
giacomo
parents: 448
diff changeset
65 audacious_menu_main_show( event->x_root , event->y_root , 3 , event->time );
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
66 break;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
67 }
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
68 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
69
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
70 return FALSE;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
71 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
72
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
73
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
74 static gboolean
453
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
75 si_ui_statusicon_cb_btscroll ( GtkWidget * evbox , GdkEventScroll * event )
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
76 {
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
77 switch ( event->direction )
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
78 {
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
79 case GDK_SCROLL_UP:
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
80 si_audacious_volume_change( 5 );
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
81 break;
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
82 case GDK_SCROLL_DOWN:
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
83 si_audacious_volume_change( -5 );
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
84 break;
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
85 }
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
86
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
87 return FALSE;
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
88 }
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
89
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
90
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
91 static gboolean
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
92 si_ui_statusicon_popup_show ( gpointer evbox )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
93 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
94 if ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(evbox) , "timer_active" )) == 1 )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
95 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
96 TitleInput *tuple;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
97 Playlist *pl_active = playlist_get_active();
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
98 gint pos = playlist_get_position(pl_active);
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
99 GtkWidget *popup = g_object_get_data( G_OBJECT(evbox) , "popup" );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
100
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
101 tuple = playlist_get_tuple( pl_active , pos );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
102 audacious_fileinfopopup_show_from_tuple( popup , tuple );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
103
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
104 g_object_set_data( G_OBJECT(evbox) , "popup_active" , GINT_TO_POINTER(1) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
105 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
106
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
107 g_object_set_data( G_OBJECT(evbox) , "timer_id" , GINT_TO_POINTER(0) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
108 g_object_set_data( G_OBJECT(evbox) , "timer_active" , GINT_TO_POINTER(0) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
109 return FALSE;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
110 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
111
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
112
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
113 static void
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
114 si_ui_statusicon_popup_hide ( gpointer evbox )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
115 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
116 if ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(evbox) , "popup_active" )) == 1 )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
117 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
118 GtkWidget *popup = g_object_get_data( G_OBJECT(evbox) , "popup" );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
119 g_object_set_data( G_OBJECT(evbox) , "popup_active" , GINT_TO_POINTER(0) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
120 audacious_fileinfopopup_hide( popup , NULL );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
121 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
122 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
123
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
124
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
125 static void
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
126 si_ui_statusicon_popup_timer_start ( GtkWidget * evbox )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
127 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
128 gint timer_id = g_timeout_add( 500 , si_ui_statusicon_popup_show , evbox );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
129 g_object_set_data( G_OBJECT(evbox) , "timer_id" , GINT_TO_POINTER(timer_id) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
130 g_object_set_data( G_OBJECT(evbox) , "timer_active" , GINT_TO_POINTER(1) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
131 return;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
132 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
133
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
134
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
135 static void
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
136 si_ui_statusicon_popup_timer_stop ( GtkWidget * evbox )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
137 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
138 if ( GPOINTER_TO_INT(g_object_get_data(G_OBJECT(evbox),"timer_active")) == 1 )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
139 g_source_remove( GPOINTER_TO_INT(g_object_get_data(G_OBJECT(evbox),"timer_id")) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
140
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
141 g_object_set_data( G_OBJECT(evbox) , "timer_id" , GINT_TO_POINTER(0) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
142 g_object_set_data( G_OBJECT(evbox) , "timer_active" , GINT_TO_POINTER(0) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
143 return;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
144 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
145
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
146
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
147 static gboolean
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
148 si_ui_statusicon_cb_popup ( GtkWidget * evbox , GdkEvent * event )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
149 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
150 if ((event->type == GDK_LEAVE_NOTIFY || event->type == GDK_ENTER_NOTIFY) &&
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
151 event->crossing.detail == GDK_NOTIFY_INFERIOR)
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
152 return FALSE;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
153
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
154 if ( event->type != GDK_KEY_PRESS && event->type != GDK_KEY_RELEASE )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
155 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
156 GtkWidget *event_widget = gtk_get_event_widget( event );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
157 if ( event_widget != evbox )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
158 return FALSE;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
159 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
160
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
161 switch (event->type)
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
162 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
163 case GDK_EXPOSE:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
164 /* do nothing */
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
165 break;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
166
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
167 case GDK_ENTER_NOTIFY:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
168 si_ui_statusicon_popup_timer_start( evbox );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
169 break;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
170
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
171 case GDK_LEAVE_NOTIFY:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
172 si_ui_statusicon_popup_timer_stop( evbox );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
173 if ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(evbox) , "popup_active" )) == 1 )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
174 si_ui_statusicon_popup_hide( evbox );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
175 break;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
176
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
177 case GDK_MOTION_NOTIFY:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
178 break; /* ignore */
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
179
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
180 case GDK_BUTTON_PRESS:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
181 case GDK_BUTTON_RELEASE:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
182 case GDK_KEY_PRESS:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
183 case GDK_KEY_RELEASE:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
184 case GDK_PROXIMITY_IN:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
185 case GDK_SCROLL:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
186 si_ui_statusicon_popup_timer_stop( evbox );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
187 if ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(evbox) , "popup_active" )) == 1 )
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
188 si_ui_statusicon_popup_hide( evbox );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
189 break;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
190
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
191 default:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
192 break;
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
193 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
194
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
195 return FALSE;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
196 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
197
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
198
440
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
199 static void
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
200 si_ui_statusicon_image_update ( GtkWidget * image )
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
201 {
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
202 GdkPixbuf *si_pixbuf, *si_scaled_pixbuf;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
203 gint size = GPOINTER_TO_INT(g_object_get_data( G_OBJECT(image) , "size" ));
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
204
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
205 si_pixbuf = gdk_pixbuf_new_from_xpm_data( (const char**)si_xpm );
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
206 si_scaled_pixbuf = gdk_pixbuf_scale_simple( si_pixbuf , size , size , GDK_INTERP_BILINEAR );
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
207 gtk_image_set_from_pixbuf( GTK_IMAGE(image) , si_scaled_pixbuf );
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
208 g_object_unref( si_pixbuf );
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
209 g_object_unref( si_scaled_pixbuf );
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
210
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
211 return;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
212 }
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
213
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
214
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
215 static void
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
216 si_ui_statusicon_cb_image_sizalloc ( GtkWidget * image , GtkAllocation * allocation , gpointer si_applet )
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
217 {
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
218 GtkOrientation orientation;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
219 static gint prev_size = 0;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
220 gint size = 0;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
221
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
222 orientation = _gtk_tray_icon_get_orientation( GTK_TRAY_ICON(si_applet) );
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
223 if ( orientation == GTK_ORIENTATION_HORIZONTAL )
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
224 size = allocation->height;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
225 else
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
226 size = allocation->width;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
227
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
228 if ( prev_size != size )
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
229 {
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
230 prev_size = size;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
231 g_object_set_data( G_OBJECT(image) , "size" , GINT_TO_POINTER(size) );
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
232 si_ui_statusicon_image_update( image );
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
233 }
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
234
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
235 return;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
236 }
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
237
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
238
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
239 void
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
240 si_ui_statusicon_show ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
241 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
242 GtkWidget *si_image;
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
243 GtkWidget *si_popup;
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
244 GtkTrayIcon *si_applet;
448
da802c766018 [svn] status icon plugin: ensure that the size-allocate signal is called for the tray icon widget
giacomo
parents: 440
diff changeset
245 GtkRequisition req;
da802c766018 [svn] status icon plugin: ensure that the size-allocate signal is called for the tray icon widget
giacomo
parents: 440
diff changeset
246 GtkAllocation allocation;
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
247
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
248 si_applet = si_ui_statusicon_create();
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
249 if ( si_applet == NULL )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
250 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
251 g_warning( "StatusIcon plugin: unable to create a status icon.\n" );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
252 return;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
253 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
254
440
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
255 si_image = gtk_image_new();
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
256 g_object_set_data( G_OBJECT(si_image) , "size" , GINT_TO_POINTER(0) );
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
257
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
258 g_signal_connect( si_image , "size-allocate" ,
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
259 G_CALLBACK(si_ui_statusicon_cb_image_sizalloc) , si_applet );
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
260
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
261 si_evbox = gtk_event_box_new();
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
262 si_popup = audacious_fileinfopopup_create();
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
263
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
264 g_object_set_data( G_OBJECT(si_evbox) , "applet" , si_applet );
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
265
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
266 g_object_set_data( G_OBJECT(si_evbox) , "timer_id" , GINT_TO_POINTER(0) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
267 g_object_set_data( G_OBJECT(si_evbox) , "timer_active" , GINT_TO_POINTER(0) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
268
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
269 g_object_set_data( G_OBJECT(si_evbox) , "popup_active" , GINT_TO_POINTER(0) );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
270 g_object_set_data( G_OBJECT(si_evbox) , "popup" , si_popup );
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
271
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
272 g_signal_connect( G_OBJECT(si_evbox) , "button-press-event" ,
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
273 G_CALLBACK(si_ui_statusicon_cb_btpress) , NULL );
453
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
274 g_signal_connect( G_OBJECT(si_evbox) , "scroll-event" ,
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
275 G_CALLBACK(si_ui_statusicon_cb_btscroll) , NULL );
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
276 g_signal_connect_after( G_OBJECT(si_evbox) , "event-after" ,
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
277 G_CALLBACK(si_ui_statusicon_cb_popup) , NULL );
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
278
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
279 gtk_container_add( GTK_CONTAINER(si_evbox), si_image );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
280 gtk_container_add( GTK_CONTAINER(si_applet), si_evbox );
453
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
281
448
da802c766018 [svn] status icon plugin: ensure that the size-allocate signal is called for the tray icon widget
giacomo
parents: 440
diff changeset
282 gtk_widget_show_all( GTK_WIDGET(si_applet) );
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
283
448
da802c766018 [svn] status icon plugin: ensure that the size-allocate signal is called for the tray icon widget
giacomo
parents: 440
diff changeset
284 gtk_widget_size_request( GTK_WIDGET(si_applet) , &req );
da802c766018 [svn] status icon plugin: ensure that the size-allocate signal is called for the tray icon widget
giacomo
parents: 440
diff changeset
285 allocation.x = 0;
da802c766018 [svn] status icon plugin: ensure that the size-allocate signal is called for the tray icon widget
giacomo
parents: 440
diff changeset
286 allocation.y = 0;
da802c766018 [svn] status icon plugin: ensure that the size-allocate signal is called for the tray icon widget
giacomo
parents: 440
diff changeset
287 allocation.width = req.width;
da802c766018 [svn] status icon plugin: ensure that the size-allocate signal is called for the tray icon widget
giacomo
parents: 440
diff changeset
288 allocation.height = req.height;
da802c766018 [svn] status icon plugin: ensure that the size-allocate signal is called for the tray icon widget
giacomo
parents: 440
diff changeset
289 gtk_widget_size_allocate( GTK_WIDGET(si_applet) , &allocation );
da802c766018 [svn] status icon plugin: ensure that the size-allocate signal is called for the tray icon widget
giacomo
parents: 440
diff changeset
290
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
291 return;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
292 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
293
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
294
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
295 void
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
296 si_ui_statusicon_hide ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
297 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
298 if ( si_evbox != NULL )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
299 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
300 GtkTrayIcon *si_applet = g_object_get_data( G_OBJECT(si_evbox) , "applet" );
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
301 si_ui_statusicon_popup_timer_stop( si_evbox ); /* just in case the timer is active */
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
302 gtk_widget_destroy( GTK_WIDGET(si_evbox) );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
303 gtk_widget_destroy( GTK_WIDGET(si_applet) );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
304 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
305 return;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
306 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
307
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
308
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
309 void
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
310 si_ui_about_show ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
311 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
312 GtkWidget *about_dlg = gtk_message_dialog_new(
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
313 NULL , 0 , GTK_MESSAGE_INFO , GTK_BUTTONS_CLOSE ,
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
314 _( "Status Icon Plugin " SI_VERSION_PLUGIN "\n"
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
315 "written by Giacomo Lozito < james@develia.org >\n\n"
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
316 "This plugin provides a status icon, placed in\n"
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
317 "the system tray area of the window manager.\n" ) );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
318 gtk_dialog_run( GTK_DIALOG(about_dlg) );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
319 gtk_widget_destroy( about_dlg );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
320 return;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
321 }