Kaydet (Commit) dabae1f9 authored tarafından Colomban Wendling's avatar Colomban Wendling

Replace images embedded in the sources with proper themable icons

Additionally, provide SVG versions of the icons as well as them
rendered at the various icons sizes.
üst bd02c009
......@@ -102,8 +102,16 @@ AC_CONFIG_FILES([
Makefile
icons/Makefile
icons/16x16/Makefile
icons/24x24/Makefile
icons/32x32/Makefile
icons/48x48/Makefile
icons/scalable/Makefile
icons/tango/Makefile
icons/tango/16x16/Makefile
icons/tango/24x24/Makefile
icons/tango/32x32/Makefile
icons/tango/48x48/Makefile
icons/tango/scalable/Makefile
tagmanager/Makefile
tagmanager/ctags/Makefile
tagmanager/mio/Makefile
......
......@@ -3,6 +3,13 @@
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkAccelGroup" id="accelgroup1"/>
<object class="GtkIconFactory" id="iconfactory1">
<sources>
<source stock-id="geany-build" icon-name="geany-build"/>
<source stock-id="geany-close-all" icon-name="geany-close-all"/>
<source stock-id="geany-save-all" icon-name="geany-save-all"/>
</sources>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">3</property>
<property name="upper">1000</property>
......@@ -467,7 +474,7 @@
<object class="GtkImage" id="image4061">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-close</property>
<property name="stock">geany-close-all</property>
<property name="icon-size">1</property>
</object>
<object class="GtkImage" id="image4062">
......@@ -671,7 +678,7 @@
<object class="GtkImage" id="image4057">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-save</property>
<property name="stock">geany-save-all</property>
<property name="icon-size">1</property>
</object>
<object class="GtkImage" id="image4058">
......
iconsdir = $(datadir)/icons/hicolor/16x16/apps
iconsdir = $(datadir)/icons/hicolor/16x16
icons_appsdir = $(iconsdir)/apps
icons_actionsdir = $(iconsdir)/actions
icons_DATA = \
dist_icons_apps_DATA = \
classviewer-class.png \
classviewer-macro.png \
classviewer-member.png \
......@@ -11,6 +13,11 @@ icons_DATA = \
classviewer-var.png \
geany.png
EXTRA_DIST = $(icons_DATA) \
dist_icons_actions_DATA = \
geany-build.png \
geany-close-all.png \
geany-save-all.png
dist_noinst_DATA = \
classviewer-var.xpm \
classviewer-method.xpm
icons_actionsdir = $(datadir)/icons/hicolor/24x24/actions
dist_icons_actions_DATA = \
geany-build.png \
geany-close-all.png \
geany-save-all.png
icons_actionsdir = $(datadir)/icons/hicolor/32x32/actions
dist_icons_actions_DATA = \
geany-build.png \
geany-close-all.png \
geany-save-all.png
iconsdir = $(datadir)/icons/hicolor/48x48/apps
icons_DATA = geany.png
iconsdir = $(datadir)/icons/hicolor/48x48
icons_appsdir = $(iconsdir)/apps
icons_actionsdir = $(iconsdir)/actions
EXTRA_DIST = $(icons_DATA)
dist_icons_apps_DATA = \
geany.png
dist_icons_actions_DATA = \
geany-build.png \
geany-close-all.png \
geany-save-all.png
SUBDIRS = 16x16 48x48 scalable
SUBDIRS = 16x16 24x24 32x32 48x48 scalable tango
EXTRA_DIST = geany.ico
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
gtk_update_icon_cache = gtk-update-icon-cache -f -t
install-data-hook:
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
$(gtk_update_icon_cache) "$(datadir)/icons/hicolor"; \
$(gtk_update_icon_cache) "$(datadir)/icons/Tango"; \
else \
echo "*** Icon cache not updated. Remember to run:"; \
echo "***"; \
echo "*** $(gtk_update_icon_cache)"; \
echo "*** $(gtk_update_icon_cache) '$(datadir)/icons/hicolor'";\
echo "*** $(gtk_update_icon_cache) '$(datadir)/icons/Tango'";\
echo "***"; \
fi
uninstall-local:
rm -f $(DESTDIR)$(datadir)/icons/hicolor/icon-theme.cache;
rm -f $(DESTDIR)$(datadir)/icons/hicolor/icon-theme.cache
rm -f $(DESTDIR)$(datadir)/icons/Tango/icon-theme.cache
iconsdir = $(datadir)/icons/hicolor/scalable/apps
icons_DATA = geany.svg
iconsdir = $(datadir)/icons/hicolor/scalable
icons_appsdir = $(iconsdir)/apps
icons_actionsdir = $(iconsdir)/actions
EXTRA_DIST = $(icons_DATA)
dist_icons_apps_DATA = \
geany.svg
dist_icons_actions_DATA = \
geany-build.svg \
geany-close-all.svg \
geany-save-all.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48px"
height="48px"
id="svg2985"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="Nouveau document 2">
<defs
id="defs2987">
<linearGradient
id="linearGradient3876">
<stop
id="stop3878"
offset="0"
style="stop-color:#832f07;stop-opacity:1;" />
<stop
style="stop-color:#7d2c06;stop-opacity:1;"
offset="0.66924989"
id="stop3880" />
<stop
id="stop3882"
offset="1"
style="stop-color:#000000;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3854">
<stop
style="stop-color:#8c3303;stop-opacity:1;"
offset="0"
id="stop3856" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop3858" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3854"
id="radialGradient3862"
cx="8.2662506"
cy="31.158112"
fx="8.2662506"
fy="31.158112"
r="13.230393"
gradientTransform="matrix(-0.84250329,0.40840637,-0.63160073,-1.3029319,36.559251,70.98965)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3876"
id="linearGradient3884"
x1="27.371437"
y1="47.235817"
x2="46.754456"
y2="22.07579"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.98714021,0,0,0.98714021,-0.112798,0.1861512)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3854"
id="radialGradient5114"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.82079822,2.4024917,-1.0801943,0.36904239,5.8309693,-24.501118)"
cx="6.8684106"
cy="0.77958882"
fx="6.8684106"
fy="0.77958882"
r="8.7621937" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6770833"
inkscape:cx="0.78613418"
inkscape:cy="9.8218394"
inkscape:current-layer="layer3"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1618"
inkscape:window-height="935"
inkscape:window-x="60"
inkscape:window-y="39"
inkscape:window-maximized="0" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<cc:license
rdf:resource="" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="layer1"
style="opacity:1">
<g
id="g5537">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path3842"
d="m 1.2832291,6.3829735 0,15.0104005 25.1333659,25.990419 0,-16.84308 z"
style="fill:url(#radialGradient3862);fill-opacity:1;stroke:#000000;stroke-width:0.98714024px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path3844"
d="m 26.416595,47.445489 0,-16.781384 20.359767,-9.56292 0,15.053888 z"
style="fill:url(#linearGradient3884);fill-opacity:1;stroke:#000000;stroke-width:0.98714024px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1" />
<path
sodipodi:nodetypes="ccccsssc"
inkscape:connector-curvature="0"
id="path3846"
d="M 1.2832291,6.3563849 26.498968,30.642054 46.784986,21.131619 21.132989,0.62747085 c 0,0 -2.224918,0.34900676 -1.701408,1.61415635 0.52351,1.2651495 -1.224238,1.8860405 -3.620946,2.83568 C 11.186296,6.9095927 9.0539044,7.2352368 5.2531811,5.688069 3.879367,5.1288278 1.2832291,6.3563849 1.2832291,6.3563849 z"
style="fill:#ba4503;fill-opacity:1;stroke:#000000;stroke-width:0.98714024px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1" />
<path
sodipodi:nodetypes="zsssz"
inkscape:connector-curvature="0"
id="path3848"
d="m 10.226527,11.446681 c 1.526904,1.548717 3.560029,2.162834 10.252074,-0.479885 6.849258,-2.7048021 6.151245,-3.0974347 4.62434,-4.4498359 C 23.576036,5.1645588 22.894765,4.5230075 17.250288,6.6042111 9.4412627,9.483517 8.6996228,9.8979631 10.226527,11.44668 z"
style="fill:url(#radialGradient5114);fill-opacity:1;stroke:#000000;stroke-width:0.98714024000000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<use
height="48"
width="48"
transform="translate(7.1717365,6.0206784)"
id="use3850"
xlink:href="#path3848"
y="0"
x="0" />
<use
height="48"
width="48"
transform="matrix(0.99867743,-0.05141392,0.05141392,0.99867743,6.7099747,7.8099442)"
id="use3852"
xlink:href="#use3850"
y="0"
x="0" />
</g>
</g>
</svg>
This diff is collapsed.
This diff is collapsed.
icons_actionsdir = $(datadir)/icons/Tango/16x16/actions
dist_icons_actions_DATA = \
geany-save-all.png
dist_noinst_DATA = \
geany-save-all.xcfgz
icons_actionsdir = $(datadir)/icons/Tango/24x24/actions
dist_icons_actions_DATA = \
geany-save-all.png
icons_actionsdir = $(datadir)/icons/Tango/32x32/actions
dist_icons_actions_DATA = \
geany-save-all.png
icons_actionsdir = $(datadir)/icons/Tango/48x48/actions
dist_icons_actions_DATA = \
geany-save-all.png
SUBDIRS = 16x16 24x24 32x32 48x48 scalable
icons_actionsdir = $(datadir)/icons/Tango/scalable/actions
dist_icons_actions_DATA = \
geany-save-all.svg
This diff is collapsed.
......@@ -14,7 +14,6 @@ src/geany.h
src/geanymenubuttonaction.c
src/geanyentryaction.c
src/highlighting.c
src/images.c
src/keybindings.c
src/keyfile.c
src/log.c
......
## Process this file with automake to produce Makefile.in
EXTRA_DIST = images.c gb.c win32.c win32.h plugindata.h \
EXTRA_DIST = gb.c win32.c win32.h plugindata.h \
documentprivate.h filetypesprivate.h pluginprivate.h projectprivate.h \
makefile.win32
......
This diff is collapsed.
......@@ -237,6 +237,8 @@ static void main_init(void)
#endif
/* inits */
ui_init_stock_items();
ui_init_builder();
main_widgets.window = NULL;
......@@ -254,8 +256,6 @@ static void main_init(void)
ui_prefs.recent_projects_queue = g_queue_new();
main_status.opening_session_files = FALSE;
ui_init_stock_items();
main_widgets.window = create_window1();
/* add recent projects to the Project menu */
......
......@@ -44,7 +44,6 @@
#include "utils.h"
#include "callbacks.h"
#include "encodings.h"
#include "images.c"
#include "sidebar.h"
#include "win32.h"
#include "project.h"
......@@ -952,84 +951,6 @@ void ui_set_search_entry_background(GtkWidget *widget, gboolean success)
}
static gboolean have_tango_icon_theme(void)
{
static gboolean result = FALSE;
static gboolean checked = FALSE;
if (! checked)
{
gchar *theme_name;
g_object_get(G_OBJECT(gtk_settings_get_default()), "gtk-icon-theme-name", &theme_name, NULL);
SETPTR(theme_name, g_utf8_strdown(theme_name, -1));
result = (strstr(theme_name, "tango") != NULL);
checked = TRUE;
g_free(theme_name);
}
return result;
}
/* Note: remember to unref the pixbuf once an image or window has added a reference. */
GdkPixbuf *ui_new_pixbuf_from_inline(gint img)
{
switch (img)
{
case GEANY_IMAGE_SAVE_ALL:
{
/* check whether the icon theme looks like a Gnome icon theme, if so use the
* old Gnome based Save All icon, otherwise assume a Tango-like icon theme */
if (have_tango_icon_theme())
return gdk_pixbuf_new_from_inline(-1, save_all_tango_inline, FALSE, NULL);
else
return gdk_pixbuf_new_from_inline(-1, save_all_gnome_inline, FALSE, NULL);
break;
}
case GEANY_IMAGE_CLOSE_ALL:
{
return gdk_pixbuf_new_from_inline(-1, close_all_inline, FALSE, NULL);
break;
}
case GEANY_IMAGE_BUILD:
{
return gdk_pixbuf_new_from_inline(-1, build_inline, FALSE, NULL);
break;
}
default:
return NULL;
}
}
static GdkPixbuf *ui_new_pixbuf_from_stock(const gchar *stock_id)
{
if (utils_str_equal(stock_id, GEANY_STOCK_CLOSE_ALL))
return ui_new_pixbuf_from_inline(GEANY_IMAGE_CLOSE_ALL);
else if (utils_str_equal(stock_id, GEANY_STOCK_BUILD))
return ui_new_pixbuf_from_inline(GEANY_IMAGE_BUILD);
else if (utils_str_equal(stock_id, GEANY_STOCK_SAVE_ALL))
return ui_new_pixbuf_from_inline(GEANY_IMAGE_SAVE_ALL);
return NULL;
}
GtkWidget *ui_new_image_from_inline(gint img)
{
GtkWidget *wid;
GdkPixbuf *pb;
pb = ui_new_pixbuf_from_inline(img);
wid = gtk_image_new_from_pixbuf(pb);
g_object_unref(pb); /* the image doesn't adopt our reference, so remove our ref. */
return wid;
}
static void recent_create_menu(GeanyRecentFiles *grf)
{
GtkWidget *tmp;
......@@ -1958,10 +1879,6 @@ static void create_config_files_menu(void)
void ui_init_stock_items(void)
{
GtkIconSet *icon_set;
GtkIconFactory *factory = gtk_icon_factory_new();
GdkPixbuf *pb;
guint i, len;
GtkStockItem items[] =
{
{ GEANY_STOCK_SAVE_ALL, N_("Save All"), 0, 0, GETTEXT_PACKAGE },
......@@ -1969,20 +1886,7 @@ void ui_init_stock_items(void)
{ GEANY_STOCK_BUILD, N_("Build"), 0, 0, GETTEXT_PACKAGE }
};
len = G_N_ELEMENTS(items);
for (i = 0; i < len; i++)
{
pb = ui_new_pixbuf_from_stock(items[i].stock_id);
icon_set = gtk_icon_set_new_from_pixbuf(pb);
gtk_icon_factory_add(factory, items[i].stock_id, icon_set);
gtk_icon_set_unref(icon_set);
g_object_unref(pb);
}
gtk_stock_add((GtkStockItem *) items, len);
gtk_icon_factory_add_default(factory);
g_object_unref(factory);
gtk_stock_add((GtkStockItem *) items, G_N_ELEMENTS(items));
}
......
......@@ -168,13 +168,6 @@ GeanyUIEditorFeatures;
#define GEANY_STOCK_CLOSE_ALL "geany-close-all"
#define GEANY_STOCK_BUILD "geany-build"
enum
{
GEANY_IMAGE_SAVE_ALL,
GEANY_IMAGE_CLOSE_ALL,
GEANY_IMAGE_BUILD
};
void ui_widget_show_hide(GtkWidget *widget, gboolean show);
......@@ -304,11 +297,6 @@ void ui_document_show_hide(GeanyDocument *doc);
void ui_set_search_entry_background(GtkWidget *widget, gboolean success);
GdkPixbuf *ui_new_pixbuf_from_inline(gint img);
GtkWidget *ui_new_image_from_inline(gint img);
void ui_create_recent_menus(void);
void ui_add_recent_document(GeanyDocument *doc);
......
......@@ -134,6 +134,40 @@ geany_sources = set([
'src/templates.c', 'src/toolbar.c', 'src/tools.c', 'src/sidebar.c',
'src/ui_utils.c', 'src/utils.c'])
geany_icons = {
'hicolor/16x16/apps': ['16x16/classviewer-class.png',
'16x16/classviewer-macro.png',
'16x16/classviewer-member.png',
'16x16/classviewer-method.png',
'16x16/classviewer-namespace.png',
'16x16/classviewer-other.png',
'16x16/classviewer-struct.png',
'16x16/classviewer-var.png',
'16x16/geany.png'],
'hicolor/16x16/actions': ['16x16/geany-build.png',
'16x16/geany-close-all.png',
'16x16/geany-save-all.png'],
'hicolor/24x24/actions': ['24x24/geany-build.png',
'24x24/geany-close-all.png',
'24x24/geany-save-all.png'],
'hicolor/32x32/actions': ['32x32/geany-build.png',
'32x32/geany-close-all.png',
'32x32/geany-save-all.png'],
'hicolor/48x48/actions': ['48x48/geany-build.png',
'48x48/geany-close-all.png',
'48x48/geany-save-all.png'],
'hicolor/48x48/apps': ['48x48/geany.png'],
'hicolor/scalable/apps': ['scalable/geany.svg'],
'hicolor/scalable/actions': ['scalable/geany-build.svg',
'scalable/geany-close-all.svg',
'scalable/geany-save-all.svg'],
'Tango/16x16/actions': ['tango/16x16/geany-save-all.png'],
'Tango/24x24/actions': ['tango/24x24/geany-save-all.png'],
'Tango/32x32/actions': ['tango/32x32/geany-save-all.png'],
'Tango/48x48/actions': ['tango/48x48/geany-save-all.png'],
'Tango/scalable/actions': ['tango/scalable/geany-save-all.svg']
}
def configure(conf):
......@@ -495,16 +529,12 @@ def build(bld):
template_dest = '${DATADIR}/%s/templates' % data_dir
bld.install_files(template_dest, start_dir.ant_glob('**/*'), cwd=start_dir, relative_trick=True)
# Icons
icon_dest = '${PREFIX}/share/icons' if is_win32 else '${DATADIR}/icons/hicolor/16x16/apps'
start_dir = bld.path.find_dir('icons/16x16')
bld.install_files(icon_dest, start_dir.ant_glob('*.png'), cwd=start_dir)
if not is_win32:
start_dir = bld.path.find_dir('icons/48x48')
icon_dest = '${DATADIR}/icons/hicolor/48x48/apps'
bld.install_files(icon_dest, start_dir.ant_glob('*.png'), cwd=start_dir)
start_dir = bld.path.find_dir('icons/scalable')
scalable_dest = '${DATADIR}/icons/hicolor/scalable/apps'
bld.install_files(scalable_dest, start_dir.ant_glob('*.svg'), cwd=start_dir)
for dest in geany_icons:
if is_win32 and dest != 'hicolor/16x16/apps':
continue
dest_dir = '${PREFIX}/share/icons' if is_win32 else os.path.join('${DATADIR}/icons/', dest)
bld.install_files(dest_dir, geany_icons[dest], cwd=bld.path.find_dir('icons'))
def distclean(ctx):
......@@ -545,15 +575,16 @@ def _post_install(ctx):
is_win32 = _target_is_win32(ctx)
if is_win32:
return
theme_dir = Utils.subst_vars('${DATADIR}/icons/hicolor', ctx.env)
icon_cache_updated = False
if not ctx.options.destdir:
ctx.exec_command('gtk-update-icon-cache -q -f -t %s' % theme_dir)
Logs.pprint('GREEN', 'GTK icon cache updated.')
icon_cache_updated = True
if not icon_cache_updated:
Logs.pprint('YELLOW', 'Icon cache not updated. After install, run this:')
Logs.pprint('YELLOW', 'gtk-update-icon-cache -q -f -t %s' % theme_dir)
for d in 'hicolor', 'Tango':
theme_dir = Utils.subst_vars('${DATADIR}/icons/' + d, ctx.env)
icon_cache_updated = False
if not ctx.options.destdir:
ctx.exec_command('gtk-update-icon-cache -q -f -t %s' % theme_dir)
Logs.pprint('GREEN', 'GTK icon cache updated.')
icon_cache_updated = True
if not icon_cache_updated:
Logs.pprint('YELLOW', 'Icon cache not updated. After install, run this:')
Logs.pprint('YELLOW', 'gtk-update-icon-cache -q -f -t %s' % theme_dir)
def updatepo(ctx):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment