~ubuntu-branches/ubuntu/oneiric/cairo-dock-plug-ins/oneiric-proposed

« back to all changes in this revision

Viewing changes to dnd2share/src/applet-backend-free.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:
16
16
* You should have received a copy of the GNU General Public License
17
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
*/
19
 
 
20
 
 
21
 
#define _BSD_SOURCE
22
 
#include <stdlib.h>
23
 
#include <math.h>
24
 
#include <unistd.h>
25
 
#include <glib/gstdio.h>
26
 
#include <string.h>
27
 
 
28
 
#include "applet-struct.h"
29
 
#include "applet-dnd2share.h"
30
 
#include "applet-backend-free.h"
31
 
 
32
 
#define NB_URLS 1
33
 
static const gchar *s_UrlLabels[NB_URLS] = {"DirectLink"};
34
 
 
35
 
static void upload (const gchar *cFilePath)
36
 
{
37
 
        // On lance la commande d'upload.
38
 
        gchar *cCommand = g_strdup_printf ("%s/%s '%s' '%dk'", MY_APPLET_SHARE_DATA_DIR, "upload2free.sh", cFilePath, myConfig.iLimitRate);
39
 
        gchar *cResult = cairo_dock_launch_command_sync (cCommand);
40
 
        g_free (cCommand);
41
 
        if (cResult == NULL || *cResult == '\0')
42
 
        {
43
 
                return ;
44
 
        }
45
 
        
46
 
        if (cResult[strlen(cResult)-1] == '\r')
47
 
                cResult[strlen(cResult)-1] = '\0';
48
 
        if (cResult[strlen(cResult)-1] == '\n')
49
 
                cResult[strlen(cResult)-1] = '\0';
50
 
        
51
 
        // Enfin on remplit la memoire partagee avec nos URLs.
52
 
        myData.cResultUrls[0] = cResult;
53
 
}
54
 
 
55
 
 
56
 
void cd_dnd2share_register_free_backend (void)
57
 
{
58
 
        cd_dnd2share_register_new_backend (CD_TYPE_FILE,
59
 
                "dl.free.fr",
60
 
                NB_URLS,
61
 
                s_UrlLabels,
62
 
                0,
63
 
                upload);
64
 
}
 
19
 
 
20
 
 
21
#define _BSD_SOURCE
 
22
#include <stdlib.h>
 
23
#include <math.h>
 
24
#include <unistd.h>
 
25
#include <glib/gstdio.h>
 
26
#include <string.h>
 
27
 
 
28
#include "applet-struct.h"
 
29
#include "applet-dnd2share.h"
 
30
#include "applet-backend-free.h"
 
31
 
 
32
#define NB_URLS 1
 
33
static const gchar *s_UrlLabels[NB_URLS] = {"DirectLink"};
 
34
 
 
35
static void upload (const gchar *cFilePath, gchar *cDropboxDir, gboolean bAnonymous, gint iLimitRate, gchar **cResultUrls)
 
36
{
 
37
        // On lance la commande d'upload.
 
38
        gchar *cCommand = g_strdup_printf ("%s/%s \"%s\" \"%dk\"", MY_APPLET_SHARE_DATA_DIR, "upload2free.sh", cFilePath, iLimitRate);
 
39
        cd_debug ("%s", cCommand);
 
40
        gchar *cResult = cairo_dock_launch_command_sync (cCommand);
 
41
        g_free (cCommand);
 
42
        if (cResult == NULL || *cResult == '\0')
 
43
        {
 
44
                return ;
 
45
        }
 
46
        
 
47
        if (cResult[strlen(cResult)-1] == '\r')
 
48
                cResult[strlen(cResult)-1] = '\0';
 
49
        if (cResult[strlen(cResult)-1] == '\n')
 
50
                cResult[strlen(cResult)-1] = '\0';
 
51
        
 
52
        // Enfin on remplit la memoire partagee avec nos URLs.
 
53
        cResultUrls[0] = cResult;
 
54
}
 
55
 
 
56
 
 
57
void cd_dnd2share_register_free_backend (void)
 
58
{
 
59
        cd_dnd2share_register_new_backend (CD_TYPE_FILE,
 
60
                "dl.free.fr",
 
61
                NB_URLS,
 
62
                s_UrlLabels,
 
63
                0,
 
64
                upload);
 
65
}