| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#include <stdlib.h> |
| 24 |
|
| 25 |
#include "systray-config.h" |
| 26 |
#include "systray-interface.h" |
| 27 |
#include "systray-notifications.h" |
| 28 |
#include "systray-struct.h" |
| 29 |
#include "systray-init.h" |
| 30 |
|
| 31 |
|
| 32 |
CD_APPLET_DEFINE_BEGIN ("systray", |
| 33 |
2, 2, 0, |
| 34 |
CAIRO_DOCK_CATEGORY_APPLET_DESKTOP, |
| 35 |
N_("Add a systray to your dock.\n" |
| 36 |
"Left-click to show/hide the systray in a dialog (you can bind a keyboard shortcut for it.)\n" |
| 37 |
"But the best way to use it is to detach it from the dock, and place it somewhere, above other windows."), |
| 38 |
"Ctaf (Cedric Gestes)") |
| 39 |
CD_APPLET_DEFINE_COMMON_APPLET_INTERFACE |
| 40 |
CD_APPLET_SET_UNRESIZABLE_DESKLET |
| 41 |
CD_APPLET_REDEFINE_TITLE (N_("Notification Area Old")) |
| 42 |
CD_APPLET_DEFINE_END |
| 43 |
|
| 44 |
|
| 45 |
CD_APPLET_INIT_BEGIN |
| 46 |
|
| 47 |
CD_APPLET_REGISTER_FOR_CLICK_EVENT; |
| 48 |
CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT; |
| 49 |
|
| 50 |
|
| 51 |
cd_systray_check_running (); |
| 52 |
|
| 53 |
cd_systray_build_systray (); |
| 54 |
|
| 55 |
if (myDesklet) |
| 56 |
{ |
| 57 |
CD_APPLET_SET_STATIC_DESKLET; |
| 58 |
} |
| 59 |
else |
| 60 |
{ |
| 61 |
CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE; |
| 62 |
} |
| 63 |
|
| 64 |
myData.cKeyBinding = CD_APPLET_BIND_KEY (myConfig.shortcut, |
| 65 |
D_("Show/hide the systray"), |
| 66 |
"Configuration", "shortkey", |
| 67 |
(CDBindkeyHandler) systray_on_keybinding_pull); |
| 68 |
CD_APPLET_INIT_END |
| 69 |
|
| 70 |
|
| 71 |
CD_APPLET_STOP_BEGIN |
| 72 |
|
| 73 |
CD_APPLET_UNREGISTER_FOR_CLICK_EVENT; |
| 74 |
CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT; |
| 75 |
|
| 76 |
|
| 77 |
gldi_object_unref (GLDI_OBJECT(myData.cKeyBinding)); |
| 78 |
|
| 79 |
CD_APPLET_STOP_END |
| 80 |
|
| 81 |
|
| 82 |
CD_APPLET_RELOAD_BEGIN |
| 83 |
|
| 84 |
if (CD_APPLET_MY_CONFIG_CHANGED) |
| 85 |
{ |
| 86 |
if (! myData.tray) |
| 87 |
{ |
| 88 |
cd_systray_build_systray (); |
| 89 |
} |
| 90 |
else |
| 91 |
{ |
| 92 |
|
| 93 |
cd_systray_set_orientation (myConfig.iIconPacking == 0 ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); |
| 94 |
|
| 95 |
|
| 96 |
if (CD_APPLET_MY_CONTAINER_TYPE_CHANGED) |
| 97 |
{ |
| 98 |
if (myDesklet != NULL) |
| 99 |
{ |
| 100 |
gldi_dialog_steal_interactive_widget (myData.dialog); |
| 101 |
gldi_object_unref (GLDI_OBJECT(myData.dialog)); |
| 102 |
myData.dialog = NULL; |
| 103 |
gldi_desklet_add_interactive_widget (myDesklet, GTK_WIDGET (myData.tray)); |
| 104 |
CD_APPLET_SET_DESKLET_RENDERER (NULL); |
| 105 |
CD_APPLET_SET_STATIC_DESKLET; |
| 106 |
} |
| 107 |
else |
| 108 |
{ |
| 109 |
CairoDesklet *pDesklet = CAIRO_DESKLET (CD_APPLET_MY_OLD_CONTAINER); |
| 110 |
gldi_desklet_steal_interactive_widget (pDesklet); |
| 111 |
cd_systray_build_dialog (); |
| 112 |
} |
| 113 |
g_object_unref (G_OBJECT (myData.tray)); |
| 114 |
} |
| 115 |
|
| 116 |
if (myDock) |
| 117 |
CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE; |
| 118 |
} |
| 119 |
|
| 120 |
gldi_shortkey_rebind (myData.cKeyBinding, myConfig.shortcut, NULL); |
| 121 |
} |
| 122 |
|
| 123 |
if (myDesklet) |
| 124 |
{ |
| 125 |
GdkGravity iGravity; |
| 126 |
if (myContainer->iWindowPositionX < g_desktopGeometry.Xscreen.width/2) |
| 127 |
iGravity = GDK_GRAVITY_NORTH_WEST; |
| 128 |
else |
| 129 |
iGravity = GDK_GRAVITY_NORTH_EAST; |
| 130 |
gtk_window_set_gravity (GTK_WINDOW (myContainer->pWidget), iGravity); |
| 131 |
} |
| 132 |
|
| 133 |
CD_APPLET_RELOAD_END |