~ubuntu-branches/ubuntu/oneiric/cairo-dock/oneiric

« back to all changes in this revision

Viewing changes to src/cairo-dock-user-interaction.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-09-07 20:31:25 UTC
  • mto: (18.1.1 cairo-dock) (19.1.1 cairo-dock)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20100907203125-a91ch8odv2r6ziic
Tags: upstream-2.2.0~0rc1
ImportĀ upstreamĀ versionĀ 2.2.0~0rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
305
305
                        }
306
306
                        else if (CAIRO_DOCK_IS_APPLI (icon))  // une appli normale
307
307
                        {
308
 
                                gchar *ext = strrchr (cReceivedData, '.');
309
 
                                if (!ext)
310
 
                                        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
311
 
                                if ((strcmp (ext, ".png") == 0 || strcmp (ext, ".svg") == 0) && !myAccessibility.bLockAll && ! myAccessibility.bLockIcons)
312
 
                                {
313
 
                                        if (!myTaskBar.bOverWriteXIcons)
314
 
                                        {
315
 
                                                myTaskBar.bOverWriteXIcons = TRUE;
316
 
                                                cairo_dock_update_conf_file (g_cConfFile,
317
 
                                                        G_TYPE_BOOLEAN, "TaskBar", "overwrite xicon", myTaskBar.bOverWriteXIcons,
318
 
                                                        G_TYPE_INVALID);
319
 
                                                cairo_dock_show_temporary_dialog_with_default_icon (_("The option 'overwrite X icons' has been automatically enabled in the config.\nIt is located in the 'Taskbar' module."), icon, pContainer, 6000);
320
 
                                        }
321
 
                                        
322
 
                                        gchar *cPath = NULL;
323
 
                                        if (strncmp (cReceivedData, "file://", 7) == 0)  // tous les programmes ne gerent pas les URI; pour parer au cas ou il ne le gererait pas, dans le cas d'un fichier local, on convertit en un chemin
324
 
                                        {
325
 
                                                cPath = g_filename_from_uri (cReceivedData, NULL, NULL);
326
 
                                        }
327
 
                                        
328
 
                                        gchar *cCommand = g_strdup_printf ("cp '%s' '%s/%s%s'", cPath?cPath:cReceivedData, g_cCurrentIconsPath, icon->cClass, ext);
329
 
                                        int r = system (cCommand);
330
 
                                        g_free (cCommand);
331
 
                                        
332
 
                                        cairo_dock_reload_icon_image (icon, pContainer);
333
 
                                        cairo_dock_redraw_icon (icon, pContainer);
334
 
                                }
 
308
                                cairo_dock_set_custom_icon_on_appli (cReceivedData, icon, pContainer);
335
309
                                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
336
310
                        }
337
311
                        else  // autre chose.
357
331
        
358
332
        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
359
333
}
 
334
 
 
335
 
 
336
void cairo_dock_set_custom_icon_on_appli (const gchar *cFilePath, Icon *icon, CairoContainer *pContainer)
 
337
{
 
338
        g_return_if_fail (CAIRO_DOCK_IS_APPLI (icon) && cFilePath != NULL);
 
339
        gchar *ext = strrchr (cFilePath, '.');
 
340
        if (!ext)
 
341
                return;
 
342
        cd_debug ("%s (%s)", __func__, cFilePath);
 
343
        if ((strcmp (ext, ".png") == 0 || strcmp (ext, ".svg") == 0) && !myAccessibility.bLockAll && ! myAccessibility.bLockIcons)
 
344
        {
 
345
                if (!myTaskBar.bOverWriteXIcons)
 
346
                {
 
347
                        myTaskBar.bOverWriteXIcons = TRUE;
 
348
                        cairo_dock_update_conf_file (g_cConfFile,
 
349
                                G_TYPE_BOOLEAN, "TaskBar", "overwrite xicon", myTaskBar.bOverWriteXIcons,
 
350
                                G_TYPE_INVALID);
 
351
                        cairo_dock_show_temporary_dialog_with_default_icon (_("The option 'overwrite X icons' has been automatically enabled in the config.\nIt is located in the 'Taskbar' module."), icon, pContainer, 6000);
 
352
                }
 
353
                
 
354
                gchar *cPath = NULL;
 
355
                if (strncmp (cFilePath, "file://", 7) == 0)
 
356
                {
 
357
                        cPath = g_filename_from_uri (cFilePath, NULL, NULL);
 
358
                }
 
359
                
 
360
                gchar *cCommand = g_strdup_printf ("cp '%s' '%s/%s%s'", cPath?cPath:cFilePath, g_cCurrentIconsPath, icon->cClass, ext);
 
361
                cd_debug (" -> '%s'", cCommand);
 
362
                int r = system (cCommand);
 
363
                g_free (cCommand);
 
364
                
 
365
                cairo_dock_reload_icon_image (icon, pContainer);
 
366
                cairo_dock_redraw_icon (icon, pContainer);
 
367
        }
 
368
}