diff options
Diffstat (limited to 'sfx2/source/appl/shutdowniconunx.cxx')
-rw-r--r-- | sfx2/source/appl/shutdowniconunx.cxx | 80 |
1 files changed, 18 insertions, 62 deletions
diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx index 2de5654fe28a..fc2921cb788e 100644 --- a/sfx2/source/appl/shutdowniconunx.cxx +++ b/sfx2/source/appl/shutdowniconunx.cxx @@ -27,8 +27,6 @@ #include <glib.h> #include <osl/mutex.hxx> #include <osl/module.hxx> -#include <vcl/bitmapex.hxx> -#include <vcl/bmpacc.hxx> #include "tools/rc.hxx" #include <sfx2/app.hxx> #include "app.hrc" @@ -42,9 +40,6 @@ #endif // Cut/paste from vcl/inc/svids.hrc -#define SV_ICON_SMALL_START 25000 - -#define SV_ICON_ID_OFFICE 1 #define SV_ICON_ID_TEXT 2 #define SV_ICON_ID_SPREADSHEET 4 #define SV_ICON_ID_DRAWING 6 @@ -108,57 +103,6 @@ static void menu_deactivate_cb( GtkWidget *pMenu ) gtk_menu_popdown( GTK_MENU( pMenu ) ); } -static GdkPixbuf * ResIdToPixbuf( sal_uInt16 nResId ) -{ - ResId aResId( nResId, *pVCLResMgr ); - BitmapEx aIcon( aResId ); - Bitmap pInSalBitmap = aIcon.GetBitmap(); - AlphaMask pInSalAlpha = aIcon.GetAlpha(); - - if( pInSalBitmap.GetBitCount() != 24 ) - pInSalBitmap.Convert( BMP_CONVERSION_24BIT ); - - Bitmap::ScopedReadAccess pSalBitmap(pInSalBitmap); - AlphaMask::ScopedReadAccess pSalAlpha(pInSalAlpha); - - g_return_val_if_fail( pSalBitmap, NULL ); - - Size aSize( pSalBitmap->Width(), pSalBitmap->Height() ); - if (pSalAlpha) - g_return_val_if_fail( Size( pSalAlpha->Width(), pSalAlpha->Height() ) == aSize, NULL ); - - int nX, nY; - guchar *pPixbufData = static_cast<guchar *>(g_malloc( 4 * aSize.Width() * aSize.Height() )); - guchar *pDestData = pPixbufData; - - for( nY = 0; nY < pSalBitmap->Height(); nY++ ) - { - for( nX = 0; nX < pSalBitmap->Width(); nX++ ) - { - BitmapColor aPix; - aPix = pSalBitmap->GetPixel( nY, nX ); - pDestData[0] = aPix.GetRed(); - pDestData[1] = aPix.GetGreen(); - pDestData[2] = aPix.GetBlue(); - if (pSalAlpha) - { - aPix = pSalAlpha->GetPixel( nY, nX ); - pDestData[3] = 255 - aPix.GetIndex(); - } - else - pDestData[3] = 255; - pDestData += 4; - } - } - - return gdk_pixbuf_new_from_data( pPixbufData, - GDK_COLORSPACE_RGB, sal_True, 8, - aSize.Width(), aSize.Height(), - aSize.Width() * 4, - reinterpret_cast<GdkPixbufDestroyNotify>(g_free), - NULL ); -} - extern "C" { static void oustring_delete (gpointer data, GClosure * /* closure */) @@ -183,10 +127,24 @@ static void add_item( GtkMenuShell *pMenuShell, const char *pAsciiURL, RTL_TEXTENCODING_UTF8); } - GdkPixbuf *pPixbuf = ResIdToPixbuf( SV_ICON_SMALL_START + nResId ); - GtkWidget *pImage = gtk_image_new_from_pixbuf( pPixbuf ); - g_object_unref( G_OBJECT( pPixbuf ) ); + gchar* appicon; + + if (nResId == SV_ICON_ID_TEXT) + appicon = g_strdup ("libreoffice-writer"); + else if (nResId == SV_ICON_ID_SPREADSHEET) + appicon = g_strdup ("libreoffice-calc"); + else if (nResId == SV_ICON_ID_DRAWING) + appicon = g_strdup ("libreoffice-draw"); + else if (nResId == SV_ICON_ID_PRESENTATION) + appicon = g_strdup ("libreoffice-impress"); + else if (nResId == SV_ICON_ID_DATABASE) + appicon = g_strdup ("libreoffice-base"); + else if (nResId == SV_ICON_ID_FORMULA) + appicon = g_strdup ("libreoffice-math"); + else + appicon = g_strdup ("libreoffice-main"); + GtkWidget *pImage = gtk_image_new_from_icon_name (appicon, GTK_ICON_SIZE_MENU); GtkWidget *pMenuItem = gtk_image_menu_item_new_with_label( aLabel.getStr() ); gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM( pMenuItem ), pImage ); g_signal_connect_data( pMenuItem, "activate", pFnCallback, pURL, @@ -383,9 +341,7 @@ void plugin_init_sys_tray() pVCLResMgr = ResMgr::CreateResMgr("vcl"); - GdkPixbuf *pPixbuf = ResIdToPixbuf( SV_ICON_SMALL_START + SV_ICON_ID_OFFICE ); - pTrayIcon = gtk_status_icon_new_from_pixbuf(pPixbuf); - g_object_unref( pPixbuf ); + pTrayIcon = gtk_status_icon_new_from_icon_name ("libreoffice-main"); g_object_set (pTrayIcon, "title", aLabel.getStr(), "tooltip_text", aLabel.getStr(), NULL); |