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

« back to all changes in this revision

Viewing changes to Folders/src/applet-notifications.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe), Matthieu Baerts (matttbe), Iain Lane
  • Date: 2011-10-09 00:19:16 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20111009001916-9czstskx2t6l0b3x
Tags: 2.4.0~2-0ubuntu1
[ Matthieu Baerts (matttbe) ]
* New upstream bug fix release. (LP: #859984)
* Upstream (short) ChangeLog (2.4.0~0beta2 -> 2.4.0~1):
 - Powermanager: correctly release the reference on the device object
 - logout: now works if there is no session-manager
 - Status-Notifier: fixed a small bug
    (wrong callback in cairo_dock_stop_watching_dbus_name_owner)
 - Folders: fixed the positionning of the new icon
    and the dialog when dropping a folder inside the dock
    and fixed the icon-rendering
 - Dustbin: use the default theme if no icon is found
 - Impulse: the default context seems to be ok and not an error
 - Status-Notifier: On Ubuntu Oneiric (with indicator-0.4)
    the ApplicationAdded signal has changed and has a new parameter
 - Disable MeMenu on Oneiric (no longer available with indicator-0.4)
 - CMakeLists.txt: Improved output messages
 - Slide view: fixed a small offset in vertical view
 - musicPlayer:
  + split MPRIS 1.0 and 2.0 to help debugging and finding the right
     name of the bug.
  + 'rhythmbox-client' tool is no longer available: used MPRIS
  + Disable Amazon service (it no longer work)
  + Cover: fixed corrupted icons: some players (e.g. the latest version
     of RB) copy covers on their cache forlder but it takes a few time.
  + Fixed the update the icon and its name if the player is stopped.
  + Prevent a crash if the name given by MPRIS is NULL
 - Powermanager: try to prevent to have a few dialogues at the same time
 - PowerManager and AlsaMixer: hidden gnome2 or 3 apps if not available
 - Messaging-Menu: Updated for Natty and Oneiric
    (dbus-menu gives us GVariant instead of GValue objects)
 - Alsamixer: fixed a small bug on reload
 - Dbus: Bash interface: Fixed a typo with emblem positions
 - Sys-monitor: fixed a bug which prevented from getting
    the CPU temperature in some cases
 - Compiz (0.9): type filter: replaced type=utility by type=Utility
 - Updated the version of all applets that have gauges
   in order to use the right directory
 - Wifi: Fixed the status if we are not connected
 - Dbus: removed a conflict with the Help applet
 - Messaging-Menu: updated applet-menu.c => Memory leaks on pixbufs
 - Dbus: Fixed a crash when changing dock theme if a 'third-party' applet
    is running
 - Netspeed: in /proc/net/dev, there are 8 values to drop after the card id
    except if there is whitespaces just after this ':' character
    and fixed order and value for ON_ICON display
 - dock-rendering/toto: removed a useless file
 - Clipper: fixed the loading of the remembered items
    (they had the wrong type) and fixed a bug if we reduce the list of items
 - Folders, dustbin, Network-Monitor: tried to not use cast if it's possible
 - Code cleaned and re-organised a few functions
   (e.g. emblem references has been renamed)
 - Removed useless files: powermanager-dbus*
 - Updating translations
 - Fixed a few warnings at the compilation
 - Removed a few useless output messages
 - Fixed these LP bugs:
  + Empty trash from the trashcan does not delete files
     from usb harddisks: LP: #658681
  + Switcher applet doesn't respect desktop numbers LP: #626782
* Upstream (short) ChangeLog (2.4.0~1 -> 2.4.0~2):
 - Messaging-Menu: fixed a wrong g_object_unref (double free)
    and a small memory leak
 - Folders: fixed a tiny warning at the compilation (32bits)
 - switcher: removed an unnecessary config parameter
 - Folders: file size: used English instead of French translation.
 - Indicator applet: Forced a cast to remove an annoying warning
    due to clumsy dbusmenu_gtkmenu_new() declaration
 - Fixed the detection of the screensaver
 - Fixed tiny warnings at the compilation (with CAIRO_CONTAINER)
* debian/control:
 - Updated the version of cairo-dock-[core;data;dev].
 - Added gvfs as 'Suggests' for cairo-dock-plug-ins-integration
    (Used for managing files)
 - Removed 'libthunar-vfs-1-dev' (libthunar-vfs is no longer installed
    by default since XFCE 4.8 and it is replaced by gvfs)
 - Removed 'indicator-me' (no longer available
    and the installation of Cairo-Dock produces an error)
 - Moved 'indicator-messages' to 'Recommends'
* debian/rules:
 - Updated the name of CMake extras flags
* debian/cairo-dock-plug-ins-data.lintian-overrides:
 - Deleted (now useless)
* debian/cairo-dock-plug-ins.lintian-overrides:
 - Cairo-Dock Plug-Ins are not linked to gldi
 - shlib-without-versioned-soname: forwarded to upstream.
* debian/cairo-dock-plug-ins-integration.lintian-overrides:
 - Cairo-Dock Plug-Ins are not linked to gldi
 - ldconfig and shlibs are not needed
* debian/cairo-dock-plug-ins.install:
 - Fixed lintian errors: package-installs-python-bytecode
* debian/control: Fixed lintian warnings:
 - python-script-but-no-python-dep
 - description-synopsis-starts-with-article
* debian/changelog:
 - Fixed lintian warning: old-fsf-address-in-copyright-file
* debian/patches/01-switcher-force-compact-view.patch: 
 - Forced the compact view because the other doesn't work

[ Iain Lane ]
* Fix Mono/CLI build to be ~policy compliant and use correct compiler

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
 
133
133
                pLabel = gtk_label_new (NULL);
134
134
                gtk_label_set_use_markup (GTK_LABEL (pLabel), TRUE);
135
 
                g_string_printf (sInfo, "<u>Size</u> : %lld bytes", iSize);
 
135
                g_string_printf (sInfo, "<u>Size</u> : %"G_GUINT64_FORMAT" bytes", iSize);
136
136
                if (iSize > 1024*1024)
137
 
                        g_string_append_printf (sInfo, " (%.1f Mo)", 1. * iSize / 1024 / 1024);
 
137
                        g_string_append_printf (sInfo, " (%.1f MB)", 1. * iSize / 1024 / 1024);
138
138
                else if (iSize > 1024)
139
 
                        g_string_append_printf (sInfo, " (%.1f Ko)", 1. * iSize / 1024);
 
139
                        g_string_append_printf (sInfo, " (%.1f KB)", 1. * iSize / 1024);
140
140
                gtk_label_set_markup (GTK_LABEL (pLabel), sInfo->str);
141
141
                gtk_container_add (GTK_CONTAINER (pVBox), pLabel);
142
142
 
428
428
CD_APPLET_ON_BUILD_MENU_END
429
429
 
430
430
 
431
 
static void _on_answer_import (int iClickedButton, GtkWidget *pInteractiveWidget, const gchar *cReceivedData, CairoDialog *pDialog)
 
431
typedef struct {
 
432
        gchar *cReceivedData;
 
433
        double fOrder;
 
434
} CDDropData;
 
435
 
 
436
static void _on_answer_import (int iClickedButton, GtkWidget *pInteractiveWidget, CDDropData *data, CairoDialog *pDialog)
432
437
{
433
438
        cd_debug ("%s (%d)", __func__, iClickedButton);
 
439
        const gchar *cReceivedData = data->cReceivedData;
 
440
        double fOrder = data->fOrder;
434
441
        gboolean bImportFiles = (iClickedButton == 0 || iClickedButton == -1);  // ok or Enter.
435
442
        
 
443
        // add a new conf file for the "Folders" module, with proper values.
436
444
        CairoDockModule *pModule = cairo_dock_find_module_from_name ("Folders");
437
445
        g_return_if_fail (pModule != NULL);
438
446
 
440
448
        cairo_dock_update_conf_file (cConfFilePath,
441
449
                G_TYPE_STRING, "Configuration", "dir path", cReceivedData,
442
450
                G_TYPE_BOOLEAN, "Configuration", "show files", bImportFiles,
 
451
                G_TYPE_DOUBLE, "Icon", "order", fOrder,
443
452
                G_TYPE_INVALID);
444
 
 
 
453
        
 
454
        // instanciate the module from this conf file.
445
455
        CairoDockModuleInstance *pNewInstance = cairo_dock_instanciate_module (pModule, cConfFilePath);  // prend le 'cConfFilePath'.
446
456
        if (pNewInstance != NULL && pNewInstance->pDock)
447
457
        {
448
458
                cairo_dock_update_dock_size (pNewInstance->pDock);
449
459
        }
450
 
 
 
460
        
 
461
        // show a success message on the new icon.
451
462
        if (pNewInstance != NULL)
452
463
                cairo_dock_show_temporary_dialog_with_icon (D_("The folder has been imported."),
453
464
                        pNewInstance->pIcon, pNewInstance->pContainer,
454
465
                        5000,
455
466
                        MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);  // not "same icon" because the icon may not be loaded yet (eg. stack or emblem icon).
456
 
 
 
467
        
 
468
        // if the module has just been activated for the first time, write it down so that it is loaded on the next startup.
457
469
        if (pModule->pInstancesList && pModule->pInstancesList->next == NULL)  // module nouvellement active.
458
470
        {
459
471
                cairo_dock_write_active_modules ();
460
472
        }
461
473
}
 
474
static void _free_dialog_data (CDDropData *data)
 
475
{
 
476
        g_free (data->cReceivedData);
 
477
        g_free (data);
 
478
}
462
479
gboolean cd_folders_on_drop_data (gpointer data, const gchar *cReceivedData, Icon *icon, double fOrder, CairoContainer *pContainer)
463
480
{
464
481
        //g_print ("Folders received '%s'\n", cReceivedData);
465
 
        
466
482
        if (icon != NULL || fOrder == CAIRO_DOCK_LAST_ORDER)  // drop on an icon or outside of icons.
467
483
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
468
484
        
474
490
        
475
491
        if (g_file_test (cPath, G_FILE_TEST_IS_DIR))  // it's a folder, let's add a new instance of the applet that will handle it.
476
492
        {
477
 
                //g_print (" ajout d'un repertoire...\n");
478
 
                if (icon == NULL)
 
493
                // search the closest icon to the drop point (we want to place the dialog on it).
 
494
                GList *pIconsList = NULL, *ic;
 
495
                if (CAIRO_DOCK_IS_DOCK (pContainer))
 
496
                        pIconsList = CAIRO_DOCK (pContainer)->icons;
 
497
                else if (CAIRO_DOCK_IS_DESKLET (pContainer))
 
498
                        pIconsList = CAIRO_DESKLET (pContainer)->icons;
 
499
                Icon *pIcon = NULL;
 
500
                for (ic = pIconsList; ic != NULL; ic = ic->next)
 
501
                {
 
502
                        icon = ic->data;
 
503
                        if (icon->fOrder > fOrder)
 
504
                        {
 
505
                                pIcon = icon;
 
506
                                break;
 
507
                        }
 
508
                }
 
509
                if (pIcon == NULL)
479
510
                {
480
511
                        if (CAIRO_DOCK_IS_DOCK (pContainer))
481
 
                                icon = cairo_dock_get_dialogless_icon_full (CAIRO_DOCK (pContainer));
 
512
                                pIcon = cairo_dock_get_dialogless_icon_full (CAIRO_DOCK (pContainer));
482
513
                        else
483
 
                                icon = cairo_dock_get_dialogless_icon ();
 
514
                                pIcon = cairo_dock_get_dialogless_icon ();
484
515
                }
 
516
                
 
517
                // ask the user whether (s)he wants to import the folder's content.
 
518
                CDDropData *data = g_new0 (CDDropData, 1);
 
519
                data->cReceivedData = g_strdup (cReceivedData);
 
520
                data->fOrder = fOrder;
485
521
                cairo_dock_show_dialog_full (D_("Do you want to import the content of the folder too?"),
486
 
                        icon, pContainer,
 
522
                        pIcon, pContainer,
487
523
                        0,
488
524
                        MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE,
489
525
                        NULL,
490
526
                        (CairoDockActionOnAnswerFunc) _on_answer_import,
491
 
                        g_strdup (cReceivedData),
492
 
                        (GFreeFunc)g_free);
 
527
                        data,
 
528
                        (GFreeFunc)_free_dialog_data);
493
529
                
494
530
                return CAIRO_DOCK_INTERCEPT_NOTIFICATION;
495
531
        }