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

« back to all changes in this revision

Viewing changes to Clipper/src/applet-clipboard.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:
102
102
                pItem = myData.pItems->data;
103
103
                if (pItem->iType & CD_CLIPPER_PRIMARY)  // le dernier item est aussi une selection souris
104
104
                {
105
 
                        int len = strlen (pItem->cText);
106
 
                        if (len < strlen (text) && strncmp (pItem->cText, text, len) == 0)  // on ne peut pas dire len == strlen (text) - 1 avec l'UTF-8.
 
105
                        guint len = strlen (pItem->cText);
 
106
                        if (len < strlen (text) && (strncmp (pItem->cText, text, len) == 0 || strncmp (pItem->cText, text+strlen(text)-len, len) == 0))  // on ne peut pas dire len == strlen (text) - 1 avec l'UTF-8.
107
107
                        {
108
108
                                cd_debug ("incremental selection, drop previous one");
109
109
                                cd_clipper_free_item (pItem);
379
379
        CD_APPLET_ENTER;
380
380
        if (pMenu == myData.pActionMenu)
381
381
        {
382
 
                g_print ("auto-destruction\n");
 
382
                cd_debug ("auto-destruction\n");
383
383
                gtk_widget_destroy (myData.pActionMenu);  // n'appellera pas le 'delete_menu'
384
384
                myData.pActionMenu = NULL;
385
385
        }
590
590
                gtk_get_current_event_time ());
591
591
}
592
592
 
593
 
gchar *cd_clipper_concat_items_of_type (CDClipperItemType iType)
 
593
gchar *cd_clipper_concat_items_of_type (CDClipperItemType iType, const gchar *cSeparator)
594
594
{
595
595
        GString *sText = g_string_new ("");
596
596
        CDClipperItem *pItem;
600
600
                pItem = it->data;
601
601
                if ((pItem->iType & iType) == 0)
602
602
                        continue;
603
 
                g_string_append_printf (sText, "%s\n", pItem->cText);
 
603
                g_string_append_printf (sText, "%s%s", pItem->cText, it->next ? cSeparator : "");
604
604
        }
605
605
        gchar *cText = sText->str;
606
606
        g_string_free (sText, FALSE);
607
607
        return cText;
608
608
}
 
609
 
 
610
void cd_clipper_load_items (const gchar *cItems)
 
611
{
 
612
        CDClipperItem *pItem;
 
613
        gchar **cItemList = g_strsplit (cItems, CD_ITEMS_DELIMITER, -1);
 
614
        int i;
 
615
        for (i = 0; cItemList[i] != NULL; i ++)
 
616
        {
 
617
                pItem = g_new0 (CDClipperItem, 1);
 
618
                pItem->iType = CD_CLIPPER_CLIPBOARD;
 
619
                pItem->cText = cItemList[i];
 
620
                pItem->cDisplayedText = cairo_dock_cut_string (pItem->cText, 50);
 
621
                myData.pItems = g_list_insert_sorted (myData.pItems, pItem, (GCompareFunc)_cd_clipper_compare_item);
 
622
                myData.iNbItems[pItem->iType] ++;
 
623
        }
 
624
        g_free (cItemList);
 
625
}