Mercurial > audlegacy-plugins
annotate src/statusicon/si_ui.c @ 886:f2fde7b4dccd trunk
[svn] - statusicon: use function/define names that do not collide with gtk >= 2.10 internals (paranoia)
author | giacomo |
---|---|
date | Wed, 21 Mar 2007 07:15:43 -0700 |
parents | fbf1f593b0c6 |
children | 209bd85dc1b9 |
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" |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
23 #include "si_cfg.h" |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
24 #include "si_common.h" |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
25 #include "gtktrayicon.h" |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
26 #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
|
27 #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
|
28 #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
|
29 #include <audacious/ui_fileinfopopup.h> |
452
829f029fbd03
[svn] - status icon plugin: display main menu on right click
giacomo
parents:
448
diff
changeset
|
30 #include <audacious/util.h> |
527
d124034ebea3
[svn] - glib/gi18n.h -> audacious/i18n.h for automatic dgettext support
nenolod
parents:
456
diff
changeset
|
31 #include <audacious/i18n.h> |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
32 #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
|
33 #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
|
34 #include <gdk/gdkx.h> |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
35 #include <gtk/gtk.h> |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
36 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
37 |
796
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_start ( GtkWidget * ); |
f3ce11fad729
[svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents:
795
diff
changeset
|
39 static void si_ui_statusicon_popup_timer_stop ( GtkWidget * ); |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
40 static void si_ui_statusicon_smallmenu_show ( gint x, gint y, guint button, guint32 time , gpointer ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
41 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
42 extern si_cfg_t si_cfg; |
796
f3ce11fad729
[svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents:
795
diff
changeset
|
43 |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
44 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
45 /* 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
|
46 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
|
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 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
|
49 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
|
50 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
|
51 } |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
52 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
|
53 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
54 |
886
f2fde7b4dccd
[svn] - statusicon: use function/define names that do not collide with gtk >= 2.10 internals (paranoia)
giacomo
parents:
855
diff
changeset
|
55 static AudGtkTrayIcon * |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
56 si_ui_statusicon_create ( void ) |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
57 { |
886
f2fde7b4dccd
[svn] - statusicon: use function/define names that do not collide with gtk >= 2.10 internals (paranoia)
giacomo
parents:
855
diff
changeset
|
58 AudGtkTrayIcon *si_applet = NULL; |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
59 |
886
f2fde7b4dccd
[svn] - statusicon: use function/define names that do not collide with gtk >= 2.10 internals (paranoia)
giacomo
parents:
855
diff
changeset
|
60 si_applet = _aud_gtk_tray_icon_new( "audacious" ); |
433
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 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
|
63 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
64 return si_applet; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
65 } |
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 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
68 static gboolean |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
69 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
|
70 { |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
71 switch ( event->button ) |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
72 { |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
73 case 1: |
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 si_audacious_toggle_visibility(); |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
76 break; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
77 } |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
78 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
79 case 3: |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
80 { |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
81 switch ( si_cfg.rclick_menu ) |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
82 { |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
83 case SI_CFG_RCLICK_MENU_SMALL: |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
84 si_ui_statusicon_smallmenu_show( event->x_root , event->y_root , 3 , event->time , evbox ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
85 break; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
86 case SI_CFG_RCLICK_MENU_AUD: |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
87 default: |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
88 audacious_menu_main_show( event->x_root , event->y_root , 3 , event->time ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
89 break; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
90 } |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
91 break; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
92 } |
439
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 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
95 return FALSE; |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
96 } |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
97 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
98 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
99 static gboolean |
453
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
100 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
|
101 { |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
102 switch ( event->direction ) |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
103 { |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
104 case GDK_SCROLL_UP: |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
105 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
|
106 break; |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
107 case GDK_SCROLL_DOWN: |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
108 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
|
109 break; |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
110 } |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
111 |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
112 return FALSE; |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
113 } |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
114 |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
115 |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
452
diff
changeset
|
116 static gboolean |
439
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
117 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
|
118 { |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
119 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
|
120 { |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
121 TitleInput *tuple; |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
122 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
|
123 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
|
124 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
|
125 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
126 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
|
127 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
|
128 { |
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
|
129 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
|
130 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
|
131 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
|
132 } |
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
|
133 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
|
134 { |
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
|
135 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
|
136 } |
439
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 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
|
139 } |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
140 |
796
f3ce11fad729
[svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents:
795
diff
changeset
|
141 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
|
142 return FALSE; |
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 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
146 static void |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
147 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
|
148 { |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
149 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
|
150 { |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
151 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
|
152 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
|
153 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
|
154 } |
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 |
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 static void |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
159 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
|
160 { |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
161 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
|
162 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
|
163 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
|
164 return; |
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 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
167 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
168 static void |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
169 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
|
170 { |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
171 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
|
172 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
|
173 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
174 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
|
175 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
|
176 return; |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
177 } |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
178 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
179 |
795
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_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
|
182 { |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
183 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
|
184 ( 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
|
185 { |
796
f3ce11fad729
[svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents:
795
diff
changeset
|
186 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
|
187 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
|
188 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
|
189 } |
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 |
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 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
|
194 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
|
195 { |
796
f3ce11fad729
[svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents:
795
diff
changeset
|
196 /* 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 ( 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
|
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 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
|
205 { |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
206 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
|
207 ( !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
|
208 { |
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 ( ( 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
|
210 ( 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
|
211 { |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
212 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
|
213 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
|
214 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
|
215 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
|
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 } |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
218 else |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
219 { |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
220 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
|
221 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
|
222 /* 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
|
223 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
|
224 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
|
225 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
|
226 } |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
227 } |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
228 else |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
229 { |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
230 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
|
231 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
|
232 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
|
233 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
|
234 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
|
235 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
|
236 } |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
237 } |
796
f3ce11fad729
[svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents:
795
diff
changeset
|
238 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
|
239 { |
f3ce11fad729
[svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents:
795
diff
changeset
|
240 g_free(prevs->title); |
f3ce11fad729
[svn] statusicon: improvements in title changes detection while the popup is being displayed
giacomo
parents:
795
diff
changeset
|
241 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
|
242 } |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
243 } |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
244 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
245 |
439
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
246 static gboolean |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
247 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
|
248 { |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
249 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
|
250 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
|
251 return FALSE; |
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 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
|
254 { |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
255 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
|
256 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
|
257 return FALSE; |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
258 } |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
259 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
260 switch (event->type) |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
261 { |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
262 case GDK_EXPOSE: |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
263 /* do nothing */ |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
264 break; |
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_ENTER_NOTIFY: |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
267 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
|
268 break; |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
269 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
270 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
|
271 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
|
272 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
|
273 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
|
274 break; |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
275 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
276 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
|
277 break; /* ignore */ |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
278 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
279 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
|
280 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
|
281 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
|
282 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
|
283 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
|
284 case GDK_SCROLL: |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
285 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
|
286 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
|
287 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
|
288 break; |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
289 |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
290 default: |
84029a5250c1
[svn] - status icon plugin: made a tooltip popup that displays metadata of the current song
giacomo
parents:
433
diff
changeset
|
291 break; |
433
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 return FALSE; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
295 } |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
296 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
297 |
440
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
298 static void |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
299 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
|
300 { |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
301 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
|
302 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
|
303 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
|
304 |
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
|
305 /* 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
|
306 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
|
307 { |
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
|
308 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
|
309 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
|
310 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
|
311 } |
456
2e0b55117302
[svn] - status icon plugin: better logic for KWin workaround
giacomo
parents:
455
diff
changeset
|
312 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
|
313 size = 22; |
440
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 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
|
316 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
|
317 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
|
318 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
|
319 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
|
320 |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
321 return; |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
322 } |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
323 |
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 static void |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
326 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
|
327 { |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
328 GtkOrientation orientation; |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
329 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
|
330 gint size = 0; |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
331 |
886
f2fde7b4dccd
[svn] - statusicon: use function/define names that do not collide with gtk >= 2.10 internals (paranoia)
giacomo
parents:
855
diff
changeset
|
332 orientation = _aud_gtk_tray_icon_get_orientation( AUD_GTK_TRAY_ICON(si_applet) ); |
440
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
333 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
|
334 size = allocation->height; |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
335 else |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
336 size = allocation->width; |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
337 |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
338 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
|
339 { |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
340 prev_size = size; |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
341 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
|
342 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
|
343 } |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
344 |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
345 return; |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
346 } |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
347 |
84fdf898438b
[svn] - status icon plugin: try to auto-detect the correct size for the status icon
giacomo
parents:
439
diff
changeset
|
348 |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
349 static void |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
350 si_ui_statusicon_smallmenu_show ( gint x, gint y, guint button, guint32 time , gpointer evbox ) |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
351 { |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
352 GtkWidget *si_smenu = g_object_get_data( G_OBJECT(evbox) , "smenu" ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
353 gtk_menu_popup( GTK_MENU(si_smenu) , NULL , NULL , NULL , NULL , button , time ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
354 } |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
355 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
356 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
357 static GtkWidget * |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
358 si_ui_statusicon_smallmenu_create ( void ) |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
359 { |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
360 GtkWidget *si_smenu = gtk_menu_new(); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
361 GtkWidget *si_smenu_prev_item, *si_smenu_play_item, *si_smenu_pause_item; |
855
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
362 GtkWidget *si_smenu_stop_item, *si_smenu_next_item, *si_smenu_sep_item, *si_smenu_eject_item; |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
363 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
364 si_smenu_prev_item = gtk_image_menu_item_new_from_stock( |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
365 GTK_STOCK_MEDIA_PREVIOUS , NULL ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
366 g_signal_connect_swapped( si_smenu_prev_item , "activate" , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
367 G_CALLBACK(si_audacious_playback_ctrl) , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
368 GINT_TO_POINTER(SI_AUDACIOUS_PLAYBACK_CTRL_PREV) ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
369 gtk_menu_shell_append( GTK_MENU_SHELL(si_smenu) , si_smenu_prev_item ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
370 gtk_widget_show(si_smenu_prev_item); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
371 si_smenu_play_item = gtk_image_menu_item_new_from_stock( |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
372 GTK_STOCK_MEDIA_PLAY , NULL ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
373 g_signal_connect_swapped( si_smenu_play_item , "activate" , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
374 G_CALLBACK(si_audacious_playback_ctrl) , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
375 GINT_TO_POINTER(SI_AUDACIOUS_PLAYBACK_CTRL_PLAY) ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
376 gtk_menu_shell_append( GTK_MENU_SHELL(si_smenu) , si_smenu_play_item ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
377 gtk_widget_show(si_smenu_play_item); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
378 si_smenu_pause_item = gtk_image_menu_item_new_from_stock( |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
379 GTK_STOCK_MEDIA_PAUSE , NULL ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
380 g_signal_connect_swapped( si_smenu_pause_item , "activate" , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
381 G_CALLBACK(si_audacious_playback_ctrl) , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
382 GINT_TO_POINTER(SI_AUDACIOUS_PLAYBACK_CTRL_PAUSE) ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
383 gtk_menu_shell_append( GTK_MENU_SHELL(si_smenu) , si_smenu_pause_item ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
384 gtk_widget_show(si_smenu_pause_item); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
385 si_smenu_stop_item = gtk_image_menu_item_new_from_stock( |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
386 GTK_STOCK_MEDIA_STOP , NULL ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
387 g_signal_connect_swapped( si_smenu_stop_item , "activate" , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
388 G_CALLBACK(si_audacious_playback_ctrl) , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
389 GINT_TO_POINTER(SI_AUDACIOUS_PLAYBACK_CTRL_STOP) ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
390 gtk_menu_shell_append( GTK_MENU_SHELL(si_smenu) , si_smenu_stop_item ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
391 gtk_widget_show(si_smenu_stop_item); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
392 si_smenu_next_item = gtk_image_menu_item_new_from_stock( |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
393 GTK_STOCK_MEDIA_NEXT , NULL ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
394 g_signal_connect_swapped( si_smenu_next_item , "activate" , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
395 G_CALLBACK(si_audacious_playback_ctrl) , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
396 GINT_TO_POINTER(SI_AUDACIOUS_PLAYBACK_CTRL_NEXT) ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
397 gtk_menu_shell_append( GTK_MENU_SHELL(si_smenu) , si_smenu_next_item ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
398 gtk_widget_show(si_smenu_next_item); |
855
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
399 si_smenu_sep_item = gtk_separator_menu_item_new(); |
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
400 gtk_menu_shell_append( GTK_MENU_SHELL(si_smenu) , si_smenu_sep_item ); |
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
401 gtk_widget_show(si_smenu_sep_item); |
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
402 si_smenu_eject_item = gtk_image_menu_item_new_from_stock( |
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
403 GTK_STOCK_OPEN , NULL ); |
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
404 g_signal_connect_swapped( si_smenu_eject_item , "activate" , |
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
405 G_CALLBACK(si_audacious_playback_ctrl) , |
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
406 GINT_TO_POINTER(SI_AUDACIOUS_PLAYBACK_CTRL_EJECT) ); |
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
407 gtk_menu_shell_append( GTK_MENU_SHELL(si_smenu) , si_smenu_eject_item ); |
fbf1f593b0c6
[svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents:
854
diff
changeset
|
408 gtk_widget_show(si_smenu_eject_item); |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
409 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
410 return si_smenu; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
411 } |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
412 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
413 |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
414 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
|
415 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
|
416 { |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
417 static GtkWidget *si_evbox = NULL; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
418 static GtkWidget *si_smenu = NULL; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
419 static si_hook_tchange_prevs_t *si_hook_tchange_prevs = NULL; |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
420 |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
421 if (( enable == TRUE ) && ( si_evbox == NULL )) |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
422 { |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
423 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
|
424 GtkWidget *si_popup; |
886
f2fde7b4dccd
[svn] - statusicon: use function/define names that do not collide with gtk >= 2.10 internals (paranoia)
giacomo
parents:
855
diff
changeset
|
425 AudGtkTrayIcon *si_applet; |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
426 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
|
427 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
|
428 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
429 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
|
430 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
|
431 { |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
432 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
|
433 return; |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
434 } |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
435 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
436 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
|
437 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
|
438 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
439 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
|
440 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
|
441 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
442 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
|
443 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
|
444 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
445 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
|
446 |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
447 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
|
448 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
|
449 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
450 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
|
451 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
|
452 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
453 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
|
454 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
|
455 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
|
456 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
|
457 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
|
458 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
|
459 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
460 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
|
461 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
|
462 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
463 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
|
464 |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
465 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
|
466 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
|
467 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
|
468 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
|
469 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
|
470 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
|
471 |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
472 /* small menu that can be used in place of the audacious standard one */ |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
473 si_smenu = si_ui_statusicon_smallmenu_create(); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
474 g_object_set_data( G_OBJECT(si_evbox) , "smenu" , si_smenu ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
475 |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
476 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
|
477 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
|
478 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
|
479 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
|
480 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
|
481 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
|
482 |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
483 return; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
484 } |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
485 else |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
486 { |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
487 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
|
488 { |
886
f2fde7b4dccd
[svn] - statusicon: use function/define names that do not collide with gtk >= 2.10 internals (paranoia)
giacomo
parents:
855
diff
changeset
|
489 AudGtkTrayIcon *si_applet = g_object_get_data( G_OBJECT(si_evbox) , "applet" ); |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
490 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
|
491 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
|
492 gtk_widget_destroy( GTK_WIDGET(si_applet) ); |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
493 gtk_widget_destroy( GTK_WIDGET(si_smenu) ); |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
494 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
|
495 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
|
496 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
|
497 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
|
498 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
|
499 si_hook_tchange_prevs = NULL; |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
500 si_smenu = NULL; |
795
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
501 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
|
502 } |
ca6dca840074
[svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents:
542
diff
changeset
|
503 return; |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
504 } |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
505 } |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
506 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
507 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
508 void |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
509 si_ui_about_show ( void ) |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
510 { |
454 | 511 static GtkWidget *about_dlg = NULL; |
512 gchar *about_title; | |
513 gchar *about_text; | |
514 | |
515 if ( about_dlg != NULL ) | |
516 { | |
517 gtk_window_present( GTK_WINDOW(about_dlg) ); | |
518 return; | |
519 } | |
520 | |
521 about_title = g_strdup( _("About Status Icon Plugin") ); | |
522 about_text = g_strjoin( "" , "Status Icon Plugin " , SI_VERSION_PLUGIN , | |
523 _("\nwritten by Giacomo Lozito < james@develia.org >\n\n" | |
524 "This plugin provides a status icon, placed in\n" | |
525 "the system tray area of the window manager.\n") , NULL ); | |
526 | |
527 about_dlg = xmms_show_message( about_title , about_text , _("Ok") , FALSE , NULL , NULL ); | |
528 g_signal_connect( G_OBJECT(about_dlg) , "destroy" , | |
529 G_CALLBACK(gtk_widget_destroyed), &about_dlg ); | |
530 g_free( about_text ); | |
531 g_free( about_title ); | |
532 | |
533 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
|
534 return; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
535 } |
854
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
536 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
537 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
538 void |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
539 si_ui_prefs_cb_commit ( gpointer prefs_win ) |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
540 { |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
541 GSList *rcm_grp = g_object_get_data( G_OBJECT(prefs_win) , "rcm_grp" ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
542 while ( rcm_grp != NULL ) |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
543 { |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
544 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(rcm_grp->data) ) == TRUE ) |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
545 { |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
546 si_cfg.rclick_menu = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(rcm_grp->data),"val")); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
547 break; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
548 } |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
549 rcm_grp = g_slist_next(rcm_grp); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
550 } |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
551 si_cfg_save(); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
552 gtk_widget_destroy( GTK_WIDGET(prefs_win) ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
553 } |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
554 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
555 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
556 void |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
557 si_ui_prefs_show ( void ) |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
558 { |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
559 static GtkWidget *prefs_win = NULL; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
560 GtkWidget *prefs_vbox; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
561 GtkWidget *prefs_rclick_frame, *prefs_rclick_vbox; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
562 GtkWidget *prefs_rclick_audmenu_rbt, *prefs_rclick_smallmenu_rbt; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
563 GtkWidget *prefs_bbar_bbox; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
564 GtkWidget *prefs_bbar_bt_ok, *prefs_bbar_bt_cancel; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
565 GdkGeometry prefs_win_hints; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
566 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
567 if ( prefs_win != NULL ) |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
568 { |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
569 gtk_window_present( GTK_WINDOW(prefs_win) ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
570 return; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
571 } |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
572 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
573 prefs_win = gtk_window_new( GTK_WINDOW_TOPLEVEL ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
574 gtk_window_set_type_hint( GTK_WINDOW(prefs_win), GDK_WINDOW_TYPE_HINT_DIALOG ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
575 gtk_window_set_position( GTK_WINDOW(prefs_win), GTK_WIN_POS_CENTER ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
576 gtk_window_set_title( GTK_WINDOW(prefs_win), _("Audacious OSD - Preferences") ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
577 gtk_container_set_border_width( GTK_CONTAINER(prefs_win) , 10 ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
578 prefs_win_hints.min_width = 320; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
579 prefs_win_hints.min_height = -1; |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
580 gtk_window_set_geometry_hints( GTK_WINDOW(prefs_win) , GTK_WIDGET(prefs_win) , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
581 &prefs_win_hints , GDK_HINT_MIN_SIZE ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
582 g_signal_connect( G_OBJECT(prefs_win) , "destroy" , G_CALLBACK(gtk_widget_destroyed) , &prefs_win ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
583 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
584 prefs_vbox = gtk_vbox_new( FALSE , 0 ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
585 gtk_container_add( GTK_CONTAINER(prefs_win) , prefs_vbox ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
586 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
587 prefs_rclick_frame = gtk_frame_new( _("Right-Click Menu") ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
588 prefs_rclick_vbox = gtk_vbox_new( TRUE , 0 ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
589 gtk_container_set_border_width( GTK_CONTAINER(prefs_rclick_vbox) , 6 ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
590 gtk_container_add( GTK_CONTAINER(prefs_rclick_frame) , prefs_rclick_vbox ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
591 prefs_rclick_audmenu_rbt = gtk_radio_button_new_with_label( NULL , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
592 _("Audacious standard menu") ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
593 g_object_set_data( G_OBJECT(prefs_rclick_audmenu_rbt) , "val" , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
594 GINT_TO_POINTER(SI_CFG_RCLICK_MENU_AUD) ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
595 prefs_rclick_smallmenu_rbt = gtk_radio_button_new_with_label_from_widget( |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
596 GTK_RADIO_BUTTON(prefs_rclick_audmenu_rbt) , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
597 _("Small playback menu") ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
598 g_object_set_data( G_OBJECT(prefs_rclick_smallmenu_rbt) , "val" , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
599 GINT_TO_POINTER(SI_CFG_RCLICK_MENU_SMALL) ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
600 g_object_set_data( G_OBJECT(prefs_win) , "rcm_grp" , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
601 gtk_radio_button_get_group(GTK_RADIO_BUTTON(prefs_rclick_smallmenu_rbt)) ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
602 if ( si_cfg.rclick_menu == SI_CFG_RCLICK_MENU_AUD ) |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
603 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(prefs_rclick_audmenu_rbt) , TRUE ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
604 else |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
605 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(prefs_rclick_smallmenu_rbt) , TRUE ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
606 gtk_box_pack_start( GTK_BOX(prefs_rclick_vbox) , prefs_rclick_audmenu_rbt , TRUE , TRUE , 0 ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
607 gtk_box_pack_start( GTK_BOX(prefs_rclick_vbox) , prefs_rclick_smallmenu_rbt , TRUE , TRUE , 0 ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
608 gtk_box_pack_start( GTK_BOX(prefs_vbox) , prefs_rclick_frame , TRUE , TRUE , 0 ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
609 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
610 /* horizontal separator and buttons */ |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
611 gtk_box_pack_start( GTK_BOX(prefs_vbox) , gtk_hseparator_new() , FALSE , FALSE , 4 ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
612 prefs_bbar_bbox = gtk_hbutton_box_new(); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
613 gtk_button_box_set_layout( GTK_BUTTON_BOX(prefs_bbar_bbox) , GTK_BUTTONBOX_END ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
614 prefs_bbar_bt_cancel = gtk_button_new_from_stock( GTK_STOCK_CANCEL ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
615 g_signal_connect_swapped( G_OBJECT(prefs_bbar_bt_cancel) , "clicked" , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
616 G_CALLBACK(gtk_widget_destroy) , prefs_win ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
617 gtk_container_add( GTK_CONTAINER(prefs_bbar_bbox) , prefs_bbar_bt_cancel ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
618 prefs_bbar_bt_ok = gtk_button_new_from_stock( GTK_STOCK_OK ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
619 gtk_container_add( GTK_CONTAINER(prefs_bbar_bbox) , prefs_bbar_bt_ok ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
620 g_signal_connect_swapped( G_OBJECT(prefs_bbar_bt_ok) , "clicked" , |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
621 G_CALLBACK(si_ui_prefs_cb_commit) , prefs_win ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
622 gtk_box_pack_start( GTK_BOX(prefs_vbox) , prefs_bbar_bbox , FALSE , FALSE , 0 ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
623 |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
624 gtk_widget_show_all( prefs_win ); |
aac49941ee8f
[svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents:
796
diff
changeset
|
625 } |