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

« back to all changes in this revision

Viewing changes to stack/src/applet-load-icons.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2011-04-20 20:46:51 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20110420204651-ftnpzesj6uc7qeul
Tags: 2.3.0~1-0ubuntu1
* New Upstream Version (LP: #723995)
* Upstream short ChangeLog (since 2.3.0~0rc1):
 - Updated translations
 - Updated the integration of the new versions of kwin and compiz
    (Switcher, ShowDesktop, etc.)
 - Removed a lot of useless g_print
 - Updated a few plug-ins to fit with the new version of the API (gldit)
 - Fixed a few bugs
 - Updated MeMenu, MessagingMenu and Status-Notifier to works
    with the latest version of dbusmenu, etc.
* Switch to dpkg-source 3.0 (quilt) format
* debian/cairo-dock-plug-ins.install:
 - Added new files (interfaces for python, ruby, vala and mono)
* debian/control:
 - Added new dependences for new applets (sensors and zeitgeist)
    and new interfaces (python, valac, ruby and mono)
 - Updated the version of cairo-dock build-dependences
* debian/rules:
 - Added a new CMake flag to install python interface in debian/tmp
* Updated debian/watch

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        
41
41
        return FALSE; //We didn't found anything
42
42
}
 
43
static void _load_html_icon (Icon *pIcon)
 
44
{
 
45
        CairoDockModuleInstance *myApplet = pIcon->pAppletOwner;
 
46
        int iWidth = pIcon->iImageWidth;
 
47
        int iHeight = pIcon->iImageHeight;
 
48
        if (pIcon->cFileName)  // icone possedant une image, on affiche celle-ci.
 
49
        {
 
50
                gchar *cIconPath = cairo_dock_search_icon_s_path (pIcon->cFileName);
 
51
                if (cIconPath != NULL && *cIconPath != '\0')
 
52
                {
 
53
                        pIcon->pIconBuffer = cairo_dock_create_surface_from_image_simple (cIconPath,
 
54
                                iWidth,
 
55
                                iHeight);
 
56
                        
 
57
                        if (pIcon->pIconBuffer != NULL && pIcon->cWorkingDirectory != NULL)
 
58
                        {
 
59
                                if (g_bUseOpenGL)
 
60
                                        pIcon->iIconTexture  = cairo_dock_create_texture_from_surface (pIcon->pIconBuffer);  // we need to load the texture now, since we'll draw the emblem on it.
 
61
                                
 
62
                                CairoContainer *pContainer = CD_APPLET_MY_ICONS_LIST_CONTAINER;
 
63
                                
 
64
                                CairoEmblem *pEmblem = cairo_dock_make_emblem (pIcon->cWorkingDirectory, pIcon, pContainer);
 
65
                                cairo_dock_set_emblem_position (pEmblem, CAIRO_DOCK_EMBLEM_LOWER_RIGHT);
 
66
                                cairo_dock_draw_emblem_on_icon (pEmblem, pIcon, pContainer);
 
67
                                cairo_dock_free_emblem (pEmblem);
 
68
                        }
 
69
                }
 
70
                g_free (cIconPath);
 
71
        }
 
72
}
43
73
Icon *cd_stack_build_one_icon (CairoDockModuleInstance *myApplet, GKeyFile *pKeyFile)
44
74
{
45
75
        GError *erreur = NULL;
55
85
        Icon *pIcon = NULL;
56
86
        if (cairo_dock_string_is_adress (cContent))
57
87
        {
58
 
                if (strncmp (cContent, "http://", 7) == 0 || strncmp (cContent, "https://", 8) == 0)
 
88
                if (strncmp (cContent, "http://", 7) == 0 || strncmp (cContent, "https://", 8) == 0)  // URL web
59
89
                {
60
90
                        pIcon = cairo_dock_create_dummy_launcher (NULL,
61
91
                                g_strdup (myConfig.cUrlIcon),
62
92
                                cContent,
63
93
                                NULL,
64
94
                                0);
65
 
                        pIcon->iVolumeID = 1;
 
95
                        pIcon->iface.load_image = _load_html_icon;
66
96
                }
67
 
                else
 
97
                else  // URI file
68
98
                {
69
99
                        gchar *cCanonicName=NULL, *cRealURI=NULL, *cIconName=NULL;
70
100
                        gboolean bIsDirectory;
87
117
                                cContent,
88
118
                                NULL,
89
119
                                0);
90
 
                        pIcon->iVolumeID = 1;  // on l'utilisera comme un flag.
91
120
                        g_free (cCanonicName);
92
121
                }
 
122
                pIcon->iVolumeID = 1;  // let's use this as a flag for the URI items.
93
123
        }
94
 
        else
 
124
        else  // text
95
125
        {
96
126
                pIcon = cairo_dock_create_dummy_launcher (NULL,
97
127
                                g_strdup (myConfig.cTextIcon),
129
159
                }
130
160
        }
131
161
        
 
162
        pIcon->cWorkingDirectory = g_key_file_get_string (pKeyFile, "Desktop Entry", "Favicon", NULL);  // we use this parameter to store the favicon path; it's quite dirty, but easier than allocating our own data.
 
163
        
 
164
        pIcon->pAppletOwner = myApplet;
 
165
        
132
166
        return pIcon;
133
167
}
134
168