71
static void _compiz_dbus_action (const gchar *cCommand) // taken from the Compiz-Icon applet, thanks ChangFu !
73
if (! cairo_dock_dbus_detect_application ("org.freedesktop.compiz"))
75
cd_warning ("Dbus plug-in must be activated in Compiz !");
76
cairo_dock_show_temporary_dialog_with_icon (D_("You need to run Compiz and activate its 'DBus' plug-in."), myIcon, myContainer, 6000, "same icon");
79
GError *erreur = NULL;
80
gchar *cDbusCommand = g_strdup_printf ("dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/%s org.freedesktop.compiz.activate string:'root' int32:%d", cCommand, cairo_dock_get_root_id ());
81
g_spawn_command_line_async (cDbusCommand, &erreur);
84
cd_warning ("ShowDesktop : when trying to send '%s' : %s", cDbusCommand, erreur->message);
85
g_error_free (erreur);
87
g_free (cDbusCommand);
90
72
static void _cd_show_widget_layer (void)
92
_compiz_dbus_action ("widget/allscreens/toggle_button"); // toggle avant la 0.7
74
cairo_dock_wm_show_widget_layer ();
95
77
static void _cd_expose (void)
97
_compiz_dbus_action ("expo/allscreens/expo_button"); // expo avant la 0.7
79
cairo_dock_wm_present_desktops ();
100
82
static void _cd_action (CDActionOnClick iAction)
148
130
rates = XRRRates(dpy, 0, iNumRes, &num_rates);
149
131
CD_APPLET_LEAVE_IF_FAIL (num_rates > 0);
150
132
//g_return_if_fail (num_rates > 0);
151
cd_debug ("available rates : from %d to %d Hz\n", rates[0], rates[num_rates-1]);
133
cd_debug ("available rates : from %d to %d Hz", rates[0], rates[num_rates-1]);
153
135
XRRSetScreenConfigAndRate(dpy, conf, root, iNumRes, RR_Rotate_0, rates[num_rates-1], CurrentTime);
154
136
XRRFreeScreenConfigInfo (conf);
157
139
CD_APPLET_LEAVE();
142
static void _show_desktop (GtkMenuItem *menu_item, gpointer data)
144
_cd_show_hide_desktop (FALSE);
160
146
CD_APPLET_ON_BUILD_MENU_BEGIN
161
147
GtkWidget *pSubMenu = CD_APPLET_CREATE_MY_SUB_MENU ();
150
if (myConfig.iActionOnLeftClick != CD_SHOW_DESKTOP) // action is not bound to left-click => put it in the menu
152
if (myConfig.iActionOnMiddleClick == CD_SHOW_DESKTOP)
153
cLabel = g_strdup_printf ("%s (%s)", D_("Show the desktop"), D_("middle-click"));
155
cLabel = g_strdup (D_("Show the desktop"));
156
CD_APPLET_ADD_IN_MENU_WITH_STOCK (cLabel, GTK_STOCK_FULLSCREEN, _show_desktop, CD_APPLET_MY_MENU);
159
if (myConfig.iActionOnLeftClick != CD_EXPOSE) // action is not bound to left-click => put it in the menu
161
if (myConfig.iActionOnMiddleClick == CD_EXPOSE)
162
cLabel = g_strdup_printf ("%s (%s)", D_("Expose all the desktops"), D_("middle-click"));
164
cLabel = g_strdup (D_("Expose all the desktops"));
165
CD_APPLET_ADD_IN_MENU_WITH_STOCK (cLabel, GTK_STOCK_LEAVE_FULLSCREEN, _cd_expose, CD_APPLET_MY_MENU);
168
if (myConfig.iActionOnLeftClick != CD_SHOW_WIDGET_LAYER) // action is not bound to left-click => put it in the menu
170
if (myConfig.iActionOnMiddleClick == CD_SHOW_WIDGET_LAYER)
171
cLabel = g_strdup_printf ("%s (%s)", D_("Show the Widget Layer (Compiz)"), D_("middle-click"));
173
cLabel = g_strdup (D_("Show the Widget Layer (Compiz)"));
174
CD_APPLET_ADD_IN_MENU (cLabel, _cd_show_widget_layer, CD_APPLET_MY_MENU);
176
} // on ne met pas les actions sur les desklets, surement assez peu utilisees.
164
179
#ifdef HAVE_XRANDR
165
180
GtkWidget *pResSubMenu = CD_APPLET_ADD_SUB_MENU_WITH_IMAGE (D_("Change screen resolution"), CD_APPLET_MY_MENU, GTK_STOCK_FULLSCREEN);
280
295
static void _dl_finished (gpointer data)
282
g_print ("DL IS FINISHED\n");
297
cd_debug ("DL IS FINISHED");
284
299
static void _download_to_desktop (GtkMenuItem *menu_item, CairoDockModuleInstance *myApplet)
311
326
cairo_dock_add_in_menu_with_stock_and_data (D_("Link to the Desktop"), GTK_STOCK_JUMP_TO, (GFunc) _make_link_to_desktop, pMenu, myApplet);
312
327
cairo_dock_add_in_menu_with_stock_and_data (D_("Download onto the Desktop"), GTK_STOCK_COPY, (GFunc) _download_to_desktop, pMenu, myApplet);
314
cairo_dock_popup_menu_on_container (pMenu, myContainer);
329
CD_APPLET_POPUP_MENU_ON_MY_ICON (pMenu);
317
332
CD_APPLET_ON_DROP_DATA_END