| 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 |
#include <string.h> |
| 25 |
#include <signal.h> |
| 26 |
|
| 27 |
#include "systray-interface.h" |
| 28 |
#include "systray-init.h" |
| 29 |
#include "systray-struct.h" |
| 30 |
#include "na-tray.h" |
| 31 |
#include "na-tray-manager.h" |
| 32 |
|
| 33 |
|
| 34 |
void cd_systray_build_dialog (void) |
| 35 |
{ |
| 36 |
CairoDialogAttr attr; |
| 37 |
memset (&attr, 0, sizeof (CairoDialogAttr)); |
| 38 |
attr.pInteractiveWidget = GTK_WIDGET (myData.tray); |
| 39 |
attr.bHideOnClick = TRUE; |
| 40 |
attr.pIcon = myIcon; |
| 41 |
attr.pContainer = myContainer; |
| 42 |
myData.dialog = gldi_dialog_new (&attr); |
| 43 |
gtk_window_set_resizable (GTK_WINDOW(myData.dialog->container.pWidget), FALSE); |
| 44 |
gldi_dialog_hide (myData.dialog); |
| 45 |
} |
| 46 |
|
| 47 |
void cd_systray_build_systray (void) |
| 48 |
{ |
| 49 |
if (myData.tray != NULL) |
| 50 |
return; |
| 51 |
|
| 52 |
myData.tray = na_tray_new_for_screen (gtk_widget_get_screen (GTK_WIDGET (myContainer->pWidget)), |
| 53 |
myConfig.iIconPacking == 0 ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); |
| 54 |
na_tray_set_icon_size (myData.tray, 24); |
| 55 |
na_tray_set_padding (myData.tray, 3); |
| 56 |
|
| 57 |
if (myDock) |
| 58 |
{ |
| 59 |
cd_systray_build_dialog (); |
| 60 |
} |
| 61 |
else |
| 62 |
{ |
| 63 |
gldi_desklet_add_interactive_widget (myDesklet, GTK_WIDGET (myData.tray)); |
| 64 |
CD_APPLET_SET_DESKLET_RENDERER (NULL); |
| 65 |
} |
| 66 |
gtk_widget_show (GTK_WIDGET (myData.tray)); |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
void cd_systray_check_running (void) |
| 71 |
{ |
| 72 |
if (na_tray_manager_check_running (gtk_widget_get_screen (GTK_WIDGET (myContainer->pWidget))) && ! cairo_dock_is_loading ()) |
| 73 |
{ |
| 74 |
gldi_dialog_show_temporary_with_icon (D_("Another systray is already running (probably on your panel)\nSince there can only be one systray at once, you should remove it to avoid any conflict."), myIcon, myContainer, 8000, NULL); |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
|
| 79 |
void systray_on_keybinding_pull (const char *keystring, gpointer user_data) |
| 80 |
{ |
| 81 |
if (myData.tray) |
| 82 |
{ |
| 83 |
if (myDesklet) |
| 84 |
gldi_desklet_show(myDesklet); |
| 85 |
else if (myData.dialog) |
| 86 |
gldi_dialog_unhide (myData.dialog); |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
void cd_systray_set_orientation (GtkOrientation o) |
| 92 |
{ |
| 93 |
GtkOrientation o_ = na_tray_get_orientation (myData.tray); |
| 94 |
if (o != o_) |
| 95 |
{ |
| 96 |
na_tray_set_orientation (myData.tray, o); |
| 97 |
} |
| 98 |
} |