Tray icon subsystem.
More...
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <glib.h>
#include <gtk/gtk.h>
#include "audio.h"
#include "prefs.h"
#include "support-intl.h"
#include "support-log.h"
#include "support-ui.h"
#include "ui-tray-icon.h"
#include "main.h"
Go to the source code of this file.
|
static GdkPixbuf * | pixbuf_new_from_file (const gchar *filename) |
|
static GdkPixbuf * | pixbuf_new_from_stock (const gchar *icon_name, gint size) |
|
static void | pixbuf_array_free (GdkPixbuf **pixbufs) |
|
static GdkPixbuf ** | pixbuf_array_new (int size) |
|
static void | vol_meter_free (VolMeter *vol_meter) |
|
static VolMeter * | vol_meter_new (void) |
|
static GdkPixbuf * | vol_meter_draw (VolMeter *vol_meter, GdkPixbuf *pixbuf, int volume) |
|
static void | update_status_icon_pixbuf (GtkStatusIcon *status_icon, GdkPixbuf **pixbufs, VolMeter *vol_meter, gdouble volume, gboolean muted) |
|
static void | update_status_icon_tooltip (GtkStatusIcon *status_icon, const gchar *card, const gchar *channel, gdouble volume, gboolean has_mute, gboolean muted) |
|
static void | on_activate (G_GNUC_UNUSED GtkStatusIcon *status_icon, G_GNUC_UNUSED TrayIcon *icon) |
|
static void | on_popup_menu (GtkStatusIcon *status_icon, guint button, guint activate_time, G_GNUC_UNUSED TrayIcon *icon) |
|
static gboolean | on_button_release_event (G_GNUC_UNUSED GtkStatusIcon *status_icon, GdkEventButton *event, G_GNUC_UNUSED TrayIcon *icon) |
|
static gboolean | on_scroll_event (G_GNUC_UNUSED GtkStatusIcon *status_icon, GdkEventScroll *event, TrayIcon *icon) |
|
static gboolean | on_size_changed (G_GNUC_UNUSED GtkStatusIcon *status_icon, gint size, TrayIcon *icon) |
|
static void | on_audio_changed (G_GNUC_UNUSED Audio *audio, AudioEvent *event, gpointer data) |
|
void | tray_icon_reload (TrayIcon *icon) |
|
void | tray_icon_destroy (TrayIcon *icon) |
|
TrayIcon * | tray_icon_create (Audio *audio) |
|
Tray icon subsystem.
This file holds the ui-related code for the system tray icon.
Definition in file ui-tray-icon.c.
◆ ICON_MIN_SIZE
◆ VolMeter
◆ anonymous enum
Enumerator |
---|
VOLUME_MUTED | |
VOLUME_OFF | |
VOLUME_LOW | |
VOLUME_MEDIUM | |
VOLUME_HIGH | |
N_VOLUME_PIXBUFS | |
Definition at line 38 of file ui-tray-icon.c.
◆ on_activate()
static void on_activate |
( |
G_GNUC_UNUSED GtkStatusIcon * |
status_icon, |
|
|
G_GNUC_UNUSED TrayIcon * |
icon |
|
) |
| |
|
static |
Handles the 'activate' signal on the GtkStatusIcon, bringing up or hiding the volume popup window. Usually triggered by left-click.
- Parameters
-
status_icon | the object which received the signal. |
icon | TrayIcon instance set when the signal handler was connected. |
Definition at line 391 of file ui-tray-icon.c.
◆ on_audio_changed()
static void on_audio_changed |
( |
G_GNUC_UNUSED Audio * |
audio, |
|
|
AudioEvent * |
event, |
|
|
gpointer |
data |
|
) |
| |
|
static |
Handle signals from the audio subsystem.
- Parameters
-
audio | the Audio instance that emitted the signal. |
event | the AudioEvent containing useful information. |
data | user supplied data. |
Definition at line 519 of file ui-tray-icon.c.
◆ on_button_release_event()
static gboolean on_button_release_event |
( |
G_GNUC_UNUSED GtkStatusIcon * |
status_icon, |
|
|
GdkEventButton * |
event, |
|
|
G_GNUC_UNUSED TrayIcon * |
icon |
|
) |
| |
|
static |
Handles 'button-release-event' signal on the GtkStatusIcon. Only used for middle-click, which runs the middle click action.
- Parameters
-
status_icon | the object which received the signal. |
event | the GdkEventButton which triggered this signal. |
icon | TrayIcon instance set when the signal handler was connected. |
- Returns
- TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
Definition at line 426 of file ui-tray-icon.c.
◆ on_popup_menu()
static void on_popup_menu |
( |
GtkStatusIcon * |
status_icon, |
|
|
guint |
button, |
|
|
guint |
activate_time, |
|
|
G_GNUC_UNUSED TrayIcon * |
icon |
|
) |
| |
|
static |
Handles the 'popup-menu' signal on the GtkStatusIcon, bringing up the context popup menu. Usually triggered by right-click.
- Parameters
-
status_icon | the object which received the signal. |
button | the button that was pressed, or 0 if the signal is not emitted in response to a button press event. |
activate_time | the timestamp of the event that triggered the signal emission. |
icon | TrayIcon instance set when the signal handler was connected. |
Definition at line 409 of file ui-tray-icon.c.
◆ on_scroll_event()
static gboolean on_scroll_event |
( |
G_GNUC_UNUSED GtkStatusIcon * |
status_icon, |
|
|
GdkEventScroll * |
event, |
|
|
TrayIcon * |
icon |
|
) |
| |
|
static |
Handles 'scroll-event' signal on the GtkStatusIcon, changing the volume accordingly.
- Parameters
-
status_icon | the object which received the signal. |
event | the GdkEventScroll which triggered this signal. |
icon | TrayIcon instance set when the signal handler was connected. |
- Returns
- TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further
Definition at line 467 of file ui-tray-icon.c.
◆ on_size_changed()
static gboolean on_size_changed |
( |
G_GNUC_UNUSED GtkStatusIcon * |
status_icon, |
|
|
gint |
size, |
|
|
TrayIcon * |
icon |
|
) |
| |
|
static |
Handles the 'size-changed' signal on the GtkStatusIcon. Happens when the panel holding the tray icon is resized. Also happens at startup during the tray icon creation.
- Parameters
-
status_icon | the object which received the signal. |
size | the new size. |
icon | TrayIcon instance set when the signal handler was connected. |
- Returns
- FALSE, so that Gtk+ scales the icon as necessary.
Definition at line 489 of file ui-tray-icon.c.
◆ pixbuf_array_free()
static void pixbuf_array_free |
( |
GdkPixbuf ** |
pixbufs | ) |
|
|
static |
◆ pixbuf_array_new()
static GdkPixbuf** pixbuf_array_new |
( |
int |
size | ) |
|
|
static |
◆ pixbuf_new_from_file()
static GdkPixbuf* pixbuf_new_from_file |
( |
const gchar * |
filename | ) |
|
|
static |
This is an internally used function to create GdkPixbufs.
- Parameters
-
filename | filename to create the GtkPixbuf from |
- Returns
- the new GdkPixbuf, NULL on failure
Definition at line 58 of file ui-tray-icon.c.
◆ pixbuf_new_from_stock()
static GdkPixbuf* pixbuf_new_from_stock |
( |
const gchar * |
icon_name, |
|
|
gint |
size |
|
) |
| |
|
static |
Looks up icons based on the currently selected theme.
- Parameters
-
icon_name | icon name to look up |
size | size of the icon |
- Returns
- the corresponding theme icon, NULL on failure, use g_object_unref() to release the reference to the icon
Definition at line 96 of file ui-tray-icon.c.
◆ tray_icon_create()
Creates the tray icon and connects all the signals.
- Returns
- the newly created TrayIcon instance.
Definition at line 582 of file ui-tray-icon.c.
◆ tray_icon_destroy()
void tray_icon_destroy |
( |
TrayIcon * |
icon | ) |
|
Destroys the tray icon, freeing any resources.
- Parameters
-
Definition at line 565 of file ui-tray-icon.c.
◆ tray_icon_reload()
void tray_icon_reload |
( |
TrayIcon * |
icon | ) |
|
Update the tray icon according to the current preferences and the current audio status. Both can't be separated. This has to be called each time the preferences are modified.
- Parameters
-
Definition at line 536 of file ui-tray-icon.c.
◆ update_status_icon_pixbuf()
static void update_status_icon_pixbuf |
( |
GtkStatusIcon * |
status_icon, |
|
|
GdkPixbuf ** |
pixbufs, |
|
|
VolMeter * |
vol_meter, |
|
|
gdouble |
volume, |
|
|
gboolean |
muted |
|
) |
| |
|
static |
◆ update_status_icon_tooltip()
static void update_status_icon_tooltip |
( |
GtkStatusIcon * |
status_icon, |
|
|
const gchar * |
card, |
|
|
const gchar * |
channel, |
|
|
gdouble |
volume, |
|
|
gboolean |
has_mute, |
|
|
gboolean |
muted |
|
) |
| |
|
static |
◆ vol_meter_draw()
static GdkPixbuf* vol_meter_draw |
( |
VolMeter * |
vol_meter, |
|
|
GdkPixbuf * |
pixbuf, |
|
|
int |
volume |
|
) |
| |
|
static |
◆ vol_meter_free()
static void vol_meter_free |
( |
VolMeter * |
vol_meter | ) |
|
|
static |
◆ vol_meter_new()