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/>.
25
#include <glib/gstdio.h>
28
#include "applet-struct.h"
29
#include "applet-dnd2share.h"
30
#include "applet-backend-free.h"
33
static const gchar *s_UrlLabels[NB_URLS] = {"DirectLink"};
35
static void upload (const gchar *cFilePath)
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);
41
if (cResult == NULL || *cResult == '\0')
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';
51
// Enfin on remplit la memoire partagee avec nos URLs.
52
myData.cResultUrls[0] = cResult;
56
void cd_dnd2share_register_free_backend (void)
58
cd_dnd2share_register_new_backend (CD_TYPE_FILE,
25
#include <glib/gstdio.h>
28
#include "applet-struct.h"
29
#include "applet-dnd2share.h"
30
#include "applet-backend-free.h"
33
static const gchar *s_UrlLabels[NB_URLS] = {"DirectLink"};
35
static void upload (const gchar *cFilePath, gchar *cDropboxDir, gboolean bAnonymous, gint iLimitRate, gchar **cResultUrls)
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);
42
if (cResult == NULL || *cResult == '\0')
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';
52
// Enfin on remplit la memoire partagee avec nos URLs.
53
cResultUrls[0] = cResult;
57
void cd_dnd2share_register_free_backend (void)
59
cd_dnd2share_register_new_backend (CD_TYPE_FILE,