2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
/******************************************************************************
22
This file is a part of the cairo-dock program,
23
released under the terms of the GNU General Public License.
25
Written by Fabrice Rey (for any bug report, please mail me to fabounet@users.berlios.de)
27
******************************************************************************/
31
#include <glib/gi18n.h>
33
#include "applet-struct.h"
34
#include "applet-mixer.h"
35
#include "applet-notifications.h"
38
CD_APPLET_ON_CLICK_BEGIN
39
mixer_show_hide_dialog ();
40
CD_APPLET_ON_CLICK_END
43
static void _mixer_show_advanced_mixer (GtkMenuItem *menu_item, gpointer data)
45
GError *erreur = NULL;
46
if (myConfig.cShowAdvancedMixerCommand != NULL)
48
g_spawn_command_line_async (myConfig.cShowAdvancedMixerCommand, &erreur);
52
g_spawn_command_line_async ("gnome-volume-control", &erreur);
57
cd_warning ("Attention : when trying to execute '%s' : %s", myConfig.cShowAdvancedMixerCommand, erreur->message);
58
g_error_free (erreur);
61
CD_APPLET_ON_BUILD_MENU_BEGIN
62
GtkWidget *pSubMenu = CD_APPLET_CREATE_MY_SUB_MENU ();
63
CD_APPLET_ADD_IN_MENU(_("Adjsut channels"), _mixer_show_advanced_mixer, pSubMenu);
64
CD_APPLET_ADD_ABOUT_IN_MENU (pSubMenu);
65
CD_APPLET_ON_BUILD_MENU_END
68
CD_APPLET_ON_MIDDLE_CLICK_BEGIN
70
CD_APPLET_ON_MIDDLE_CLICK_END
73
CD_APPLET_ON_DOUBLE_CLICK_BEGIN
74
_mixer_show_advanced_mixer (NULL, NULL);
75
CD_APPLET_ON_DOUBLE_CLICK_END
78
void mixer_on_keybinding_pull (const char *keystring, gpointer user_data)
80
mixer_show_hide_dialog ();
83
CD_APPLET_ON_SCROLL_BEGIN
84
int iVolume = mixer_get_mean_volume (); // [0;100]
85
if (CD_APPLET_SCROLL_DOWN)
87
iVolume = MAX (iVolume - myConfig.iScrollVariation, 0);
89
else if (CD_APPLET_SCROLL_UP)
91
iVolume = MIN (iVolume + myConfig.iScrollVariation, 100);
94
return CAIRO_DOCK_LET_PASS_NOTIFICATION;
96
mixer_set_volume (iVolume);
97
CD_APPLET_ON_SCROLL_END