~cairo-dock-team/ubuntu/quantal/cairo-dock-plug-ins/3.0.2

« back to all changes in this revision

Viewing changes to Scooby-Do/src/applet-backend-files.c

Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
#define NB_ACTIONS_ON_FOLDER 4
141
141
static GList *_list_folder (const gchar *cPath, gboolean bNoHiddenFile, int *iNbEntries)
142
142
{
143
 
        g_print ("%s (%s)\n", __func__, cPath);
 
143
        cd_debug ("%s (%s)\n", __func__, cPath);
144
144
        // on ouvre le repertoire.
145
145
        GError *erreur = NULL;
146
146
        GDir *dir = g_dir_open (cPath, 0, &erreur);
218
218
#define NB_ACTIONS_ON_FILE 5
219
219
static GList *_list_actions_on_file (const gchar *cPath, int *iNbEntries)
220
220
{
221
 
        g_print ("%s ()\n", __func__);
 
221
        cd_debug ("%s ()\n", __func__);
222
222
        GList *pEntries = NULL;
223
223
        CDEntry *pEntry;
224
224
        
268
268
 
269
269
static GList *_cd_do_list_file_sub_entries (CDEntry *pEntry, int *iNbEntries)
270
270
{
271
 
        g_print ("%s (%s)\n", __func__, pEntry->cPath);
 
271
        cd_debug ("%s (%s)\n", __func__, pEntry->cPath);
272
272
        if (pEntry->cPath == NULL)  // on est deja en bout de chaine.
273
273
                return NULL;
274
274
        if (g_file_test (pEntry->cPath, G_FILE_TEST_IS_DIR))  // on liste les fichiers du repertoire et les actions sur le repertoire.
291
291
{
292
292
        if (pEntry->cIconName && pEntry->pIconSurface == NULL)
293
293
        {
294
 
                cairo_t* pSourceContext = cairo_dock_create_context_from_container (CAIRO_CONTAINER (g_pMainDock));
295
294
                gchar *cImagePath = g_strconcat (MY_APPLET_SHARE_DATA_DIR, "/", pEntry->cIconName, NULL);
296
295
                pEntry->pIconSurface = cairo_dock_create_surface_from_icon (cImagePath,
297
 
                        pSourceContext,
298
296
                        myDialogs.dialogTextDescription.iSize + 2,
299
297
                        myDialogs.dialogTextDescription.iSize + 2);
300
 
                cairo_destroy (pSourceContext);
301
298
                g_free (cImagePath);
302
299
                return TRUE;
303
300
        }
315
312
        g_free (cURI);
316
313
        if (cIconName != NULL && pEntry->pIconSurface == NULL)
317
314
        {
318
 
                cairo_t* pSourceContext = cairo_dock_create_context_from_container (CAIRO_CONTAINER (g_pMainDock));
319
315
                pEntry->pIconSurface = cairo_dock_create_surface_from_icon (cIconName,
320
 
                        pSourceContext,
321
316
                        myDialogs.dialogTextDescription.iSize,
322
317
                        myDialogs.dialogTextDescription.iSize);
323
318
                g_free (cIconName);
324
 
                cairo_destroy (pSourceContext);
325
319
                return TRUE;
326
320
        }
327
321
        return FALSE;
334
328
 
335
329
static void _cd_do_launch_file (CDEntry *pEntry)
336
330
{
337
 
        g_print ("%s (%s)\n", __func__, pEntry->cPath);
 
331
        cd_debug ("%s (%s)\n", __func__, pEntry->cPath);
338
332
        cairo_dock_fm_launch_uri (pEntry->cPath);
339
333
}
340
334
 
341
335
static void _cd_do_show_file_location (CDEntry *pEntry)
342
336
{
343
 
        g_print ("%s (%s)\n", __func__, pEntry->cPath);
 
337
        cd_debug ("%s (%s)\n", __func__, pEntry->cPath);
344
338
        gchar *cPathUp = g_path_get_dirname (pEntry->cPath);
345
339
        g_return_if_fail (cPathUp != NULL);
346
340
        cairo_dock_fm_launch_uri (cPathUp);
349
343
 
350
344
static void _cd_do_open_terminal_here (CDEntry *pEntry)
351
345
{
352
 
        g_print ("%s (%s)\n", __func__, pEntry->cPath);
 
346
        cd_debug ("%s (%s)\n", __func__, pEntry->cPath);
353
347
        gchar *cCommand = NULL;
354
348
        if (g_iDesktopEnv == CAIRO_DOCK_GNOME)
355
349
                cCommand = g_strdup_printf ("gnome-terminal --working-directory=\"%s\"", pEntry->cPath);
365
359
 
366
360
static void _cd_do_zip_folder (CDEntry *pEntry)
367
361
{
368
 
        g_print ("%s (%s)\n", __func__, pEntry->cPath);
 
362
        cd_debug ("%s (%s)\n", __func__, pEntry->cPath);
369
363
        gchar *cCommand = g_strdup_printf ("tar cfz '%s.tar.gz' '%s'", pEntry->cPath, pEntry->cPath);
370
364
        cairo_dock_launch_command (cCommand);
371
365
        g_free (cCommand);
373
367
 
374
368
static void _cd_do_zip_file (CDEntry *pEntry)
375
369
{
376
 
        g_print ("%s (%s)\n", __func__, pEntry->cPath);
 
370
        cd_debug ("%s (%s)\n", __func__, pEntry->cPath);
377
371
        gchar *cCommand = g_strdup_printf ("zip '%s.zip' '%s'", pEntry->cPath, pEntry->cPath);
378
372
        cairo_dock_launch_command (cCommand);
379
373
        g_free (cCommand);
381
375
 
382
376
static void _cd_do_mail_file (CDEntry *pEntry)
383
377
{
384
 
        g_print ("%s (%s)\n", __func__, pEntry->cPath);
 
378
        cd_debug ("%s (%s)\n", __func__, pEntry->cPath);
385
379
        gchar *cURI = g_filename_to_uri (pEntry->cPath, NULL, NULL);
386
380
        gchar *cCommand = g_strdup_printf ("thunderbird -compose \"attachment=%s\"", cURI);  /// prendre aussi en compte les autres clients mail, et utiliser celui par defaut...
387
381
        cairo_dock_launch_command (cCommand);
391
385
 
392
386
static void _cd_do_move_file (CDEntry *pEntry)
393
387
{
394
 
        g_print ("%s (%s)\n", __func__, pEntry->cPath);
 
388
        cd_debug ("%s (%s)\n", __func__, pEntry->cPath);
395
389
        GtkWidget* pFileChooserDialog = gtk_file_chooser_dialog_new (
396
390
                D_("Pick up a directory"),
397
391
                GTK_WINDOW (g_pMainDock->container.pWidget),
424
418
 
425
419
static void _cd_do_copy_url (CDEntry *pEntry)
426
420
{
427
 
        g_print ("%s (%s)\n", __func__, pEntry->cPath);
 
421
        cd_debug ("%s (%s)\n", __func__, pEntry->cPath);
428
422
        GtkClipboard *pClipBoard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
429
423
        gtk_clipboard_set_text (pClipBoard, pEntry->cPath, -1);
430
424
}
477
471
                }
478
472
        }
479
473
        
480
 
        g_print (">>> %s\n", sCommand->str);
 
474
        cd_debug (">>> %s\n", sCommand->str);
481
475
        gchar *cResult = cairo_dock_launch_command_sync (sCommand->str);
482
476
        if (cResult == NULL || *cResult == '\0')
483
477
        {
506
500
        }
507
501
        g_free (pMatchingFiles);  // ses elements sont dans les entrees.
508
502
        
509
 
        g_print ("%d entries built\n", i);
 
503
        cd_debug ("%d entries built\n", i);
510
504
        *iNbEntries = i;
511
505
        return pEntries;
512
506
}
513
507
static GList* search (const gchar *cText, int iFilter, gboolean bSearchAll, int *iNbEntries)
514
508
{
515
 
        g_print ("%s (%s)\n", __func__, cText);
 
509
        cd_debug ("%s (%s)\n", __func__, cText);
516
510
        gchar *cResult = _locate_files (cText, iFilter, (bSearchAll ? 50 : 3));
517
511
        
518
512
        if (cResult == NULL)