~ubuntu-branches/ubuntu/quantal/cairo-dock-plug-ins/quantal-201208191523

« back to all changes in this revision

Viewing changes to Scooby-Do/src/applet-search.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-10 00:05:57 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810000557-pfxoz5w7hbyclcqh
Tags: 2.2.0~0beta4-0ubuntu1
* New Upstream Version (LP: #614625)
* Fixed a few bugs on LP:
 - LP: #483963: Dustbin applet does not display trashes on all volumes
 - LP: #485159: Some apps have problem with Systray
 - LP: #500677: ~/.xsession-errors is too much used by CD
 - LP: #500979: Shortcuts: the order gets messed up
 - LP: #521531: Mail: crashes on Maildir
 - LP: #519915: GTG: create a new applet to control GTG
 - LP: #526138: GMenu doesn't handle desktop file exec strings properly
 - LP: #531317: CMake: Added an error if the prefix of 'cairo-dock-plugins'
                 is not the same 'cairo-dock-core'
 - LP: #531319: CMake: check the version of 'cairo-dock' when building
                 'cairo-dock-plugins'
 - LP: #537115: Click at the position where icon lavel was, the icon
                 and dock still receive the event
 - LP: #537943: Terminal applet shortkey behaviour
 - LP: #538637: Trash applet doesn't create .trashinfo files on XFCE
 - More details on the 'ChangeLog' file
* debian/rules:
 - Autotools has been replaced by CMake
 - cdbs is now used.
* debian/copyright:
 - Updated with the new applets
* debian/control:
 - Autotools has been replaced by CMake
 - Added libcurl4-gnutls-dev, libindicator-dev, libdbusmenu-glib-dev
   libido-0.1-dev, libical-dev, libdbusmenu-gtk-dev as Build-deps
 - Bump Standard-Version to 3.9.1
 - Wget is required for dnd2share applet
 - Added the exact realease for 'cairo-dock-dev' in order to prevent any
    build error if this package is not already available (thx to didrocks)
* debian/cairo-dock-plug-ins*.install:
 - All sonames are now installed into lib32 or lib64 (lib*)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
{
34
34
        if (pEntry->cIconName && pEntry->pIconSurface == NULL)
35
35
        {
36
 
                cairo_t* pSourceContext = cairo_dock_create_context_from_container (CAIRO_CONTAINER (g_pMainDock));
37
36
                pEntry->pIconSurface = cairo_dock_create_surface_from_icon (pEntry->cIconName,
38
 
                        pSourceContext,
39
37
                        myDialogs.dialogTextDescription.iSize + 2,
40
38
                        myDialogs.dialogTextDescription.iSize + 2);
41
 
                cairo_destroy (pSourceContext);
42
39
                return TRUE;
43
40
        }
44
41
        return FALSE;
58
55
                pBackend->iLocateFilter,
59
56
                FALSE,
60
57
                &pBackend->iNbSearchResults);
61
 
        g_print (" -> %d resultats asynchrones en plus\n", pBackend->iNbSearchResults);
 
58
        cd_debug (" -> %d resultats asynchrones en plus\n", pBackend->iNbSearchResults);
62
59
        if (pBackend->pSearchResults != NULL)
63
60
        {
64
61
                CDEntry *pMainEntry = pBackend->pSearchResults->data;
69
66
 
70
67
static gboolean _update_entries (CDBackend *pBackend)
71
68
{
72
 
        g_print ("%s ()\n", __func__);
 
69
        cd_debug ("%s ()\n", __func__);
73
70
        pBackend->bFoundNothing = FALSE;
74
71
        pBackend->bTooManyResults = FALSE;
75
72
        
76
73
        if (! cd_do_session_is_waiting_for_input () || myData.pListingHistory != NULL)  // on a quitte la session ou on a choisi une entree en cours de route.
77
74
        {
78
 
                g_print (" on a quitte la session ou on a choisi une entree en cours de route\n");
 
75
                cd_debug (" on a quitte la session ou on a choisi une entree en cours de route\n");
79
76
                _discard_results (pBackend);
80
77
                pBackend->cCurrentLocateText = NULL;
81
78
                pBackend->iLocateFilter = 0;
89
86
                        pBackend->cCurrentLocateText &&
90
87
                        strncmp (pBackend->cCurrentLocateText, myData.sCurrentText->str, strlen (pBackend->cCurrentLocateText)) == 0)  // c'est une sous-recherche.
91
88
                {
92
 
                        g_print (" c'est une sous-recherche\n");
 
89
                        cd_debug (" c'est une sous-recherche\n");
93
90
                        if (pBackend->pSearchResults == NULL)  // on n'a rien trouve, on vide le listing et on ne la relance pas.
94
91
                        {
95
 
                                g_print ("  aucun resultat, on enleve les precedents resultats et on ne la relance pas\n");
 
92
                                cd_debug ("  aucun resultat, on enleve les precedents resultats et on ne la relance pas\n");
96
93
                                pBackend->bFoundNothing = TRUE;
97
94
                                cd_do_remove_entries_from_listing (pBackend);
98
95
                                return FALSE;
117
114
                }
118
115
                else  // c'est une nouvelle recherche, on bache tout et on relance.
119
116
                {
120
 
                        g_print (" c'est une nouvelle recherche, on bache tout et on relance\n");
 
117
                        cd_debug (" c'est une nouvelle recherche, on bache tout et on relance\n");
121
118
                        _discard_results (pBackend);
122
119
                        
123
120
                        if (myData.pMatchingIcons != NULL || myData.sCurrentText->len == 0)  // avec le texte courant on a des applis, on quitte.
131
128
                }
132
129
                
133
130
                // on relance.
134
 
                g_print (" on relance\n");
 
131
                cd_debug (" on relance\n");
135
132
                cd_do_set_status (D_("Searching ..."));
136
133
                pBackend->iLocateFilter = myData.iCurrentFilter;
137
134
                g_free (pBackend->cCurrentLocateText);
153
150
}
154
151
void cd_do_launch_backend (CDBackend *pBackend)
155
152
{
156
 
        g_print ("%s (%s)\n", __func__, pBackend->cName);
 
153
        cd_debug ("%s (%s)\n", __func__, pBackend->cName);
157
154
        // On initialise le backend si c'est son 1er appel.
158
155
        if (pBackend->iState == 0)
159
156
        {
176
173
        {
177
174
                if (cairo_dock_task_is_running (pBackend->pTask))  // on la laisse se finir, et lorsqu'elle aura fini, on la relancera avec le nouveau texte/filtre.
178
175
                {
179
 
                        g_print (" on laisse la tache courante se finir\n");
 
176
                        cd_debug (" on laisse la tache courante se finir\n");
180
177
                        return ;
181
178
                }
182
179
                
188
185
                                        strlen (pBackend->cCurrentLocateText)) == 0
189
186
                        && ! pBackend->bTooManyResults))  // c'est une sous-recherche de la precedente qui etait fructueuse, ou un filtre sur un sous-listing.
190
187
                {
191
 
                        g_print (" filtrage de la recherche\n");
 
188
                        cd_debug (" filtrage de la recherche\n");
192
189
                        cd_do_filter_entries (pBackend->pLastShownResults, pBackend->iNbLastShownResults);
193
190
                        
194
191
                        
212
209
                        myData.iCurrentFilter,
213
210
                        FALSE,
214
211
                        &iNbEntries);
215
 
                g_print (" -> %d resultats en plus\n", iNbEntries);
 
212
                cd_debug (" -> %d resultats en plus\n", iNbEntries);
216
213
                if (pEntries != NULL)
217
214
                {
218
215
                        CDEntry *pMainEntry = pEntries->data;
231
228
 
232
229
void cd_do_launch_all_backends (void)
233
230
{
234
 
        g_print ("%s ()\n", __func__);
 
231
        cd_debug ("%s ()\n", __func__);
235
232
        cd_do_show_listing ();
236
233
        g_list_foreach (myData.pBackends, (GFunc) cd_do_launch_backend, NULL);
237
234
}
284
281
 
285
282
void cd_do_append_entries_to_listing (GList *pEntries, gint iNbEntries)
286
283
{
287
 
        g_print ("%s (%d)\n", __func__, iNbEntries);
 
284
        cd_debug ("%s (%d)\n", __func__, iNbEntries);
288
285
        if (myData.pListing == NULL)
289
286
                return ;
290
287
        cd_do_show_listing ();
296
293
        myData.pListing->iNbVisibleEntries += iNbEntries;
297
294
        
298
295
        cd_do_fill_listing_entries (myData.pListing);
299
 
        g_print (" => %d elements (%d/%d)\n", g_list_length (myData.pListing->pEntries), myData.pListing->iNbEntries, myData.pListing->iNbVisibleEntries);
 
296
        cd_debug (" => %d elements (%d/%d)\n", g_list_length (myData.pListing->pEntries), myData.pListing->iNbEntries, myData.pListing->iNbVisibleEntries);
300
297
}
301
298
 
302
299
 
303
300
void cd_do_remove_entries_from_listing (CDBackend *pBackend)
304
301
{
305
 
        g_print ("%s (%s, %d)\n", __func__, pBackend->cName, pBackend->iNbLastShownResults);
 
302
        cd_debug ("%s (%s, %d)\n", __func__, pBackend->cName, pBackend->iNbLastShownResults);
306
303
        g_return_if_fail (myData.pListing != NULL);
307
304
        if (pBackend->pLastShownResults == NULL)
308
305
                return ;
335
332
        }
336
333
        myData.pListing->iNbEntries -= i;
337
334
        myData.pListing->iNbVisibleEntries -= j;
338
 
        g_print ("iNbEntries <- %d/%d\n", myData.pListing->iNbEntries, myData.pListing->iNbVisibleEntries);
 
335
        cd_debug ("iNbEntries <- %d/%d\n", myData.pListing->iNbEntries, myData.pListing->iNbVisibleEntries);
339
336
        
340
337
        pRightLink = e;
341
338
        if (pRightLink != NULL)
348
345
        }
349
346
        if (pBackend->pLastShownResults == myData.pListing->pEntries)
350
347
                myData.pListing->pEntries = pRightLink;
351
 
        g_print (" => %d elements\n", g_list_length (myData.pListing->pEntries));
 
348
        cd_debug (" => %d elements\n", g_list_length (myData.pListing->pEntries));
352
349
        
353
350
        pBackend->pLastShownResults = NULL;
354
351
        pBackend->iNbLastShownResults = 0;
377
374
 
378
375
int cd_do_filter_entries (GList *pEntries, gint iNbEntries)
379
376
{
380
 
        g_print ("%s (%d)\n", __func__, iNbEntries);
 
377
        cd_debug ("%s (%d)\n", __func__, iNbEntries);
381
378
        CDEntry *pEntry;
382
379
        int i, j = 0;
383
380
        GList *e;
459
456
 
460
457
void cd_do_activate_filter_option (int iNumOption)
461
458
{
462
 
        g_print ("%s (%d)\n", __func__, iNumOption);
 
459
        cd_debug ("%s (%d)\n", __func__, iNumOption);
463
460
        int iMaskOption = (1 << iNumOption);
464
461
        if (myData.iCurrentFilter & iMaskOption)  // on enleve l'option => ca fait (beaucoup) plus de resultats.
465
462
        {
470
467
                myData.iCurrentFilter |= iMaskOption;
471
468
                if (myData.pListing && myData.pListing->pEntries == NULL)  // on rajoute une contrainte sur une recherche qui ne fournit aucun resultat => on ignore.
472
469
                {
473
 
                        g_print ("useless\n");
 
470
                        cd_debug ("useless\n");
474
471
                        return ;
475
472
                }
476
473
        }
477
 
        g_print ("myData.iCurrentFilter  <- %d\n", myData.iCurrentFilter);
 
474
        cd_debug ("myData.iCurrentFilter  <- %d\n", myData.iCurrentFilter);
478
475
        
479
476
        // on cherche les nouveaux resultats correpondants.
480
477
        cd_do_launch_all_backends ();  // relance le locate seulement si necessaire.
491
488
 
492
489
void cd_do_show_current_sub_listing (void)
493
490
{
494
 
        g_print ("%s ()\n", __func__);
 
491
        cd_debug ("%s ()\n", __func__);
495
492
        if (myData.pListing->pCurrentEntry == NULL)
496
493
                return ;
497
494
        if (myData.pListingHistory == NULL)  // on sauvegarde le texte de la recherche principale.
540
537
 
541
538
void cd_do_show_previous_listing (void)
542
539
{
543
 
        g_print ("%s ()\n", __func__);
 
540
        cd_debug ("%s ()\n", __func__);
544
541
        if (myData.pListingHistory == NULL)  // on n'est pas dans un sous-listing.
545
542
                return ;
546
543
        
584
581
 
585
582
void cd_do_filter_current_listing (void)
586
583
{
587
 
        g_print ("%s ()\n", __func__);
 
584
        cd_debug ("%s ()\n", __func__);
588
585
        if (myData.pListing == NULL || myData.pListing->pEntries == NULL)
589
586
                return ;
590
587