~ubuntu-branches/ubuntu/vivid/cairo-dock-plug-ins/vivid

« back to all changes in this revision

Viewing changes to dnd2share/src/applet-backend-codepad.c

  • Committer: Matthieu Baerts
  • Date: 2013-08-27 14:46:47 UTC
  • mto: (53.1.4 cairo-dock-plug-ins)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: matttbe@gmail.com-20130827144647-wm0kyawa8vcg0cso
Tags: upstream-3.2.99.beta1.1~20130827~bzr2928
ImportĀ upstreamĀ versionĀ 3.2.99.beta1.1~20130827~bzr2928

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
#include "applet-struct.h"
28
28
#include "applet-dnd2share.h"
29
 
#include "applet-backend-pastebin.h"
 
29
#include "applet-backend-codepad.h"
30
30
 
31
31
#define URL "http://codepad.org"
32
32
#define FORMAT "Plain Text"
33
33
 
34
34
#define NB_URLS 1
35
 
static const gchar *s_UrlLabels[NB_URLS] = {"DirectLink"};
 
35
static const gchar *s_UrlLabels[NB_URLS] = {N_("Direct Link")};
36
36
 
37
37
/*<html>
38
38
 <head>
44
44
you should be redirected automatically.
45
45
 </body>
46
46
</html>'*/
47
 
static void upload (const gchar *cText, gchar *cDropboxDir, gboolean bAnonymous, gint iLimitRate, gchar **cResultUrls)
 
47
static void upload (const gchar *cText, gchar *cLocalDir, gboolean bAnonymous, gint iLimitRate, gchar **cResultUrls, GError **pError)
48
48
{
 
49
        if (cText == NULL || *cText == '\0')
 
50
        {
 
51
                g_set_error (pError, 1, 1, D_("Your text is empty and couldn't be uploaded to this server"));
 
52
                return;
 
53
        }
 
54
 
49
55
        GError *erreur = NULL;
50
56
        gchar *cResult = cairo_dock_get_url_data_with_post (URL, FALSE, &erreur,
51
57
                "code", cText,
56
62
        {
57
63
                cd_warning (erreur->message);
58
64
                g_error_free (erreur);
 
65
                DND2SHARE_SET_GENERIC_ERROR_WEBSITE("Codepad.org");
59
66
        }
60
67
        else if (cResult)
61
68
        {
63
70
                gchar *str = strstr (cResult, "http");
64
71
                if (str)
65
72
                        cResultUrls[0] = g_strdup (str);
 
73
                else
 
74
                        DND2SHARE_SET_GENERIC_ERROR_WEBSITE("Codepad.org");
 
75
                g_free (cResult);
66
76
        }
 
77
        // else -> generic error
67
78
}
68
79
 
69
80