~ubuntu-branches/ubuntu/quantal/cairo-dock-plug-ins/quantal-201208191523

« back to all changes in this revision

Viewing changes to showDesktop/src/applet-notifications.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2011-04-20 20:46:51 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20110420204651-ftnpzesj6uc7qeul
Tags: 2.3.0~1-0ubuntu1
* New Upstream Version (LP: #723995)
* Upstream short ChangeLog (since 2.3.0~0rc1):
 - Updated translations
 - Updated the integration of the new versions of kwin and compiz
    (Switcher, ShowDesktop, etc.)
 - Removed a lot of useless g_print
 - Updated a few plug-ins to fit with the new version of the API (gldit)
 - Fixed a few bugs
 - Updated MeMenu, MessagingMenu and Status-Notifier to works
    with the latest version of dbusmenu, etc.
* Switch to dpkg-source 3.0 (quilt) format
* debian/cairo-dock-plug-ins.install:
 - Added new files (interfaces for python, ruby, vala and mono)
* debian/control:
 - Added new dependences for new applets (sensors and zeitgeist)
    and new interfaces (python, valac, ruby and mono)
 - Updated the version of cairo-dock build-dependences
* debian/rules:
 - Added a new CMake flag to install python interface in debian/tmp
* Updated debian/watch

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
        }
69
69
}
70
70
 
71
 
static void _compiz_dbus_action (const gchar *cCommand)  // taken from the Compiz-Icon applet, thanks ChangFu !
72
 
{
73
 
        if (! cairo_dock_dbus_detect_application ("org.freedesktop.compiz"))
74
 
        {
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");
77
 
        }
78
 
        
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);
82
 
        if (erreur != NULL)
83
 
        {
84
 
                cd_warning ("ShowDesktop : when trying to send '%s' : %s", cDbusCommand, erreur->message);
85
 
                g_error_free (erreur);
86
 
        }
87
 
        g_free (cDbusCommand);
88
 
}
89
71
 
90
72
static void _cd_show_widget_layer (void)
91
73
{
92
 
        _compiz_dbus_action ("widget/allscreens/toggle_button");  // toggle avant la 0.7
 
74
        cairo_dock_wm_show_widget_layer ();
93
75
}
94
76
 
95
77
static void _cd_expose (void)
96
78
{
97
 
        _compiz_dbus_action ("expo/allscreens/expo_button");  // expo avant la 0.7
 
79
        cairo_dock_wm_present_desktops ();
98
80
}
99
81
 
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]);
152
134
        
153
135
        XRRSetScreenConfigAndRate(dpy, conf, root, iNumRes, RR_Rotate_0, rates[num_rates-1], CurrentTime);
154
136
        XRRFreeScreenConfigInfo (conf);
157
139
        CD_APPLET_LEAVE();
158
140
}
159
141
#endif
 
142
static void _show_desktop (GtkMenuItem *menu_item, gpointer data)
 
143
{
 
144
        _cd_show_hide_desktop (FALSE);
 
145
}
160
146
CD_APPLET_ON_BUILD_MENU_BEGIN
161
147
        GtkWidget *pSubMenu = CD_APPLET_CREATE_MY_SUB_MENU ();
162
148
        
 
149
        gchar *cLabel;
 
150
        if (myConfig.iActionOnLeftClick != CD_SHOW_DESKTOP)  // action is not bound to left-click => put it in the menu
 
151
        {
 
152
                if (myConfig.iActionOnMiddleClick == CD_SHOW_DESKTOP)
 
153
                        cLabel = g_strdup_printf ("%s (%s)", D_("Show the desktop"), D_("middle-click"));
 
154
                else
 
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);
 
157
                g_free (cLabel);
 
158
        }
 
159
        if (myConfig.iActionOnLeftClick != CD_EXPOSE)  // action is not bound to left-click => put it in the menu
 
160
        {
 
161
                if (myConfig.iActionOnMiddleClick == CD_EXPOSE)
 
162
                        cLabel = g_strdup_printf ("%s (%s)", D_("Expose all the desktops"), D_("middle-click"));
 
163
                else
 
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);
 
166
                g_free (cLabel);
 
167
        }
 
168
        if (myConfig.iActionOnLeftClick != CD_SHOW_WIDGET_LAYER)  // action is not bound to left-click => put it in the menu
 
169
        {
 
170
                if (myConfig.iActionOnMiddleClick == CD_SHOW_WIDGET_LAYER)
 
171
                        cLabel = g_strdup_printf ("%s (%s)", D_("Show the Widget Layer (Compiz)"), D_("middle-click"));
 
172
                else
 
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);
 
175
                g_free (cLabel);
 
176
        }  // on ne met pas les actions sur les desklets, surement assez peu utilisees.
 
177
        
163
178
        // Main Menu
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);
279
294
}
280
295
static void _dl_finished (gpointer data)
281
296
{
282
 
        g_print ("DL IS FINISHED\n");
 
297
        cd_debug ("DL IS FINISHED");
283
298
}
284
299
static void _download_to_desktop (GtkMenuItem *menu_item, CairoDockModuleInstance *myApplet)
285
300
{
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);
313
328
        }
314
 
        cairo_dock_popup_menu_on_container (pMenu, myContainer);
 
329
        CD_APPLET_POPUP_MENU_ON_MY_ICON (pMenu);
315
330
        
316
331
        
317
332
CD_APPLET_ON_DROP_DATA_END
337
352
                        CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cVisibleImage);
338
353
                else
339
354
                        CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cHiddenImage);
 
355
                CD_APPLET_REDRAW_MY_ICON;
340
356
        }
341
357
        CD_APPLET_LEAVE (CAIRO_DOCK_LET_PASS_NOTIFICATION);
342
358
}