| 1 |
/** |
| 2 |
* This file is a part of the Cairo-Dock project |
| 3 |
* |
| 4 |
* Copyright : (C) see the 'copyright' file. |
| 5 |
* E-mail : see the 'copyright' file. |
| 6 |
* |
| 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. |
| 11 |
* |
| 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/>. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <stdlib.h> |
| 21 |
#include <string.h> |
| 22 |
#include <glib/gi18n.h> |
| 23 |
|
| 24 |
#include "applet-struct.h" |
| 25 |
#include "applet-notifications.h" |
| 26 |
#include "applet-disks.h" |
| 27 |
|
| 28 |
|
| 29 |
CD_APPLET_ON_CLICK_BEGIN |
| 30 |
gldi_dialogs_remove_on_icon (myIcon); |
| 31 |
//~ if (myData.bAcquisitionOK) |
| 32 |
//~ { |
| 33 |
//~ gldi_dialog_show_temporary_with_icon_printf ("%s :\n %s : %.2f%s\n %s : %.2f%s", |
| 34 |
//~ myIcon, myContainer, 6e3, |
| 35 |
//~ MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE, |
| 36 |
//~ D_("Total amount of data"), |
| 37 |
//~ D_("downloaded"), (double) myData.iReceivedBytes / (1024*1024), D_("MB"), |
| 38 |
//~ D_("uploaded"), (double) myData.iTransmittedBytes / (1024*1024), D_("MB")); |
| 39 |
//~ } |
| 40 |
//~ else |
| 41 |
//~ { |
| 42 |
//~ gchar *cQuestion = g_strdup_printf (D_("Interface '%s' doesn't seem to exist or is not readable.\n You may have to set up the interface you wish to monitor.\n Do you want to do it now?"), myConfig.cInterface); |
| 43 |
//~ gldi_dialog_show_with_question (cQuestion, myIcon, myContainer, MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE, (CairoDockActionOnAnswerFunc) cairo_dock_open_module_config_on_demand, myApplet, NULL); |
| 44 |
//~ g_free (cQuestion); |
| 45 |
//~ } |
| 46 |
CD_APPLET_ON_CLICK_END |
| 47 |
|
| 48 |
/* Not used |
| 49 |
static void _disks_recheck (GtkMenuItem *menu_item, GldiModuleInstance *myApplet) { |
| 50 |
gldi_task_stop (myData.pPeriodicTask); |
| 51 |
gldi_task_launch (myData.pPeriodicTask); |
| 52 |
} |
| 53 |
*/ |
| 54 |
static void _show_monitor_system (GtkMenuItem *menu_item, GldiModuleInstance *myApplet) |
| 55 |
{ |
| 56 |
if (myConfig.cSystemMonitorCommand != NULL) |
| 57 |
{ |
| 58 |
cairo_dock_launch_command (myConfig.cSystemMonitorCommand); |
| 59 |
} |
| 60 |
else if (g_iDesktopEnv == CAIRO_DOCK_KDE) |
| 61 |
{ |
| 62 |
int r = system ("kde-system-monitor &"); |
| 63 |
if (r < 0) |
| 64 |
cd_warning ("Not able to launch this command: kde-system-monitor &"); |
| 65 |
} |
| 66 |
else |
| 67 |
{ |
| 68 |
cairo_dock_fm_show_system_monitor (); |
| 69 |
} |
| 70 |
} |
| 71 |
CD_APPLET_ON_BUILD_MENU_BEGIN |
| 72 |
CD_APPLET_ADD_IN_MENU_WITH_STOCK (D_("System Monitor"), GLDI_ICON_NAME_MEDIA_PLAY, _show_monitor_system, CD_APPLET_MY_MENU); |
| 73 |
|
| 74 |
// Sub-Menu |
| 75 |
//~ if (! myData.bAcquisitionOK) { |
| 76 |
//~ CD_APPLET_ADD_IN_MENU (D_("Re-check interface"), _disks_recheck, pSubMenu); |
| 77 |
//~ CD_APPLET_ADD_SEPARATOR_IN_MENU (pSubMenu); |
| 78 |
//~ } |
| 79 |
CD_APPLET_ON_BUILD_MENU_END |
| 80 |
|
| 81 |
/* |
| 82 |
CD_APPLET_ON_MIDDLE_CLICK_BEGIN |
| 83 |
|
| 84 |
//~ if (myData.dbus_proxy_nm == NULL) |
| 85 |
//~ myData.dbus_proxy_nm = cairo_dock_create_new_system_proxy ( |
| 86 |
//~ "org.freedesktop.NetworkManager", |
| 87 |
//~ "/org/freedesktop/NetworkManager", |
| 88 |
//~ "org.freedesktop.NetworkManager"); |
| 89 |
//~ g_return_val_if_fail (myData.dbus_proxy_nm != NULL, GLDI_NOTIFICATION_LET_PASS); |
| 90 |
//~ |
| 91 |
//~ guint state = 0; |
| 92 |
//~ dbus_g_proxy_call (myData.dbus_proxy_nm, "state", NULL, |
| 93 |
//~ G_TYPE_INVALID, |
| 94 |
//~ G_TYPE_UINT, &state, |
| 95 |
//~ G_TYPE_INVALID); |
| 96 |
//~ cd_debug ("current network state : %d", state); |
| 97 |
//~ if (state == 3) // actif |
| 98 |
//~ { |
| 99 |
//~ dbus_g_proxy_call_no_reply (myData.dbus_proxy_nm, "sleep", |
| 100 |
//~ G_TYPE_INVALID, |
| 101 |
//~ G_TYPE_INVALID); |
| 102 |
//~ } |
| 103 |
//~ else if (state == 1) // inactif |
| 104 |
//~ { |
| 105 |
//~ dbus_g_proxy_call_no_reply (myData.dbus_proxy_nm, "wake", |
| 106 |
//~ G_TYPE_INVALID, |
| 107 |
//~ G_TYPE_INVALID); |
| 108 |
//~ } |
| 109 |
|
| 110 |
CD_APPLET_ON_MIDDLE_CLICK_END |
| 111 |
*/ |