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/>.
23
#include "applet-struct.h"
24
#include "applet-cpusage.h"
25
#include "applet-rame.h"
26
#include "applet-nvidia.h"
27
#include "applet-top.h"
28
#include "applet-sensors.h"
29
#include "applet-notifications.h"
32
CD_APPLET_ON_CLICK_BEGIN
33
if (myData.bAcquisitionOK)
35
cd_sysmonitor_start_top_dialog (myApplet);
39
gldi_dialogs_remove_on_icon (myIcon);
40
gldi_dialog_show_temporary_with_icon (D_("The acquisition of one or more data has failed.\nYou should remove the data that couldn't be fetched."), myIcon, myContainer, 6e3, MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
42
CD_APPLET_ON_CLICK_END
45
static void _pop_up_dialog_info (GldiModuleInstance *myApplet)
47
if (myData.pTopDialog != NULL) // we shouldn't get the click event anyway
49
gldi_dialogs_remove_on_icon (myIcon);
51
GString *pInfo = g_string_new ("");
54
cd_sysmonitor_get_cpu_info (myApplet, pInfo);
57
cd_sysmonitor_get_uptime_info (pInfo);
60
cd_sysmonitor_get_ram_info (myApplet, pInfo);
63
cd_sysmonitor_get_nivdia_info (myApplet, pInfo);
66
cd_sysmonitor_get_sensors_info (myApplet, pInfo);
68
// On affiche tout ca.
69
gldi_dialog_show_temporary_with_icon (pInfo->str,
72
MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
74
g_string_free (pInfo, TRUE);
77
CD_APPLET_ON_MIDDLE_CLICK_BEGIN
78
if (myData.bInitialized && myData.bAcquisitionOK)
80
_pop_up_dialog_info (myApplet);
84
gldi_dialog_show_temporary_with_icon (D_("The acquisition of one or more data has failed.\nYou should remove the data that couldn't be fetched."), myIcon, myContainer, 5e3, MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
86
CD_APPLET_ON_MIDDLE_CLICK_END
89
static void _open_system_monitor (GtkMenuItem *menu_item, GldiModuleInstance *myApplet)
91
if (myConfig.cSystemMonitorCommand != NULL)
93
cairo_dock_launch_command (myConfig.cSystemMonitorCommand);
97
cairo_dock_fm_show_system_monitor ();
100
static void _show_info (GtkMenuItem *menu_item, GldiModuleInstance *myApplet)
102
_pop_up_dialog_info (myApplet);
104
CD_APPLET_ON_BUILD_MENU_BEGIN
105
CD_APPLET_ADD_IN_MENU_WITH_STOCK (D_("Open the System-Monitor"), GLDI_ICON_NAME_EXECUTE, _open_system_monitor, CD_APPLET_MY_MENU);
107
gchar *cLabel = g_strdup_printf ("%s (%s)", D_("Show info"), D_("middle-click"));
108
CD_APPLET_ADD_IN_MENU_WITH_STOCK (cLabel, GLDI_ICON_NAME_DIALOG_INFO, _show_info, CD_APPLET_MY_MENU);
110
CD_APPLET_ON_BUILD_MENU_END