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

« back to all changes in this revision

Viewing changes to src/cairo-dock-gui-filter.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe), Matthieu Baerts (matttbe), Didier Roche
  • Date: 2010-03-01 21:24:00 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100301212400-3a3csog6eonse3in
Tags: 2.1.3-6-0ubuntu1
[ Matthieu Baerts (matttbe) ]
* New Upstream Version. (LP: #521534)
* Updated debian/watch and debian/copyright with LP account.
* Removed debian/patches/02-merge-changelog.patch'
 - data/ChangeLog.txt has to respect a syntax and is used by CD.
* debian/cairo-dock.1:
 - Updated with the latest release.
 - The domain name 'cairo-dock.org' has changed to 'glx-dock.org'
* debian/control:
 - Changed the homepage and other links (glx-dock.org)
 - Updated cairo-dock-dev architecture to 'all' (it no longer contains compiled files)
* debian/cairo-dock-dev.install
 - libcairo-dock.a and libcairo-dock.so no longer exist
* debian/rules
 - removed uneeded changelog file
* Updated debian/patches/01-desktop-file-category.patch

[ Didier Roche ]
* Fix debian/watch
* Fix some issue in versionning
* debian/control: clean the packaging and add right -plugins depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
* This file is a part of the Cairo-Dock project
3
 
*
4
 
* Copyright : (C) see the 'copyright' file.
5
 
* E-mail    : see the 'copyright' file.
6
 
*
7
 
* This program is free software; you can redistribute it and/or
8
 
* modify it under the terms of the GNU General Public License
9
 
* as published by the Free Software Foundation; either version 3
10
 
* of the License, or (at your option) any later version.
11
 
*
12
 
* This program is distributed in the hope that it will be useful,
13
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
* GNU General Public License for more details.
16
 
* You should have received a copy of the GNU General Public License
17
 
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
*/
19
 
 
20
 
#include <string.h>
21
 
#include <unistd.h>
22
 
#define __USE_XOPEN_EXTENDED
23
 
#include <stdlib.h>
24
 
#include <glib/gi18n.h>
25
 
 
26
 
#include "cairo-dock-modules.h"
27
 
#include "cairo-dock-log.h"
28
 
#include "cairo-dock-keyfile-utilities.h"
29
 
#include "cairo-dock-gui-manager.h"
30
 
#include "cairo-dock-gui-factory.h"
31
 
#include "cairo-dock-gui-filter.h"
32
 
 
33
 
extern gchar *g_cConfFile;
34
 
 
35
 
static GString *sBuffer = NULL;
36
 
static inline void _copy_string_to_buffer (const gchar *cSentence)
37
 
{
38
 
        g_string_assign (sBuffer, cSentence);
39
 
        gchar *str;
40
 
        for (str = sBuffer->str; *str != '\0'; str ++)
41
 
        {
42
 
                if (*str >= 'A' && *str <= 'Z')
43
 
                {
44
 
                        *str = *str - 'A' + 'a';
45
 
                }
46
 
        }
47
 
}
48
 
#define _search_in_buffer(cKeyWord) g_strstr_len (sBuffer->str, -1, cKeyWord)
49
 
static gchar *cairo_dock_highlight_key_word (const gchar *cSentence, const gchar *cKeyWord, gboolean bBold)
50
 
{
51
 
        //_copy_string_to_buffer (cSentence);
52
 
        gchar *cModifiedString = NULL;
53
 
        gchar *str = _search_in_buffer (cKeyWord);
54
 
        if (str != NULL)
55
 
        {
56
 
                //g_print ("* trouve %s dans '%s'\n", cKeyWord, sBuffer->str);
57
 
                gchar *cBuffer = g_strdup (cSentence);
58
 
                str = cBuffer + (str - sBuffer->str);
59
 
                *str = '\0';
60
 
                cModifiedString = g_strdup_printf ("%s<span color=\"red\">%s%s%s</span>%s", cBuffer, (bBold?"<b>":""), cKeyWord, (bBold?"</b>":""), str + strlen (cKeyWord));
61
 
                g_free (cBuffer);
62
 
        }
63
 
        
64
 
        return cModifiedString;
65
 
}
66
 
 
67
 
static gboolean _cairo_dock_search_words_in_frame_title (gchar **pKeyWords, GtkWidget *pCurrentFrame, gboolean bAllWords, gboolean bHighLightText, gboolean bHideOther)
68
 
{
69
 
        //\______________ On recupere son titre.
70
 
        GtkWidget *pFrameLabel = NULL;
71
 
        GtkWidget *pLabelContainer = (GTK_IS_FRAME (pCurrentFrame) ?
72
 
                gtk_frame_get_label_widget (GTK_FRAME (pCurrentFrame)) :
73
 
                gtk_expander_get_label_widget (GTK_EXPANDER (pCurrentFrame)));
74
 
        //g_print ("pLabelContainer : %x\n", pLabelContainer);
75
 
        if (GTK_IS_LABEL (pLabelContainer))
76
 
        {
77
 
                pFrameLabel = pLabelContainer;
78
 
        }
79
 
        else if (pLabelContainer != NULL)
80
 
        {
81
 
                GList *pChildList = gtk_container_get_children (GTK_CONTAINER (pLabelContainer));
82
 
                if (pChildList != NULL && pChildList->next != NULL)
83
 
                        pFrameLabel = pChildList->next->data;
84
 
        }
85
 
        
86
 
        //\______________ On cherche les mots-cles dedans.
87
 
        gchar *cModifiedText = NULL, *str = NULL, *cKeyWord;
88
 
        gboolean bFoundInFrameTitle = FALSE;
89
 
        if (pFrameLabel != NULL)
90
 
        {
91
 
                const gchar *cFrameTitle = gtk_label_get_text (GTK_LABEL (pFrameLabel));
92
 
                int i;
93
 
                for (i = 0; pKeyWords[i] != NULL; i ++)
94
 
                {
95
 
                        cKeyWord = pKeyWords[i];
96
 
                        _copy_string_to_buffer (cFrameTitle);
97
 
                        if (bHighLightText)
98
 
                                cModifiedText = cairo_dock_highlight_key_word (cFrameTitle, cKeyWord, TRUE);
99
 
                        else
100
 
                                str = _search_in_buffer (cKeyWord);
101
 
                        if (cModifiedText != NULL || str != NULL)  // on a trouve ce mot.
102
 
                        {
103
 
                                //g_print ("  on a trouve %s dans le titre\n", cKeyWord);
104
 
                                bFoundInFrameTitle = TRUE;
105
 
                                if (cModifiedText != NULL)
106
 
                                {
107
 
                                        gtk_label_set_markup (GTK_LABEL (pFrameLabel), cModifiedText);
108
 
                                        cFrameTitle = gtk_label_get_label (GTK_LABEL (pFrameLabel));  // Pango inclus.
109
 
                                        g_free (cModifiedText);
110
 
                                        cModifiedText = NULL;
111
 
                                }
112
 
                                else
113
 
                                        str = NULL;
114
 
                                if (! bAllWords)
115
 
                                        break ;
116
 
                        }
117
 
                        else if (bAllWords)
118
 
                        {
119
 
                                bFoundInFrameTitle = FALSE;
120
 
                                break ;
121
 
                        }
122
 
                }
123
 
                if (! bFoundInFrameTitle)  // on remet le texte par defaut.
124
 
                {
125
 
                        cModifiedText = g_strdup_printf ("<b>%s</b>", cFrameTitle);
126
 
                        gtk_label_set_markup (GTK_LABEL (pFrameLabel), cModifiedText);
127
 
                        g_free (cModifiedText);
128
 
                        cModifiedText = NULL;
129
 
                }
130
 
        }
131
 
        return bFoundInFrameTitle;
132
 
}
133
 
 
134
 
 
135
 
void cairo_dock_apply_filter_on_group_widget (gchar **pKeyWords, gboolean bAllWords, gboolean bSearchInToolTip, gboolean bHighLightText, gboolean bHideOther, GSList *pWidgetList)
136
 
{
137
 
        //g_print ("%s ()\n", __func__);
138
 
        if (sBuffer == NULL)
139
 
                sBuffer = g_string_new ("");
140
 
        gpointer *pGroupKeyWidget;
141
 
        GList *pSubWidgetList;
142
 
        GtkWidget *pLabel, *pKeyBox, *pVBox, *pFrame, *pCurrentFrame = NULL, *pExpander;
143
 
        const gchar *cDescription;
144
 
        gchar *cToolTip = NULL;
145
 
        gchar *cModifiedText=NULL, *str=NULL;
146
 
        gboolean bFound, bFrameVisible = !bHideOther;
147
 
        int i;
148
 
        gchar *cKeyWord;
149
 
        GSList *w;
150
 
        for (w = pWidgetList; w != NULL; w = w->next)
151
 
        {
152
 
                bFound = FALSE;
153
 
                pGroupKeyWidget = w->data;
154
 
                //g_print ("widget : %s - %s\n", pGroupKeyWidget[0], pGroupKeyWidget[1]);
155
 
                pSubWidgetList = pGroupKeyWidget[2];
156
 
                if (pSubWidgetList == NULL)
157
 
                        continue;
158
 
                pLabel = pGroupKeyWidget[4];
159
 
                if (pLabel == NULL)
160
 
                        continue;
161
 
                pKeyBox = pGroupKeyWidget[5];
162
 
                if (pKeyBox == NULL)
163
 
                        continue;
164
 
                pVBox = gtk_widget_get_parent (pKeyBox);
165
 
                pFrame = gtk_widget_get_parent (pVBox);
166
 
                
167
 
                //\______________ On cache une frame vide, ou au contraire on montre son contenu si elle contient les mots-cles.
168
 
                if (pFrame != pCurrentFrame)  // on a change de frame.
169
 
                {
170
 
                        if (pCurrentFrame)
171
 
                        {
172
 
                                gboolean bFoundInFrameTitle = _cairo_dock_search_words_in_frame_title (pKeyWords, pCurrentFrame, bAllWords, bHighLightText, bHideOther);
173
 
                                if (! bFrameVisible && bHideOther)
174
 
                                {
175
 
                                        if (! bFoundInFrameTitle)
176
 
                                                gtk_widget_hide (pCurrentFrame);
177
 
                                        else
178
 
                                                gtk_widget_show_all (pCurrentFrame);  // montre tous les widgets du groupe.
179
 
                                }
180
 
                                else
181
 
                                        gtk_widget_show (pCurrentFrame);
182
 
                        }
183
 
                        
184
 
                        if (GTK_IS_FRAME (pFrame))  // devient la frame courante.
185
 
                        {
186
 
                                pExpander = gtk_widget_get_parent (pFrame);
187
 
                                if (GTK_IS_EXPANDER (pExpander))
188
 
                                        pFrame = pExpander;  // c'est l'expander qui a le texte, c'est donc ca qu'on veut cacher.
189
 
                                pCurrentFrame = pFrame;
190
 
                                bFrameVisible = FALSE;
191
 
                        }
192
 
                        else
193
 
                        {
194
 
                                pCurrentFrame = NULL;
195
 
                        }
196
 
                        //g_print ("pCurrentFrame <- %x\n", pCurrentFrame);
197
 
                }
198
 
                
199
 
                cDescription = gtk_label_get_text (GTK_LABEL (pLabel));  // sans les markup Pango.
200
 
                if (bSearchInToolTip)
201
 
                        cToolTip = gtk_widget_get_tooltip_text (pKeyBox);
202
 
                //g_print ("cDescription : %s (%s)\n", cDescription, cToolTip);
203
 
                
204
 
                bFound = FALSE;
205
 
                for (i = 0; pKeyWords[i] != NULL; i ++)
206
 
                {
207
 
                        cKeyWord = pKeyWords[i];
208
 
                        _copy_string_to_buffer (cDescription);
209
 
                        if (bHighLightText)
210
 
                                cModifiedText = cairo_dock_highlight_key_word (cDescription, cKeyWord, FALSE);
211
 
                        else
212
 
                                str = _search_in_buffer (cKeyWord);
213
 
                        if (cModifiedText == NULL && str == NULL)
214
 
                        {
215
 
                                if (cToolTip != NULL)
216
 
                                {
217
 
                                        _copy_string_to_buffer (cToolTip);
218
 
                                        str = _search_in_buffer (cKeyWord);
219
 
                                }
220
 
                        }
221
 
                        
222
 
                        if (cModifiedText != NULL || str != NULL)
223
 
                        {
224
 
                                //g_print ("  on a trouve %s\n", cKeyWord);
225
 
                                bFound = TRUE;
226
 
                                if (cModifiedText != NULL)
227
 
                                {
228
 
                                        gtk_label_set_markup (GTK_LABEL (pLabel), cModifiedText);
229
 
                                        cDescription = gtk_label_get_label (GTK_LABEL (pLabel));  // Pango inclus.
230
 
                                        g_free (cModifiedText);
231
 
                                        cModifiedText = NULL;
232
 
                                }
233
 
                                else
234
 
                                {
235
 
                                        gtk_label_set_text (GTK_LABEL (pLabel), cDescription);
236
 
                                        str = NULL;
237
 
                                }
238
 
                                if (! bAllWords)
239
 
                                        break ;
240
 
                        }
241
 
                        else if (bAllWords)
242
 
                        {
243
 
                                bFound = FALSE;
244
 
                                break ;
245
 
                        }
246
 
                }
247
 
                if (bFound)
248
 
                {
249
 
                        //g_print ("on montre ce widget\n");
250
 
                        gtk_widget_show (pKeyBox);
251
 
                        if (pCurrentFrame != NULL)
252
 
                                bFrameVisible = TRUE;
253
 
                }
254
 
                else if (bHideOther)
255
 
                {
256
 
                        //g_print ("on cache ce widget\n");
257
 
                        gtk_widget_hide (pKeyBox);
258
 
                }
259
 
                else
260
 
                        gtk_widget_show (pKeyBox);
261
 
                g_free (cToolTip);
262
 
        }
263
 
        if (pCurrentFrame)  // la derniere frame.
264
 
        {
265
 
                gboolean bFoundInFrameTitle = _cairo_dock_search_words_in_frame_title (pKeyWords, pCurrentFrame, bAllWords, bHighLightText, bHideOther);
266
 
                if (! bFrameVisible && bHideOther)
267
 
                {
268
 
                        if (! bFoundInFrameTitle)
269
 
                                gtk_widget_hide (pCurrentFrame);
270
 
                        else
271
 
                                gtk_widget_show_all (pCurrentFrame);  // montre tous les widgets du groupe.
272
 
                }
273
 
                else
274
 
                        gtk_widget_show (pCurrentFrame);
275
 
        }
276
 
}
277
 
 
278
 
void cairo_dock_apply_filter_on_group_list (gchar **pKeyWords, gboolean bAllWords, gboolean bSearchInToolTip, gboolean bHighLightText, gboolean bHideOther, GList *pGroupDescriptionList)
279
 
{
280
 
        //g_print ("%s ()\n", __func__);
281
 
        if (sBuffer == NULL)
282
 
                sBuffer = g_string_new ("");
283
 
        CairoDockGroupDescription *pGroupDescription, *pInternalGroupDescription;
284
 
        gchar *cKeyWord, *str = NULL, *cModifiedText = NULL, *cDescription, *cToolTip = NULL;
285
 
        gboolean bFound, bFrameVisible;
286
 
        GtkWidget *pGroupBox, *pLabel, *pCategoryFrame, *pCurrentCategoryFrame = NULL;
287
 
        GKeyFile *pKeyFile;
288
 
        GKeyFile *pMainKeyFile = cairo_dock_open_key_file (g_cConfFile);
289
 
        
290
 
        int i;
291
 
        GList *gd;
292
 
        const gchar *cGettextDomain;
293
 
        for (gd = pGroupDescriptionList; gd != NULL; gd = gd->next)
294
 
        {
295
 
                pGroupDescription = gd->data;
296
 
                pGroupDescription->bMatchFilter = FALSE;
297
 
        }
298
 
        for (gd = pGroupDescriptionList; gd != NULL; gd = gd->next)
299
 
        {
300
 
                //g_print ("pGroupDescription:%x\n", gd->data);
301
 
                //\_______________ On recupere le group description.
302
 
                pGroupDescription = gd->data;
303
 
                
304
 
                if (pGroupDescription->cInternalModule)
305
 
                {
306
 
                        g_print ("%s : bouton emprunte a %s\n", pGroupDescription->cGroupName, pGroupDescription->cInternalModule);
307
 
                        pInternalGroupDescription = cairo_dock_find_module_description (pGroupDescription->cInternalModule);
308
 
                        if (pInternalGroupDescription != NULL)
309
 
                                pGroupBox = gtk_widget_get_parent (pInternalGroupDescription->pActivateButton);
310
 
                        else
311
 
                                continue;
312
 
                        pLabel = pInternalGroupDescription->pLabel;
313
 
                        g_print ("ok, found pGroupBox\n");
314
 
                }
315
 
                else
316
 
                {
317
 
                        pGroupBox = gtk_widget_get_parent (pGroupDescription->pActivateButton);
318
 
                        pLabel = pGroupDescription->pLabel;
319
 
                }
320
 
                //g_print ("  %x\n", pGroupDescription->pActivateButton);
321
 
                pCategoryFrame = gtk_widget_get_parent (pGroupBox);
322
 
                cGettextDomain = pGroupDescription->cGettextDomain;
323
 
                bFound = FALSE;
324
 
                
325
 
                cDescription = dgettext (cGettextDomain, pGroupDescription->cGroupName);
326
 
                if (bSearchInToolTip)
327
 
                        cToolTip = dgettext (cGettextDomain, pGroupDescription->cDescription);
328
 
                //g_print ("cDescription : %s (%s)(%x,%x)\n", cDescription, cToolTip, cModifiedText, str);
329
 
                
330
 
                //\_______________ On change de frame.
331
 
                if (pCategoryFrame != pCurrentCategoryFrame)  // on a change de frame.
332
 
                {
333
 
                        if (pCurrentCategoryFrame)
334
 
                        {
335
 
                                if (! bFrameVisible && bHideOther)
336
 
                                {
337
 
                                        //g_print (" on cache cette categorie\n");
338
 
                                        gtk_widget_hide (pCurrentCategoryFrame);
339
 
                                }
340
 
                                else
341
 
                                        gtk_widget_show (pCurrentCategoryFrame);
342
 
                        }
343
 
                        pCurrentCategoryFrame = pCategoryFrame;
344
 
                        //g_print (" pCurrentCategoryFrame <- %x\n", pCurrentCategoryFrame);
345
 
                }
346
 
                
347
 
                //\_______________ On cherche chaque mot dans la description du module.
348
 
                for (i = 0; pKeyWords[i] != NULL; i ++)
349
 
                {
350
 
                        cKeyWord = pKeyWords[i];
351
 
                        _copy_string_to_buffer (cDescription);
352
 
                        if (bHighLightText)
353
 
                                cModifiedText = cairo_dock_highlight_key_word (cDescription, cKeyWord, TRUE);
354
 
                        else
355
 
                                str = _search_in_buffer (cKeyWord);
356
 
                        if (cModifiedText == NULL && str == NULL)
357
 
                        {
358
 
                                if (cToolTip != NULL)
359
 
                                {
360
 
                                        _copy_string_to_buffer (cToolTip);
361
 
                                        str = _search_in_buffer (cKeyWord);
362
 
                                }
363
 
                        }
364
 
                        
365
 
                        if (cModifiedText != NULL || str != NULL)
366
 
                        {
367
 
                                //g_print (">>> on a trouve direct %s\n", cKeyWord);
368
 
                                bFound = TRUE;
369
 
                                if (cModifiedText != NULL)
370
 
                                {
371
 
                                        gtk_label_set_use_markup (GTK_LABEL (pLabel), TRUE);
372
 
                                        gtk_label_set_markup (GTK_LABEL (pLabel), cModifiedText);
373
 
                                        g_free (cModifiedText);
374
 
                                        cModifiedText = NULL;
375
 
                                }
376
 
                                else
377
 
                                {
378
 
                                        gtk_label_set_text (GTK_LABEL (pLabel), cDescription);
379
 
                                        str = NULL;
380
 
                                }
381
 
                                if (! bAllWords)
382
 
                                        break ;
383
 
                        }
384
 
                        else if (bAllWords)
385
 
                        {
386
 
                                bFound = FALSE;
387
 
                                break ;
388
 
                        }
389
 
                }
390
 
                
391
 
                //\_______________ On cherche chaque mot a l'interieur du module.
392
 
                if (! bFound && pGroupDescription->cOriginalConfFilePath != NULL)
393
 
                {
394
 
                        //\_______________ On recupere les groupes du module.
395
 
                        //g_print ("* on cherche dans le fichier de conf %s ...\n", pGroupDescription->cOriginalConfFilePath);
396
 
                        gchar **pGroupList = NULL;
397
 
                        CairoDockModule *pModule = cairo_dock_find_module_from_name (pGroupDescription->cGroupName);
398
 
                        if (pModule != NULL)
399
 
                        {
400
 
                                pKeyFile = cairo_dock_open_key_file (pModule->cConfFilePath);
401
 
                                if (pKeyFile != NULL)
402
 
                                {
403
 
                                        gsize length = 0;
404
 
                                        pGroupList = g_key_file_get_groups (pKeyFile, &length);
405
 
                                }
406
 
                        }
407
 
                        else  // groupe interne, le fichier de conf n'est ouvert qu'une seule fois.
408
 
                        {
409
 
                                pKeyFile = pMainKeyFile;
410
 
                                pGroupList = g_new0 (gchar *, 2);
411
 
                                pGroupList[0] = g_strdup (pGroupDescription->cGroupName);
412
 
                        }
413
 
                        
414
 
                        //\_______________ Pour chaque groupe on parcourt toutes les cles.
415
 
                        if (pGroupList != NULL)
416
 
                        {
417
 
                                int iNbWords;
418
 
                                for (iNbWords = 0; pKeyWords[iNbWords] != NULL; iNbWords ++);
419
 
                                gboolean *bFoundWords = g_new0 (gboolean , iNbWords);
420
 
                                
421
 
                                gchar *cUsefulComment;
422
 
                                gchar iElementType;
423
 
                                int iNbElements;
424
 
                                gchar **pAuthorizedValuesList;
425
 
                                gchar *cTipString;
426
 
                                gboolean bIsAligned;
427
 
                                gchar **pKeyList;
428
 
                                gchar *cGroupName, *cKeyName, *cKeyComment;
429
 
                                int j, k;
430
 
                                for (k = 0; pGroupList[k] != NULL; k ++)
431
 
                                {
432
 
                                        cGroupName = pGroupList[k];
433
 
                                        pKeyList = g_key_file_get_keys (pKeyFile, cGroupName, NULL, NULL);
434
 
                                        for (j = 0; pKeyList[j] != NULL; j ++)
435
 
                                        {
436
 
                                                cKeyName = pKeyList[j];
437
 
                                                //\_______________ On recupere la description + bulle d'aide de la cle.
438
 
                                                cKeyComment =  g_key_file_get_comment (pKeyFile, cGroupName, cKeyName, NULL);
439
 
                                                cUsefulComment = cairo_dock_parse_key_comment (cKeyComment, &iElementType, &iNbElements, &pAuthorizedValuesList, &bIsAligned, &cTipString);
440
 
                                                if (cUsefulComment == NULL)
441
 
                                                {
442
 
                                                        g_free (cKeyComment);
443
 
                                                        continue;
444
 
                                                }
445
 
                                                
446
 
                                                cUsefulComment = dgettext (cGettextDomain, cUsefulComment);
447
 
                                                if (cTipString != NULL)
448
 
                                                {
449
 
                                                        if (bSearchInToolTip)
450
 
                                                                cTipString = dgettext (cGettextDomain, cTipString);
451
 
                                                        else
452
 
                                                                cTipString = NULL;
453
 
                                                }
454
 
                                                //\_______________ On y cherche les mots-cles.
455
 
                                                for (i = 0; pKeyWords[i] != NULL; i ++)
456
 
                                                {
457
 
                                                        if (bFoundWords[i])
458
 
                                                                continue;
459
 
                                                        cKeyWord = pKeyWords[i];
460
 
                                                        str = NULL;
461
 
                                                        if (cUsefulComment)
462
 
                                                        {
463
 
                                                                _copy_string_to_buffer (cUsefulComment);
464
 
                                                                str = _search_in_buffer (cKeyWord);
465
 
                                                        }
466
 
                                                        if (! str && cTipString)
467
 
                                                        {
468
 
                                                                _copy_string_to_buffer (cTipString);
469
 
                                                                str = _search_in_buffer (cKeyWord);
470
 
                                                        }
471
 
                                                        if (! str && pAuthorizedValuesList)
472
 
                                                        {
473
 
                                                                int l;
474
 
                                                                for (l = 0; pAuthorizedValuesList[l] != NULL; l ++)
475
 
                                                                {
476
 
                                                                        _copy_string_to_buffer (dgettext (cGettextDomain, pAuthorizedValuesList[l]));
477
 
                                                                        str = _search_in_buffer (cKeyWord);
478
 
                                                                        if (str != NULL)
479
 
                                                                                break ;
480
 
                                                                }
481
 
                                                        }
482
 
                                                        
483
 
                                                        if (str != NULL)
484
 
                                                        {
485
 
                                                                //g_print (">>>on a trouve %s\n", pKeyWords[i]);
486
 
                                                                bFound = TRUE;
487
 
                                                                str = NULL;
488
 
                                                                if (! bAllWords)
489
 
                                                                {
490
 
                                                                        break ;
491
 
                                                                }
492
 
                                                                bFoundWords[i] = TRUE;
493
 
                                                        }
494
 
                                                }
495
 
                                                
496
 
                                                g_free (cKeyComment);
497
 
                                                if (! bAllWords && bFound)
498
 
                                                        break ;
499
 
                                        }  // fin de parcours du groupe.
500
 
                                        g_strfreev (pKeyList);
501
 
                                        if (! bAllWords && bFound)
502
 
                                                break ;
503
 
                                }  // fin de parcours des groupes.
504
 
                                g_strfreev (pGroupList);
505
 
                                
506
 
                                if (bAllWords && bFound)
507
 
                                {
508
 
                                        for (i = 0; i < iNbWords; i ++)
509
 
                                        {
510
 
                                                if (! bFoundWords[i])
511
 
                                                {
512
 
                                                        //g_print ("par contre il manque %s, dommage\n", pKeyWords[i]);
513
 
                                                        bFound = FALSE;
514
 
                                                        break;
515
 
                                                }
516
 
                                        }
517
 
                                }
518
 
                                g_free (bFoundWords);
519
 
                        }  // fin du cas ou on avait des groupes a etudier.
520
 
                        if (pKeyFile != pMainKeyFile)
521
 
                                g_key_file_free (pKeyFile);
522
 
                        //g_print ("bFound : %d\n", bFound);
523
 
                        
524
 
                        if (bHighLightText && bFound)  // on passe le label du groupe en bleu + gras.
525
 
                        {
526
 
                                cModifiedText = g_strdup_printf ("<b><span color=\"blue\">%s</span></b>", cDescription);
527
 
                                //g_print ("cModifiedText : %s\n", cModifiedText);
528
 
                                gtk_label_set_markup (GTK_LABEL (pLabel), dgettext (cGettextDomain, cModifiedText));
529
 
                                g_free (cModifiedText);
530
 
                                cModifiedText = NULL;
531
 
                        }
532
 
                }  // fin du cas ou on devait chercher dans le groupe.
533
 
 
534
 
                if (pGroupDescription->cInternalModule)
535
 
                {
536
 
                        pInternalGroupDescription = cairo_dock_find_module_description (pGroupDescription->cInternalModule);
537
 
                        if (pInternalGroupDescription != NULL)
538
 
                        {
539
 
                                pInternalGroupDescription->bMatchFilter |= bFound;
540
 
                                bFound = pInternalGroupDescription->bMatchFilter;
541
 
                        }
542
 
                }
543
 
                else
544
 
                {
545
 
                        pGroupDescription->bMatchFilter |= bFound;
546
 
                        bFound = pGroupDescription->bMatchFilter;
547
 
                }
548
 
                if (bFound)
549
 
                {
550
 
                        //g_print ("on montre ce groupe\n");
551
 
                        gtk_widget_show (pGroupBox);
552
 
                        if (pCurrentCategoryFrame != NULL)
553
 
                                bFrameVisible = TRUE;
554
 
                }
555
 
                else if (bHideOther)
556
 
                {
557
 
                        //g_print ("on cache ce groupe (%s)\n", pGroupDescription->cGroupName);
558
 
                        gtk_widget_hide (pGroupBox);
559
 
                }
560
 
                else
561
 
                        gtk_widget_show (pGroupBox);
562
 
                if (! bHighLightText || ! bFound)
563
 
                {
564
 
                        gtk_label_set_markup (GTK_LABEL (pLabel), dgettext (cGettextDomain, cDescription));
565
 
                }
566
 
        }
567
 
        g_key_file_free (pMainKeyFile);
568
 
}