grim/guifications2

Fix cp gf_config.h.mingw gf_config.h
org.guifications.gf2
2007-05-02, datallah
5e11127271b1
Fix cp gf_config.h.mingw gf_config.h
make -C ./src -f Makefile.mingw
make[1]: Entering directory `/home/datallah/winpidgin/gf2/src'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/datallah/winpidgin/gf2/src'
make -C ./po -f Makefile.mingw
make[1]: Entering directory `/home/datallah/winpidgin/gf2/po'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/datallah/winpidgin/gf2/po'
make -C ./pixmaps -f Makefile.mingw install
make[1]: Entering directory `/home/datallah/winpidgin/gf2/pixmaps'
if test 'item_icon_size_big.png item_icon_size_huge.png item_icon_size_large.png item_icon_size_little.png item_icon_size_normal.png item_icon_size_small.png item_icon_size_tiny.png item_position_center.png item_position_east.png item_position_north_east.png item_position_north.png item_position_north_west.png item_position_south_east.png item_position_south.png item_position_south_west.png item_position_west.png item_text_clipping_ellipsis_end.png item_text_clipping_ellipsis_middle.png item_text_clipping_ellipsis_start.png item_text_clipping_truncate.png window_position_north_east.png window_position_north_west.png window_position_south_east.png window_position_south_west.png'; then \
mkdir -p ../../pidgin/win32-install-dir/pixmaps/pidgin/guifications/conf; \
cp item_icon_size_big.png item_icon_size_huge.png item_icon_size_large.png item_icon_size_little.png item_icon_size_normal.png item_icon_size_small.png item_icon_size_tiny.png item_position_center.png item_position_east.png item_position_north_east.png item_position_north.png item_position_north_west.png item_position_south_east.png item_position_south.png item_position_south_west.png item_position_west.png item_text_clipping_ellipsis_end.png item_text_clipping_ellipsis_middle.png item_text_clipping_ellipsis_start.png item_text_clipping_truncate.png window_position_north_east.png window_position_north_west.png window_position_south_east.png window_position_south_west.png ../../pidgin/win32-install-dir/pixmaps/pidgin/guifications/conf; \
fi;
if test ''; then \
mkdir -p ; \
cp ; \
fi;
make[1]: Leaving directory `/home/datallah/winpidgin/gf2/pixmaps'
make -C ./themes -f Makefile.mingw install
make[1]: Entering directory `/home/datallah/winpidgin/gf2/themes'
make -C ./default -f Makefile.mingw install
make[2]: Entering directory `/home/datallah/winpidgin/gf2/themes/default'
if test 'background.png theme.xml'; then \
mkdir -p ../../../pidgin/win32-install-dir/pixmaps/pidgin/guifications/themes/default; \
cp background.png theme.xml ../../../pidgin/win32-install-dir/pixmaps/pidgin/guifications/themes/default; \
fi;
make[2]: Leaving directory `/home/datallah/winpidgin/gf2/themes/default'
make -C ./mini -f Makefile.mingw install
make[2]: Entering directory `/home/datallah/winpidgin/gf2/themes/mini'
if test 'background.png theme.xml'; then \
mkdir -p ../../../pidgin/win32-install-dir/pixmaps/pidgin/guifications/themes/mini; \
cp background.png theme.xml ../../../pidgin/win32-install-dir/pixmaps/pidgin/guifications/themes/mini; \
fi;
make[2]: Leaving directory `/home/datallah/winpidgin/gf2/themes/mini'
make -C ./Penguins -f Makefile.mingw install
make[2]: Entering directory `/home/datallah/winpidgin/gf2/themes/Penguins'
if test 'penguin.png theme.xml'; then \
mkdir -p ../../../pidgin/win32-install-dir/pixmaps/pidgin/guifications/themes/Penguins; \
cp penguin.png theme.xml ../../../pidgin/win32-install-dir/pixmaps/pidgin/guifications/themes/Penguins; \
fi;
make[2]: Leaving directory `/home/datallah/winpidgin/gf2/themes/Penguins'
make[1]: Leaving directory `/home/datallah/winpidgin/gf2/themes'
make -C ./src -f Makefile.mingw install
make[1]: Entering directory `/home/datallah/winpidgin/gf2/src'
cp guifications.dll ../../pidgin/win32-install-dir/plugins
make[1]: Leaving directory `/home/datallah/winpidgin/gf2/src'
make -C ./po -f Makefile.mingw install
make[1]: Entering directory `/home/datallah/winpidgin/gf2/po'
mkdir -p ../../pidgin/win32-install-dir/locale
installing bn.gmo as ../../pidgin/win32-install-dir/locale/bn/LC_MESSAGES/guifications.mo
installing cs.gmo as ../../pidgin/win32-install-dir/locale/cs/LC_MESSAGES/guifications.mo
installing de.gmo as ../../pidgin/win32-install-dir/locale/de/LC_MESSAGES/guifications.mo
installing en_AU.gmo as ../../pidgin/win32-install-dir/locale/en_AU/LC_MESSAGES/guifications.mo
installing en_GB.gmo as ../../pidgin/win32-install-dir/locale/en_GB/LC_MESSAGES/guifications.mo
installing es.gmo as ../../pidgin/win32-install-dir/locale/es/LC_MESSAGES/guifications.mo
installing fr.gmo as ../../pidgin/win32-install-dir/locale/fr/LC_MESSAGES/guifications.mo
installing gl.gmo as ../../pidgin/win32-install-dir/locale/gl/LC_MESSAGES/guifications.mo
installing he.gmo as ../../pidgin/win32-install-dir/locale/he/LC_MESSAGES/guifications.mo
installing hu.gmo as ../../pidgin/win32-install-dir/locale/hu/LC_MESSAGES/guifications.mo
installing it.gmo as ../../pidgin/win32-install-dir/locale/it/LC_MESSAGES/guifications.mo
installing ja.gmo as ../../pidgin/win32-install-dir/locale/ja/LC_MESSAGES/guifications.mo
installing mk.gmo as ../../pidgin/win32-install-dir/locale/mk/LC_MESSAGES/guifications.mo
installing nl.gmo as ../../pidgin/win32-install-dir/locale/nl/LC_MESSAGES/guifications.mo
installing no.gmo as ../../pidgin/win32-install-dir/locale/no/LC_MESSAGES/guifications.mo
installing pt_BR.gmo as ../../pidgin/win32-install-dir/locale/pt_BR/LC_MESSAGES/guifications.mo
installing pt.gmo as ../../pidgin/win32-install-dir/locale/pt/LC_MESSAGES/guifications.mo
installing ru.gmo as ../../pidgin/win32-install-dir/locale/ru/LC_MESSAGES/guifications.mo
installing sk.gmo as ../../pidgin/win32-install-dir/locale/sk/LC_MESSAGES/guifications.mo
installing sr@Latn.gmo as ../../pidgin/win32-install-dir/locale/sr@Latn/LC_MESSAGES/guifications.mo
installing sr.gmo as ../../pidgin/win32-install-dir/locale/sr/LC_MESSAGES/guifications.mo
installing sv.gmo as ../../pidgin/win32-install-dir/locale/sv/LC_MESSAGES/guifications.mo
installing uk.gmo as ../../pidgin/win32-install-dir/locale/uk/LC_MESSAGES/guifications.mo
installing zh_CN.gmo as ../../pidgin/win32-install-dir/locale/zh_CN/LC_MESSAGES/guifications.mo
installing zh_TW.gmo as ../../pidgin/win32-install-dir/locale/zh_TW/LC_MESSAGES/guifications.mo
make[1]: Leaving directory `/home/datallah/winpidgin/gf2/po'
/*
* Guifications - The end all, be all, toaster popup plugin
* Copyright (C) 2003-2005 Gary Kramlich
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <debug.h>
#include "gf_gtk_utils.h"
/******************************************************************************
* Globals
*****************************************************************************/
static GtkWidget *style_widget = NULL;
/******************************************************************************
* API
*****************************************************************************/
/* Color stuff */
guint32
gf_gtk_color_pixel_from_gdk(const GdkColor *color) {
guint32 pixel;
g_return_val_if_fail(color, 0);
pixel = (((color->red & 0xFF00) << 8) | ((color->green & 0xFF00)) |
((color->blue & 0xFF00) >> 8)) << 8;
return pixel;
}
void
gf_gtk_color_pango_from_gdk(PangoColor *pango, const GdkColor *gdk) {
g_return_if_fail(pango);
g_return_if_fail(gdk);
pango->red = gdk->red;
pango->green = gdk->green;
pango->blue = gdk->blue;
}
void
gf_gtk_color_gdk_from_pango(GdkColor *gdk, const PangoColor *pango) {
g_return_if_fail(gdk);
g_return_if_fail(pango);
gdk->red = pango->red;
gdk->green = pango->green;
gdk->blue = pango->blue;
}
/******************************************************************************
* Theme stuff
*****************************************************************************/
void
gf_gtk_theme_get_bg_color(GdkColor *color) {
GtkStyle *style;
g_return_if_fail(color);
style = gtk_rc_get_style(style_widget);
*color = style->bg[GTK_STATE_NORMAL];
}
void
gf_gtk_theme_get_fg_color(GdkColor *color) {
GtkStyle *style;
g_return_if_fail(color);
style = gtk_rc_get_style(style_widget);
*color = style->fg[GTK_STATE_NORMAL];
}
GdkPixmap *
gf_gtk_theme_get_bg_pixmap() {
GtkStyle *style;
style = gtk_rc_get_style(style_widget);
return style->bg_pixmap[GTK_STATE_NORMAL];
}
PangoFontDescription *
gf_gtk_theme_get_font() {
GtkStyle *style;
style = gtk_rc_get_style(style_widget);
if(!pango_font_description_get_family(style->font_desc))
pango_font_description_set_family(style->font_desc, "Sans");
if(pango_font_description_get_size(style->font_desc) <= 0)
pango_font_description_set_size(style->font_desc, 10 * PANGO_SCALE);
return style->font_desc;
}
/******************************************************************************
* Pixbuf stuff
*****************************************************************************/
void
gf_gtk_pixbuf_tile(GdkPixbuf *dest, const GdkPixbuf *tile) {
gint dest_width, dest_height;
gint tile_width, tile_height;
gint copy_width, copy_height;
gint x, y;
g_return_if_fail(dest);
g_return_if_fail(tile);
dest_width = gdk_pixbuf_get_width(dest);
dest_height = gdk_pixbuf_get_height(dest);
tile_width = gdk_pixbuf_get_width(tile);
tile_height = gdk_pixbuf_get_height(tile);
for(y = 0; y < dest_height; y += tile_height) {
for(x = 0; x < dest_width; x += tile_width) {
if(x + tile_width < dest_width)
copy_width = tile_width;
else
copy_width = dest_width - x;
if(y + tile_height < dest_height)
copy_height = tile_height;
else
copy_height = dest_height - y;
gdk_pixbuf_copy_area(tile, 0, 0, copy_width, copy_height,
dest, x, y);
}
}
}
void
gf_gtk_pixbuf_clip_composite(const GdkPixbuf *src, gint x, gint y,
GdkPixbuf *dest)
{
GdkPixbuf *clipped = NULL;
GdkRectangle clip;
gint width, height, diff;
g_return_if_fail(src);
g_return_if_fail(dest);
/* grab the dimensions of the destination */
width = gdk_pixbuf_get_width(dest);
height = gdk_pixbuf_get_height(dest);
/* make sure the x is in the background */
g_return_if_fail(x < width);
g_return_if_fail(y < height);
/* setup our clipping rectangle with the default values */
clip.x = 0;
clip.y = 0;
clip.width = gdk_pixbuf_get_width(src);
clip.height = gdk_pixbuf_get_height(src);
/* make sure it will paritially show */
g_return_if_fail(x + clip.width > 0);
g_return_if_fail(y + clip.height > 0);
g_return_if_fail(x < width);
g_return_if_fail(y < height);
/* do our adjustments */
if(x < 0) {
/* this looks goofy but we're adding a negative number,
*
* ie: it's subtraction..
*
* I was considering using abs() so it was clearer, but thats another
* function call that isn't really necessary.
*/
diff = clip.width + x;
clip.x = clip.width - diff;
clip.width = diff;
x = 0;
}
if(y < 0) {
/* see note above.. */
diff = clip.height + y;
clip.y = clip.height - diff;
clip.height = diff;
y = 0;
}
if(x + clip.width > width)
clip.width = width - (clip.x + x);
if(y + clip.height > height)
clip.height = height - (clip.y + y);
/* a few last sanity checks */
g_return_if_fail(clip.width > 0);
g_return_if_fail(clip.height > 0);
/* create our clipped pixbuf */
clipped = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8,
clip.width, clip.height);
g_return_if_fail(clipped);
gdk_pixbuf_copy_area(src, clip.x, clip.y, clip.width, clip.height,
clipped, 0, 0);
/* composite it */
gdk_pixbuf_composite(clipped, dest,
x, y, clip.width, clip.height,
x, y, 1, 1,
GDK_INTERP_BILINEAR, 255);
/* kill the clipped pixbuf */
g_object_unref(G_OBJECT(clipped));
}
/******************************************************************************
* Subsystem
*****************************************************************************/
void
gf_gtk_utils_init() {
style_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name(style_widget, "guifications");
}
void
gf_gtk_utils_uninit() {
gtk_widget_destroy(style_widget);
}