annotate src/statusicon/si_ui.c @ 796:f3ce11fad729 trunk

[svn] statusicon: improvements in title changes detection while the popup is being displayed
author giacomo
date Thu, 08 Mar 2007 04:20:23 -0800
parents ca6dca840074
children aac49941ee8f
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>
527
d124034ebea3 [svn] - glib/gi18n.h -> audacious/i18n.h for automatic dgettext support
nenolod
parents: 456
diff changeset
30 #include <audacious/i18n.h>
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
31 #include <glib.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>
542
d58404ba9af9 [svn] - made popup window use audacious_fileinfopopup_show_from_title if track_name and song length is not available
giacomo
parents: 527
diff changeset
33 #include <gdk/gdkx.h>
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
34 #include <gtk/gtk.h>
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
796
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
37 static void si_ui_statusicon_popup_timer_start ( GtkWidget * );
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
38 static void si_ui_statusicon_popup_timer_stop ( GtkWidget * );
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
39
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
40
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
41 /* this stuff required to make titlechange hook work properly */
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
42 typedef struct
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
43 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
44 gchar *title;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
45 gchar *filename;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
46 gpointer evbox;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
47 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
48 si_hook_tchange_prevs_t;
433
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 static GtkTrayIcon *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
52 si_ui_statusicon_create ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
53 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
54 GtkTrayIcon *si_applet = NULL;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
55
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
56 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
57
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
58 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
59
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
60 return si_applet;
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
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
64 static gboolean
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
65 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
66 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
67 switch ( event->button )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
68 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
69 case 1:
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
70 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
71 si_audacious_toggle_visibility();
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
72 break;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
73 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
74
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
75 case 3:
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
76 {
452
829f029fbd03 [svn] - status icon plugin: display main menu on right click
giacomo
parents: 448
diff changeset
77 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
78 break;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
79 }
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
80 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
81
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
82 return FALSE;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
83 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
84
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
85
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
86 static gboolean
453
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
87 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
88 {
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
89 switch ( event->direction )
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 case GDK_SCROLL_UP:
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
92 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
93 break;
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
94 case GDK_SCROLL_DOWN:
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
95 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
96 break;
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
97 }
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
98
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
99 return FALSE;
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
100 }
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
101
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
102
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 452
diff changeset
103 static gboolean
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
104 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
105 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
106 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
107 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
108 TitleInput *tuple;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
109 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
110 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
111 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
112
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
113 tuple = playlist_get_tuple( pl_active , pos );
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
114 if ( ( tuple == NULL ) || ( tuple->length < 1 ) )
542
d58404ba9af9 [svn] - made popup window use audacious_fileinfopopup_show_from_title if track_name and song length is not available
giacomo
parents: 527
diff changeset
115 {
d58404ba9af9 [svn] - made popup window use audacious_fileinfopopup_show_from_title if track_name and song length is not available
giacomo
parents: 527
diff changeset
116 gchar *title = playlist_get_songtitle( pl_active , pos );
d58404ba9af9 [svn] - made popup window use audacious_fileinfopopup_show_from_title if track_name and song length is not available
giacomo
parents: 527
diff changeset
117 audacious_fileinfopopup_show_from_title( popup , title );
d58404ba9af9 [svn] - made popup window use audacious_fileinfopopup_show_from_title if track_name and song length is not available
giacomo
parents: 527
diff changeset
118 g_free( title );
d58404ba9af9 [svn] - made popup window use audacious_fileinfopopup_show_from_title if track_name and song length is not available
giacomo
parents: 527
diff changeset
119 }
d58404ba9af9 [svn] - made popup window use audacious_fileinfopopup_show_from_title if track_name and song length is not available
giacomo
parents: 527
diff changeset
120 else
d58404ba9af9 [svn] - made popup window use audacious_fileinfopopup_show_from_title if track_name and song length is not available
giacomo
parents: 527
diff changeset
121 {
d58404ba9af9 [svn] - made popup window use audacious_fileinfopopup_show_from_title if track_name and song length is not available
giacomo
parents: 527
diff changeset
122 audacious_fileinfopopup_show_from_tuple( popup , tuple );
d58404ba9af9 [svn] - made popup window use audacious_fileinfopopup_show_from_title if track_name and song length is not available
giacomo
parents: 527
diff changeset
123 }
439
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 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
126 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
127
796
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
128 si_ui_statusicon_popup_timer_stop( evbox );
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
129 return FALSE;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
130 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
131
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 static void
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
134 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
135 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
136 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
137 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
138 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
139 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
140 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
141 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
142 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
143
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 static void
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
146 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
147 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
148 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
149 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
150 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
151 return;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
152 }
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
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
155 static void
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
156 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
157 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
158 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
159 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
160
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
161 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
162 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
163 return;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
164 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
165
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
166
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
167 static void
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
168 si_ui_statusicon_cb_hook_pbstart ( gpointer plentry_gp , gpointer evbox )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
169 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
170 if ( ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(evbox) , "popup_active" )) == 1 ) &&
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
171 ( plentry_gp != NULL ) )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
172 {
796
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
173 g_print("hook change? 1\n");
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
174 si_ui_statusicon_popup_hide( evbox );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
175 si_ui_statusicon_popup_timer_start( evbox );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
176 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
177 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
178
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
179
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
180 static void
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
181 si_ui_statusicon_cb_hook_tchange ( gpointer plentry_gp , gpointer prevs_gp )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
182 {
796
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
183 /* NOTE: this is quite intricated, but it works nicely and it's still
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
184 much better than polling; wonder if it can be simplified with some
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
185 help from the core player */
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
186 si_hook_tchange_prevs_t *prevs = prevs_gp;
796
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
187 PlaylistEntry *pl_entry = plentry_gp;
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
188 if ( ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(prevs->evbox) , "popup_active" )) == 1 ) &&
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
189 ( plentry_gp != NULL ) )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
190 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
191 if ( ( prevs->title != NULL ) && ( prevs->filename != NULL ) )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
192 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
193 if ( ( pl_entry->filename != NULL ) &&
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
194 ( !strcmp(pl_entry->filename,prevs->filename) ) )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
195 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
196 if ( ( pl_entry->title != NULL ) &&
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
197 ( strcmp(pl_entry->title,prevs->title) ) )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
198 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
199 si_ui_statusicon_popup_hide( prevs->evbox );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
200 si_ui_statusicon_popup_timer_start( prevs->evbox );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
201 g_free( prevs->title );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
202 prevs->title = g_strdup(pl_entry->title);
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
203 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
204 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
205 else
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
206 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
207 g_free(prevs->filename);
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
208 prevs->filename = g_strdup(pl_entry->filename);
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
209 /* if filename changes, reset title as well */
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
210 if ( prevs->title != NULL )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
211 g_free(prevs->title);
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
212 prevs->title = g_strdup(pl_entry->title);
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
213 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
214 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
215 else
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
216 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
217 if ( prevs->title != NULL )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
218 g_free(prevs->title);
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
219 prevs->title = g_strdup(pl_entry->title);
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
220 if ( prevs->filename != NULL )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
221 g_free(prevs->filename);
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
222 prevs->filename = g_strdup(pl_entry->filename);
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
223 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
224 }
796
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
225 else if ( ( prevs->title != NULL ) && ( strcmp(pl_entry->title,prevs->title) ) )
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
226 {
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
227 g_free(prevs->title);
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
228 prevs->title = g_strdup(pl_entry->title);
f3ce11fad729 [svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents: 795
diff changeset
229 }
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
230 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
231
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
232
439
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
233 static gboolean
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
234 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
235 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
236 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
237 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
238 return FALSE;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
239
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
240 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
241 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
242 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
243 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
244 return FALSE;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
245 }
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
246
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
247 switch (event->type)
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
248 {
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
249 case GDK_EXPOSE:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
250 /* do nothing */
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
251 break;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
252
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
253 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
254 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
255 break;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
256
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
257 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
258 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
259 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
260 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
261 break;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
262
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
263 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
264 break; /* ignore */
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 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
267 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
268 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
269 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
270 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
271 case GDK_SCROLL:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
272 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
273 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
274 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
275 break;
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
276
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
277 default:
84029a5250c1 [svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents: 433
diff changeset
278 break;
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
279 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
280
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
281 return FALSE;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
282 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
283
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
284
440
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
285 static void
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
286 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
287 {
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
288 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
289 gint size = GPOINTER_TO_INT(g_object_get_data( G_OBJECT(image) , "size" ));
455
f001b217c88b [svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
giacomo
parents: 454
diff changeset
290 static gchar *wmname = NULL;
f001b217c88b [svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
giacomo
parents: 454
diff changeset
291
f001b217c88b [svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
giacomo
parents: 454
diff changeset
292 /* sometimes, KDE won't give the correct size-allocation; workaround this */
f001b217c88b [svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
giacomo
parents: 454
diff changeset
293 if ( wmname == NULL )
f001b217c88b [svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
giacomo
parents: 454
diff changeset
294 {
f001b217c88b [svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
giacomo
parents: 454
diff changeset
295 GdkScreen *screen = gdk_screen_get_default();
f001b217c88b [svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
giacomo
parents: 454
diff changeset
296 if ( screen != NULL )
f001b217c88b [svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
giacomo
parents: 454
diff changeset
297 wmname = (gchar*)gdk_x11_screen_get_window_manager_name( screen );
f001b217c88b [svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
giacomo
parents: 454
diff changeset
298 }
456
2e0b55117302 [svn] - status icon plugin: better logic for KWin workaround
giacomo
parents: 455
diff changeset
299 if ( ( size > 22 ) && ( wmname != NULL ) && ( !strcmp("KWin",wmname) ) )
455
f001b217c88b [svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
giacomo
parents: 454
diff changeset
300 size = 22;
440
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
301
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
302 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
303 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
304 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
305 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
306 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
307
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
308 return;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
309 }
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
310
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
311
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
312 static void
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
313 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
314 {
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
315 GtkOrientation orientation;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
316 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
317 gint size = 0;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
318
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
319 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
320 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
321 size = allocation->height;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
322 else
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
323 size = allocation->width;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
324
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
325 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
326 {
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
327 prev_size = size;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
328 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
329 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
330 }
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
331
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
332 return;
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
333 }
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
334
84fdf898438b [svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents: 439
diff changeset
335
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
336 void
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
337 si_ui_statusicon_enable ( gboolean enable )
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
338 {
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
339 static GtkWidget * si_evbox = NULL;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
340 static si_hook_tchange_prevs_t * si_hook_tchange_prevs = NULL;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
341
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
342 if ( enable == TRUE )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
343 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
344 GtkWidget *si_image;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
345 GtkWidget *si_popup;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
346 GtkTrayIcon *si_applet;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
347 GtkRequisition req;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
348 GtkAllocation allocation;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
349
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
350 si_applet = si_ui_statusicon_create();
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
351 if ( si_applet == NULL )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
352 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
353 g_warning( "StatusIcon plugin: unable to create a status icon.\n" );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
354 return;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
355 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
356
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
357 si_image = gtk_image_new();
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
358 g_object_set_data( G_OBJECT(si_image) , "size" , GINT_TO_POINTER(0) );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
359
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
360 g_signal_connect( si_image , "size-allocate" ,
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
361 G_CALLBACK(si_ui_statusicon_cb_image_sizalloc) , si_applet );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
362
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
363 si_evbox = gtk_event_box_new();
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
364 si_popup = audacious_fileinfopopup_create();
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
365
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
366 g_object_set_data( G_OBJECT(si_evbox) , "applet" , si_applet );
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
367
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
368 g_object_set_data( G_OBJECT(si_evbox) , "timer_id" , GINT_TO_POINTER(0) );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
369 g_object_set_data( G_OBJECT(si_evbox) , "timer_active" , GINT_TO_POINTER(0) );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
370
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
371 g_object_set_data( G_OBJECT(si_evbox) , "popup_active" , GINT_TO_POINTER(0) );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
372 g_object_set_data( G_OBJECT(si_evbox) , "popup" , si_popup );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
373
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
374 g_signal_connect( G_OBJECT(si_evbox) , "button-press-event" ,
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
375 G_CALLBACK(si_ui_statusicon_cb_btpress) , NULL );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
376 g_signal_connect( G_OBJECT(si_evbox) , "scroll-event" ,
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
377 G_CALLBACK(si_ui_statusicon_cb_btscroll) , NULL );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
378 g_signal_connect_after( G_OBJECT(si_evbox) , "event-after" ,
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
379 G_CALLBACK(si_ui_statusicon_cb_popup) , NULL );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
380
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
381 gtk_container_add( GTK_CONTAINER(si_evbox), si_image );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
382 gtk_container_add( GTK_CONTAINER(si_applet), si_evbox );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
383
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
384 gtk_widget_show_all( GTK_WIDGET(si_applet) );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
385
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
386 gtk_widget_size_request( GTK_WIDGET(si_applet) , &req );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
387 allocation.x = 0;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
388 allocation.y = 0;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
389 allocation.width = req.width;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
390 allocation.height = req.height;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
391 gtk_widget_size_allocate( GTK_WIDGET(si_applet) , &allocation );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
392
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
393 hook_associate( "playback begin" , si_ui_statusicon_cb_hook_pbstart , si_evbox );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
394 si_hook_tchange_prevs = g_malloc0(sizeof(si_hook_tchange_prevs_t));
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
395 si_hook_tchange_prevs->title = NULL;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
396 si_hook_tchange_prevs->filename = NULL;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
397 si_hook_tchange_prevs->evbox = si_evbox;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
398 hook_associate( "playlist set info" , si_ui_statusicon_cb_hook_tchange , si_hook_tchange_prevs );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
399
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
400 return;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
401 }
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
402 else
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
403 {
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
404 if ( si_evbox != NULL )
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
405 {
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
406 GtkTrayIcon *si_applet = g_object_get_data( G_OBJECT(si_evbox) , "applet" );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
407 si_ui_statusicon_popup_timer_stop( si_evbox ); /* just in case the timer is active */
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
408 gtk_widget_destroy( GTK_WIDGET(si_evbox) );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
409 gtk_widget_destroy( GTK_WIDGET(si_applet) );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
410 hook_dissociate( "playback begin" , si_ui_statusicon_cb_hook_pbstart );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
411 hook_dissociate( "playlist set info" , si_ui_statusicon_cb_hook_tchange );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
412 if ( si_hook_tchange_prevs->title != NULL ) g_free( si_hook_tchange_prevs->title );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
413 if ( si_hook_tchange_prevs->filename != NULL ) g_free( si_hook_tchange_prevs->filename );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
414 g_free( si_hook_tchange_prevs );
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
415 si_hook_tchange_prevs = NULL;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
416 si_evbox = NULL;
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
417 }
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 542
diff changeset
418 return;
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
419 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
420 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
421
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
422
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
423 void
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
424 si_ui_about_show ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
425 {
454
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
426 static GtkWidget *about_dlg = NULL;
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
427 gchar *about_title;
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
428 gchar *about_text;
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
429
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
430 if ( about_dlg != NULL )
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
431 {
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
432 gtk_window_present( GTK_WINDOW(about_dlg) );
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
433 return;
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
434 }
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
435
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
436 about_title = g_strdup( _("About Status Icon Plugin") );
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
437 about_text = g_strjoin( "" , "Status Icon Plugin " , SI_VERSION_PLUGIN ,
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
438 _("\nwritten by Giacomo Lozito < james@develia.org >\n\n"
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
439 "This plugin provides a status icon, placed in\n"
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
440 "the system tray area of the window manager.\n") , NULL );
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
441
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
442 about_dlg = xmms_show_message( about_title , about_text , _("Ok") , FALSE , NULL , NULL );
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
443 g_signal_connect( G_OBJECT(about_dlg) , "destroy" ,
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
444 G_CALLBACK(gtk_widget_destroyed), &about_dlg );
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
445 g_free( about_text );
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
446 g_free( about_title );
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
447
6c1c03111db4 [svn] - use xmms_show_message for the about box
giacomo
parents: 453
diff changeset
448 gtk_widget_show_all( about_dlg );
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
449 return;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
450 }