grim/guifications1
Clone
Summary
Browse
Changes
Graph
This should fix the Mdk 9.1 RPM building bug reported on the forums a while ago
gf_1_10
2004-07-16, Stu Tomlinson
b8d6fc121876
This should fix the Mdk 9.1 RPM building bug reported on the forums a while ago
/*
Guifications - The notification plugin to end all notification plugins!
Copyright (C) 2003 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
<glib.h>
#include
<gdk-pixbuf/gdk-pixbuf.h>
#include
"debug.h"
#ifdef _WIN32
#include
"win32dep.h"
#endif
#include
"gf_pngs.h"
#include
"gf_types.h"
/***********************************************************************
* Statics
**********************************************************************/
static
gchar
*
gf_get_image_dir
()
{
return
g_build_filename
(
DATADIR
,
"pixmaps"
,
"gaim"
,
"guifications"
,
NULL
);
}
/***********************************************************************
* Exports
**********************************************************************/
GdkPixbuf
*
get_def_background_image
()
{
GdkPixbuf
*
ret
;
gchar
*
img_dir
,
*
file
;
img_dir
=
gf_get_image_dir
();
file
=
g_build_filename
(
img_dir
,
"backgrounds"
,
"background_default.png"
,
NULL
);
g_free
(
img_dir
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
return
ret
;
}
GdkPixbuf
*
get_text_clipping_image
(
gf_text_clipping
clipping
)
{
GdkPixbuf
*
ret
;
gchar
*
img_dir
,
*
file
;
img_dir
=
gf_get_image_dir
();
switch
(
clipping
)
{
case
text_clipping_ellipsis_start
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"text_clipping_ellipsis_start.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
text_clipping_ellipsis_middle
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"text_clipping_ellipsis_middle.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
text_clipping_ellipsis_end
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"text_clipping_ellipsis_end.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
text_clipping_truncate
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"text_clipping_truncate.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
default
:
ret
=
NULL
;
break
;
}
g_free
(
img_dir
);
return
ret
;
}
GdkPixbuf
*
get_item_position_image
(
gf_item_position
position
)
{
GdkPixbuf
*
ret
;
gchar
*
img_dir
,
*
file
;
img_dir
=
gf_get_image_dir
();
switch
(
position
)
{
case
item_position_nw
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"item_position_north_west.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
item_position_n
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"item_position_north.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
item_position_ne
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"item_position_north_east.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
item_position_w
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"item_position_west.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
item_position_c
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"item_position_center.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
item_position_e
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"item_position_east.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
item_position_sw
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"item_position_south_west.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
item_position_s
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"item_position_south.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
item_position_se
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"item_position_south_east.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
default
:
ret
=
NULL
;
break
;
}
g_free
(
img_dir
);
return
ret
;
}
GdkPixbuf
*
get_icon_size_image
(
gf_icon_size
size
)
{
GdkPixbuf
*
ret
;
gchar
*
img_dir
,
*
file
;
img_dir
=
gf_get_image_dir
();
switch
(
size
)
{
case
icon_size_huge
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"icon_size_huge.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
icon_size_large
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"icon_size_large.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
icon_size_normal
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"icon_size_normal.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
icon_size_small
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"icon_size_small.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
icon_size_tiny
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"icon_size_tiny.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
default
:
ret
=
NULL
;
break
;
}
g_free
(
img_dir
);
return
ret
;
}
GdkPixbuf
*
get_window_position_image
(
gf_window_position
position
)
{
GdkPixbuf
*
ret
;
gchar
*
img_dir
,
*
file
;
img_dir
=
gf_get_image_dir
();
switch
(
position
)
{
case
window_position_nw
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"window_position_north_west.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
window_position_ne
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"window_position_north_east.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
window_position_sw
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"window_position_south_west.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
window_position_se
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"window_position_south_east.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
default
:
ret
=
NULL
;
break
;
}
g_free
(
img_dir
);
return
ret
;
}
GdkPixbuf
*
get_window_zoom_image
(
gf_window_zoom
zoom
)
{
GdkPixbuf
*
ret
;
gchar
*
img_dir
,
*
file
;
img_dir
=
gf_get_image_dir
();
switch
(
zoom
)
{
case
window_zoom_200
:
case
window_zoom_175
:
case
window_zoom_150
:
case
window_zoom_125
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"window_zoom_in.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
window_zoom_100
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"window_zoom_normal.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
case
window_zoom_75
:
case
window_zoom_50
:
case
window_zoom_25
:
file
=
g_build_filename
(
img_dir
,
"conf"
,
"window_zoom_out.png"
,
NULL
);
ret
=
gdk_pixbuf_new_from_file
(
file
,
NULL
);
g_free
(
file
);
break
;
default
:
ret
=
NULL
;
break
;
}
g_free
(
img_dir
);
return
ret
;
}