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

« back to all changes in this revision

Viewing changes to Clipper/src/applet-clipboard.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:
25
25
 
26
26
const gchar *cEnvName[4] = {"other", "gnome", "kde", "xfce"};  // "other" allows to handle all the other DE (put your own actions into the corresponding file).
27
27
 
 
28
// TODO idea: cairo_dock_cut_string => g_strstrip + cut X first char, then add '...', then the X last char + removed '\n'
 
29
 
28
30
static int _cd_clipper_compare_item (CDClipperItem *pItem1, CDClipperItem *pItem2)
29
31
{
30
32
        if (pItem1->iType < pItem2->iType)  // on insere en 1er les items de la primary.
35
37
                return 0;
36
38
}
37
39
 
38
 
static GList *_cd_clipper_get_last_item (CDClipperItemType iItemType)
 
40
GList *cd_clipper_get_last_item (CDClipperItemType iItemType)
39
41
{
40
42
        CDClipperItem *pItem = NULL;
41
43
        GList *pElement;
136
138
                myData.pItems = g_list_delete_link (myData.pItems, pElement);
137
139
                myData.iNbItems[pItem->iType] --;
138
140
                
139
 
                if (pItem->iType != iType && myData.iNbItems[iType] == myConfig.iNbItems[iType])
 
141
                if (pItem->iType != iType && myData.iNbItems[iType] >= myConfig.iNbItems[iType])
140
142
                {
141
143
                        cd_debug ("Clipper : %s remplace le dernier de l'autre selection", text);
142
 
                        pElement = _cd_clipper_get_last_item (iType);
 
144
                        pElement = cd_clipper_get_last_item (iType);
143
145
                        CD_APPLET_LEAVE_IF_FAIL (pElement != NULL);
144
146
                        cd_clipper_free_item (pElement->data);
145
147
                        myData.pItems = g_list_delete_link (myData.pItems, pElement);
152
154
        {
153
155
                bExistingItem = FALSE;
154
156
                cd_debug ("%d items / %d", myData.iNbItems[iType], myConfig.iNbItems[iType]);
155
 
                if (myData.iNbItems[iType] == myConfig.iNbItems[iType])
 
157
                if (myData.iNbItems[iType] >= myConfig.iNbItems[iType])
156
158
                {
157
159
                        cd_debug ("Clipper : %s remplace le dernier", text);
158
 
                        pElement = _cd_clipper_get_last_item (iType);
 
160
                        pElement = cd_clipper_get_last_item (iType);
159
161
                        CD_APPLET_LEAVE_IF_FAIL (pElement != NULL);
160
162
                        cd_clipper_free_item (pElement->data);
161
163
                        myData.pItems = g_list_delete_link (myData.pItems, pElement);
168
170
                pItem = g_new0 (CDClipperItem, 1);
169
171
                pItem->iType = iType;
170
172
                pItem->cText = g_strdup (text);
171
 
                pItem->cDisplayedText = cairo_dock_cut_string (text, 50);
 
173
                pItem->cDisplayedText = cairo_dock_cut_string (g_strstrip (g_strdup (text)), 50); // g_strstrip: Removes leading and trailing whitespace from a string
172
174
        }
173
175
        myData.pItems = g_list_insert_sorted (myData.pItems, pItem, (GCompareFunc)_cd_clipper_compare_item);
174
176
        myData.iNbItems[pItem->iType] ++;
613
615
void cd_clipper_load_items (const gchar *cItems)
614
616
{
615
617
        CDClipperItem *pItem;
 
618
        int iClipperItemType = myConfig.bSeparateSelections ? CD_CLIPPER_CLIPBOARD : CD_CLIPPER_BOTH;
616
619
        gchar **cItemList = g_strsplit (cItems, CD_ITEMS_DELIMITER, -1);
617
620
        int i;
618
621
        for (i = 0; cItemList[i] != NULL; i ++)
619
622
        {
 
623
                // if we have reduced the number of items to display
 
624
                if (i == myConfig.iNbItems[iClipperItemType])
 
625
                        break;
620
626
                pItem = g_new0 (CDClipperItem, 1);
621
 
                pItem->iType = CD_CLIPPER_CLIPBOARD;
 
627
                pItem->iType = iClipperItemType;
622
628
                pItem->cText = cItemList[i];
623
 
                pItem->cDisplayedText = cairo_dock_cut_string (pItem->cText, 50);
 
629
                pItem->cDisplayedText = cairo_dock_cut_string (g_strstrip (pItem->cText), 50); // g_strstrip: Removes leading and trailing whitespace from a string
624
630
                myData.pItems = g_list_insert_sorted (myData.pItems, pItem, (GCompareFunc)_cd_clipper_compare_item);
625
 
                myData.iNbItems[pItem->iType] ++;
 
631
                myData.iNbItems[iClipperItemType] ++;
626
632
        }
627
633
        g_free (cItemList);
628
634
}