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

« back to all changes in this revision

Viewing changes to RSSreader/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:
28
28
#include "applet-notifications.h"
29
29
 
30
30
 
31
 
static void _start_browser (GtkMenuItem *menu_item, CairoDockModuleInstance *myApplet)
32
 
{
33
 
        if (myConfig.cSpecificWebBrowser != NULL)  // une commande specifique est fournie.
34
 
                cairo_dock_launch_command_printf ("%s %s", NULL, myConfig.cSpecificWebBrowser, myConfig.cUrl);
35
 
        else  // sinon on utilise la commande par defaut.
36
 
                cairo_dock_fm_launch_uri (myConfig.cUrl);
37
 
}
38
 
 
39
31
static void _new_url_to_conf (CairoDockModuleInstance *myApplet, const gchar *cNewURL)
40
32
{
41
33
        if (g_strstr_len (cNewURL, -1, "http") != NULL)  // On verifie que l'element glisser/copier commence bien par http
68
60
                if (myDesklet)
69
61
                        cd_applet_update_my_icon (myApplet);
70
62
                
71
 
                cd_rssreader_upload_feeds_TASK (myApplet); // On lance l'upload pour mettre a jour notre applet
 
63
                cd_rssreader_launch_task (myApplet); // On lance l'upload pour mettre a jour notre applet
72
64
        }
73
65
        else
74
66
        {
94
86
 
95
87
//\___________ Define here the action to be taken when the user left-clicks on your icon or on its subdock or your desklet. The icon and the container that were clicked are available through the macros CD_APPLET_CLICKED_ICON and CD_APPLET_CLICKED_CONTAINER. CD_APPLET_CLICKED_ICON may be NULL if the user clicked in the container but out of icons.
96
88
CD_APPLET_ON_CLICK_BEGIN
97
 
        cd_debug ("RSSreader-debug : CLIC");
98
89
        cd_rssreader_show_dialog (myApplet);
99
90
CD_APPLET_ON_CLICK_END
100
91
 
101
92
 
102
 
CD_APPLET_ON_MIDDLE_CLICK_BEGIN
103
 
        cd_debug ("RSSreader-debug : MIDDLE-CLIC");
 
93
static inline void _update_feeds (CairoDockModuleInstance *myApplet)
 
94
{
104
95
        myData.bUpdateIsManual = TRUE;
105
96
        // on ne met pas de message d'attente pour conserver les items actuels, on prefere afficher un dialogue signalant ou pas une modification.
106
97
        if (! cairo_dock_task_is_running (myData.pTask))  // sinon on va bloquer jusqu'a ce que la tache courante se termine, pour la relancer aussitot, ce qui n'a aucun interet.
107
 
                cd_rssreader_upload_feeds_TASK (myApplet);
 
98
                cd_rssreader_launch_task (myApplet);
 
99
}
 
100
CD_APPLET_ON_MIDDLE_CLICK_BEGIN
 
101
        _update_feeds (myApplet);
108
102
CD_APPLET_ON_MIDDLE_CLICK_END
109
103
 
110
104
 
115
109
 
116
110
 
117
111
//\___________ Define here the entries you want to add to the menu when the user right-clicks on your icon or on its subdock or your desklet. The icon and the container that were clicked are available through the macros CD_APPLET_CLICKED_ICON and CD_APPLET_CLICKED_CONTAINER. CD_APPLET_CLICKED_ICON may be NULL if the user clicked in the container but out of icons. The menu where you can add your entries is available throught the macro CD_APPLET_MY_MENU; you can add sub-menu to it if you want.
 
112
static void _start_browser (GtkMenuItem *menu_item, CairoDockModuleInstance *myApplet)
 
113
{
 
114
        if (myConfig.cSpecificWebBrowser != NULL)  // une commande specifique est fournie.
 
115
                cairo_dock_launch_command_printf ("%s %s", NULL, myConfig.cSpecificWebBrowser, myConfig.cUrl);
 
116
        else  // sinon on utilise la commande par defaut.
 
117
                cairo_dock_fm_launch_uri (myConfig.cUrl);
 
118
}
 
119
static void _refresh (GtkMenuItem *menu_item, CairoDockModuleInstance *myApplet)
 
120
{
 
121
        _update_feeds (myApplet);
 
122
}
118
123
CD_APPLET_ON_BUILD_MENU_BEGIN
119
124
        GtkWidget *pSubMenu = CD_APPLET_CREATE_MY_SUB_MENU ();
120
125
                CD_APPLET_ADD_ABOUT_IN_MENU (pSubMenu);
122
127
        CD_APPLET_ADD_IN_MENU_WITH_STOCK (D_("Paste a new RSS Url (drag and drop)"), GTK_STOCK_PASTE, _paste_new_url_to_conf, CD_APPLET_MY_MENU);       
123
128
        
124
129
        if (myConfig.cUrl != NULL) // On ajoute une entrée dans le menu SI il y a une url seulement
125
 
                CD_APPLET_ADD_IN_MENU_WITH_STOCK (D_("Open with your web browser"), GTK_STOCK_EXECUTE, _start_browser, CD_APPLET_MY_MENU);      
 
130
        {
 
131
                CD_APPLET_ADD_IN_MENU_WITH_STOCK (D_("Open with your web browser"), GTK_STOCK_EXECUTE, _start_browser, CD_APPLET_MY_MENU);
 
132
                gchar *cLabel = g_strdup_printf ("%s (%s)", D_("Refresh"), D_("middle-click"));
 
133
                CD_APPLET_ADD_IN_MENU_WITH_STOCK (cLabel, GTK_STOCK_REFRESH, _refresh, CD_APPLET_MY_MENU);
 
134
                g_free (cLabel);
 
135
        }
126
136
        
127
137
CD_APPLET_ON_BUILD_MENU_END
128
138