From 1f84c507a058f5baa01a632ce2478fa31854907d Mon Sep 17 00:00:00 2001 From: TingPing Date: Fri, 27 Sep 2013 21:56:13 -0400 Subject: Reorganize files and migrate images to gresource --- src/Makefile.am | 2 +- src/fe-gtk/Makefile.am | 8 ++- src/fe-gtk/fe-gtk.vcxproj | 14 ++++- src/fe-gtk/fe-gtk.vcxproj.filters | 10 +++- src/fe-gtk/hexchat.rc | 2 +- src/fe-gtk/pixmaps.c | 70 +++++++++------------- src/pixmaps/Makefile.am | 25 -------- src/pixmaps/ban.png | Bin 4338 -> 0 bytes src/pixmaps/book.png | Bin 841 -> 0 bytes src/pixmaps/disconnect.png | Bin 4496 -> 0 bytes src/pixmaps/hexchat.png | Bin 3175 -> 0 bytes src/pixmaps/kick.png | Bin 4059 -> 0 bytes src/pixmaps/notice.png | Bin 4812 -> 0 bytes src/pixmaps/pixmaps.vcxproj | 112 ------------------------------------ src/pixmaps/pixmaps.vcxproj.filters | 56 ------------------ src/pixmaps/tray_fileoffer.png | Bin 5077 -> 0 bytes src/pixmaps/tray_highlight.png | Bin 4781 -> 0 bytes src/pixmaps/tray_message.png | Bin 4678 -> 0 bytes src/pixmaps/tree_channel.png | Bin 422 -> 0 bytes src/pixmaps/tree_dialog.png | Bin 911 -> 0 bytes src/pixmaps/tree_server.png | Bin 568 -> 0 bytes src/pixmaps/tree_util.png | Bin 611 -> 0 bytes src/pixmaps/ulist_founder.png | Bin 660 -> 0 bytes src/pixmaps/ulist_halfop.png | Bin 668 -> 0 bytes src/pixmaps/ulist_netop.png | Bin 593 -> 0 bytes src/pixmaps/ulist_op.png | Bin 691 -> 0 bytes src/pixmaps/ulist_owner.png | Bin 678 -> 0 bytes src/pixmaps/ulist_voice.png | Bin 670 -> 0 bytes 28 files changed, 53 insertions(+), 246 deletions(-) delete mode 100644 src/pixmaps/Makefile.am delete mode 100644 src/pixmaps/ban.png delete mode 100644 src/pixmaps/book.png delete mode 100644 src/pixmaps/disconnect.png delete mode 100644 src/pixmaps/hexchat.png delete mode 100644 src/pixmaps/kick.png delete mode 100644 src/pixmaps/notice.png delete mode 100644 src/pixmaps/pixmaps.vcxproj delete mode 100644 src/pixmaps/pixmaps.vcxproj.filters delete mode 100644 src/pixmaps/tray_fileoffer.png delete mode 100644 src/pixmaps/tray_highlight.png delete mode 100644 src/pixmaps/tray_message.png delete mode 100644 src/pixmaps/tree_channel.png delete mode 100644 src/pixmaps/tree_dialog.png delete mode 100644 src/pixmaps/tree_server.png delete mode 100644 src/pixmaps/tree_util.png delete mode 100644 src/pixmaps/ulist_founder.png delete mode 100644 src/pixmaps/ulist_halfop.png delete mode 100644 src/pixmaps/ulist_netop.png delete mode 100644 src/pixmaps/ulist_op.png delete mode 100644 src/pixmaps/ulist_owner.png delete mode 100644 src/pixmaps/ulist_voice.png (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 6cb77148..d789a24f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,7 @@ if DO_GTK gtk_fe = fe-gtk endif -SUBDIRS = pixmaps common $(gtk_fe) $(text_fe) +SUBDIRS = common $(gtk_fe) $(text_fe) if WITH_TM SUBDIRS += htm diff --git a/src/fe-gtk/Makefile.am b/src/fe-gtk/Makefile.am index 88e3dfea..9ae2d084 100644 --- a/src/fe-gtk/Makefile.am +++ b/src/fe-gtk/Makefile.am @@ -11,7 +11,8 @@ EXTRA_DIST = \ chanview-tree.c custom-list.h editlist.h fe-gtk.h fkeys.h gtkutil.h joind.h \ maingui.h menu.h notifygui.h palette.h pixmaps.h \ plugin-tray.h plugingui.c plugingui.h rawlog.h sexy-iso-codes.h \ - sexy-spell-entry.h sexy-marshal.h textgui.h urlgrab.h userlistgui.h xtext.h + sexy-spell-entry.h sexy-marshal.h textgui.h urlgrab.h userlistgui.h xtext.h \ + ../../data/hexchat.gresource.xml if DO_PLUGIN plugingui_c = plugingui.c @@ -25,5 +26,8 @@ endif hexchat_SOURCES = ascii.c banlist.c chanlist.c chanview.c custom-list.c \ dccgui.c editlist.c fe-gtk.c fkeys.c gtkutil.c ignoregui.c joind.c menu.c \ maingui.c notifygui.c palette.c pixmaps.c plugin-tray.c $(plugingui_c) \ - rawlog.c servlistgui.c setup.c $(sexy_spell) textgui.c \ + rawlog.c resources.c servlistgui.c setup.c $(sexy_spell) textgui.c \ urlgrab.c userlistgui.c xtext.c + +resources.c: ../../data/hexchat.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=../../data --generate-dependencies ../../data/hexchat.gresource.xml) + $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=../../data --generate-source $< diff --git a/src/fe-gtk/fe-gtk.vcxproj b/src/fe-gtk/fe-gtk.vcxproj index a7c40a19..73526766 100644 --- a/src/fe-gtk/fe-gtk.vcxproj +++ b/src/fe-gtk/fe-gtk.vcxproj @@ -22,13 +22,11 @@ Application false - true MultiByte Application false - true MultiByte @@ -97,6 +95,12 @@ mainCRTStartup + + + $(DepsRoot)\bin\glib-compile-resources.exe --generate-source --sourcedir $(DataDir) --target "$(ProjectDir)resources.c" "$(DataDir)hexchat.gresource.xml" + Build gresource file + + @@ -147,6 +151,7 @@ + @@ -164,7 +169,10 @@ - + + + + diff --git a/src/fe-gtk/fe-gtk.vcxproj.filters b/src/fe-gtk/fe-gtk.vcxproj.filters index e1de7844..765e8cba 100644 --- a/src/fe-gtk/fe-gtk.vcxproj.filters +++ b/src/fe-gtk/fe-gtk.vcxproj.filters @@ -185,6 +185,9 @@ Source Files + + Source Files + @@ -197,8 +200,11 @@ - + Resource Files - \ No newline at end of file + + + + diff --git a/src/fe-gtk/hexchat.rc b/src/fe-gtk/hexchat.rc index 9b1018e0..789aa26e 100644 --- a/src/fe-gtk/hexchat.rc +++ b/src/fe-gtk/hexchat.rc @@ -2,7 +2,7 @@ #include "../../config-win32.h" #include "../../resource.h" -XC_ICON ICON "../../share/icons/hexchat.ico" +XC_ICON ICON "../../data/icons/hexchat.ico" VS_VERSION_INFO VERSIONINFO FILEVERSION COMMA_VERSION diff --git a/src/fe-gtk/pixmaps.c b/src/fe-gtk/pixmaps.c index bdd74e1e..cbec6f71 100644 --- a/src/fe-gtk/pixmaps.c +++ b/src/fe-gtk/pixmaps.c @@ -25,10 +25,9 @@ #include "../common/hexchat.h" #include "../common/fe.h" +#include #include -#include "../pixmaps/inline_pngs.h" - GdkPixbuf *pix_ulist_voice; GdkPixbuf *pix_ulist_halfop; GdkPixbuf *pix_ulist_op; @@ -84,21 +83,9 @@ pixmap_load_from_file (char *filename) return pix; } -#if 0 -#define LOADPIX(vv,pp,ff) \ - vv = gdk_pixbuf_new_from_file (HEXCHATSHAREDIR"/hexchat/"ff, 0); \ - if (!vv) \ - vv = gdk_pixbuf_new_from_inline (-1, pp, FALSE, 0); - -#define LOADPIX_DISKONLY(vv,ff) \ - vv = gdk_pixbuf_new_from_file (HEXCHATSHAREDIR"/hexchat/"ff, 0); - -#define EXT ".png" -#endif - /* load custom icons from /icons, don't mess in system folders */ static GdkPixbuf * -load_pixmap (const char *filename, const char *name, int has_inline) +load_pixmap (const char *filename) { gchar *path; GdkPixbuf *pixbuf; @@ -107,45 +94,40 @@ load_pixmap (const char *filename, const char *name, int has_inline) pixbuf = gdk_pixbuf_new_from_file (path, 0); g_free (path); - if (has_inline && !pixbuf && name) + if (!pixbuf) { - pixbuf = gdk_pixbuf_new_from_inline (-1, name, FALSE, 0); + path = g_strdup_printf ("/icons/%s.png", filename); + pixbuf = gdk_pixbuf_new_from_resource (path, NULL); + g_free (path); } + g_warn_if_fail (pixbuf != NULL); + return pixbuf; } void pixmaps_init (void) { - /* userlist icons, with inlined defaults */ - pix_ulist_voice = load_pixmap ("ulist_voice", png_ulist_voice, 1); - pix_ulist_halfop = load_pixmap ("ulist_halfop", png_ulist_halfop, 1); - pix_ulist_op = load_pixmap ("ulist_op", png_ulist_op, 1); - pix_ulist_owner = load_pixmap ("ulist_owner", png_ulist_owner, 1); - pix_ulist_founder = load_pixmap ("ulist_founder", png_ulist_founder, 1); - pix_ulist_netop = load_pixmap ("ulist_netop", png_ulist_netop, 1); - - /* tray icons, with inlined defaults */ - pix_tray_fileoffer = load_pixmap ("tray_fileoffer", png_tray_fileoffer, 1); - pix_tray_highlight = load_pixmap ("tray_highlight", png_tray_highlight, 1); - pix_tray_message = load_pixmap ("tray_message", png_tray_message, 1); - -#if 0 - /* treeview icons, no defaults, load from disk only */ - pix_tree_channel = load_pixmap ("tree_channel", NULL, 0); - pix_tree_dialog = load_pixmap ("tree_dialog", NULL, 0); - pix_tree_server = load_pixmap ("tree_server", NULL, 0); - pix_tree_util = load_pixmap ("tree_util", NULL, 0); -#endif - /* provide inline defaults for these coz they are nice! */ - pix_tree_channel = load_pixmap ("tree_channel", png_tree_channel, 1); - pix_tree_dialog = load_pixmap ("tree_dialog", png_tree_dialog, 1); - pix_tree_server = load_pixmap ("tree_server", png_tree_server, 1); - pix_tree_util = load_pixmap ("tree_util", png_tree_util, 1); + pix_ulist_voice = load_pixmap ("ulist_voice"); + pix_ulist_halfop = load_pixmap ("ulist_halfop"); + pix_ulist_op = load_pixmap ("ulist_op"); + pix_ulist_owner = load_pixmap ("ulist_owner"); + pix_ulist_founder = load_pixmap ("ulist_founder"); + pix_ulist_netop = load_pixmap ("ulist_netop"); + + pix_tray_fileoffer = load_pixmap ("tray_fileoffer"); + pix_tray_highlight = load_pixmap ("tray_highlight"); + pix_tray_message = load_pixmap ("tray_message"); + + pix_tree_channel = load_pixmap ("tree_channel"); + pix_tree_dialog = load_pixmap ("tree_dialog"); + pix_tree_server = load_pixmap ("tree_server"); + pix_tree_util = load_pixmap ("tree_util"); /* non-replaceable book pixmap */ - pix_book = gdk_pixbuf_new_from_inline (-1, png_book, FALSE, 0); + pix_book = gdk_pixbuf_new_from_resource ("/icons/book.png", NULL); + /* used in About window, tray icon and WindowManager icon. */ - pix_hexchat = load_pixmap ("hexchat", png_hexchat, 1); + pix_hexchat = load_pixmap ("hexchat"); } diff --git a/src/pixmaps/Makefile.am b/src/pixmaps/Makefile.am deleted file mode 100644 index 57ab72b5..00000000 --- a/src/pixmaps/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -## Process this file with automake to produce Makefile.in - -LIST = png_ulist_voice $(srcdir)/ulist_voice.png \ - png_ulist_halfop $(srcdir)/ulist_halfop.png \ - png_ulist_op $(srcdir)/ulist_op.png \ - png_ulist_owner $(srcdir)/ulist_owner.png \ - png_ulist_founder $(srcdir)/ulist_founder.png \ - png_ulist_netop $(srcdir)/ulist_netop.png \ - png_tray_fileoffer $(srcdir)/tray_fileoffer.png \ - png_tray_highlight $(srcdir)/tray_highlight.png \ - png_tray_message $(srcdir)/tray_message.png \ - png_tree_channel $(srcdir)/tree_channel.png \ - png_tree_dialog $(srcdir)/tree_dialog.png \ - png_tree_server $(srcdir)/tree_server.png \ - png_tree_util $(srcdir)/tree_util.png \ - png_book $(srcdir)/book.png \ - png_hexchat $(srcdir)/hexchat.png - -PNGS = ulist_voice.png ulist_halfop.png ulist_op.png ulist_owner.png ulist_founder.png ulist_netop.png tray_fileoffer.png tray_highlight.png tray_message.png tree_channel.png tree_dialog.png tree_server.png tree_util.png book.png -noinst_HEADERS = inline_pngs.h -CLEANFILES = $(noinst_HEADERS) -EXTRA_DIST = $(PNGS) - -inline_pngs.h: $(PNGS) - @gdkpixbufcsourcepath@ --raw --build-list $(LIST) > $(srcdir)/inline_pngs.h diff --git a/src/pixmaps/ban.png b/src/pixmaps/ban.png deleted file mode 100644 index 84682bc7..00000000 Binary files a/src/pixmaps/ban.png and /dev/null differ diff --git a/src/pixmaps/book.png b/src/pixmaps/book.png deleted file mode 100644 index 1f1e4301..00000000 Binary files a/src/pixmaps/book.png and /dev/null differ diff --git a/src/pixmaps/disconnect.png b/src/pixmaps/disconnect.png deleted file mode 100644 index 0af58487..00000000 Binary files a/src/pixmaps/disconnect.png and /dev/null differ diff --git a/src/pixmaps/hexchat.png b/src/pixmaps/hexchat.png deleted file mode 100644 index 4d977c02..00000000 Binary files a/src/pixmaps/hexchat.png and /dev/null differ diff --git a/src/pixmaps/kick.png b/src/pixmaps/kick.png deleted file mode 100644 index 72ea9850..00000000 Binary files a/src/pixmaps/kick.png and /dev/null differ diff --git a/src/pixmaps/notice.png b/src/pixmaps/notice.png deleted file mode 100644 index 931497f8..00000000 Binary files a/src/pixmaps/notice.png and /dev/null differ diff --git a/src/pixmaps/pixmaps.vcxproj b/src/pixmaps/pixmaps.vcxproj deleted file mode 100644 index e5b71c53..00000000 --- a/src/pixmaps/pixmaps.vcxproj +++ /dev/null @@ -1,112 +0,0 @@ - - - - v120 - - - - Release - Win32 - - - Release - x64 - - - - {626DA61C-FA8B-474C-B2F5-72AD9DFEE642} - Win32Proj - pixmaps - - - - Application - false - true - MultiByte - - - Application - false - true - MultiByte - - - - - - - - - - - - - - - false - $(HexChatBin) - $(HexChatObj)$(ProjectName)\ - - - false - $(HexChatBin) - $(HexChatObj)$(ProjectName)\ - - - - - - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - true - true - - - "$(DepsRoot)\bin\gdk-pixbuf-csource" --build-list $(Pixmaps) > "$(SolutionDir)\..\src\pixmaps\inline_pngs.h" - - - - - - - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - true - true - - - "$(DepsRoot)\bin\gdk-pixbuf-csource" --build-list $(Pixmaps) > "$(SolutionDir)\..\src\pixmaps\inline_pngs.h" - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/pixmaps/pixmaps.vcxproj.filters b/src/pixmaps/pixmaps.vcxproj.filters deleted file mode 100644 index 1351b32f..00000000 --- a/src/pixmaps/pixmaps.vcxproj.filters +++ /dev/null @@ -1,56 +0,0 @@ - - - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - diff --git a/src/pixmaps/tray_fileoffer.png b/src/pixmaps/tray_fileoffer.png deleted file mode 100644 index f1afc029..00000000 Binary files a/src/pixmaps/tray_fileoffer.png and /dev/null differ diff --git a/src/pixmaps/tray_highlight.png b/src/pixmaps/tray_highlight.png deleted file mode 100644 index 1a2f4910..00000000 Binary files a/src/pixmaps/tray_highlight.png and /dev/null differ diff --git a/src/pixmaps/tray_message.png b/src/pixmaps/tray_message.png deleted file mode 100644 index 8beb9b56..00000000 Binary files a/src/pixmaps/tray_message.png and /dev/null differ diff --git a/src/pixmaps/tree_channel.png b/src/pixmaps/tree_channel.png deleted file mode 100644 index f6e83254..00000000 Binary files a/src/pixmaps/tree_channel.png and /dev/null differ diff --git a/src/pixmaps/tree_dialog.png b/src/pixmaps/tree_dialog.png deleted file mode 100644 index 9d2d5008..00000000 Binary files a/src/pixmaps/tree_dialog.png and /dev/null differ diff --git a/src/pixmaps/tree_server.png b/src/pixmaps/tree_server.png deleted file mode 100644 index acddccc9..00000000 Binary files a/src/pixmaps/tree_server.png and /dev/null differ diff --git a/src/pixmaps/tree_util.png b/src/pixmaps/tree_util.png deleted file mode 100644 index 9460dfc7..00000000 Binary files a/src/pixmaps/tree_util.png and /dev/null differ diff --git a/src/pixmaps/ulist_founder.png b/src/pixmaps/ulist_founder.png deleted file mode 100644 index 0e30f8d0..00000000 Binary files a/src/pixmaps/ulist_founder.png and /dev/null differ diff --git a/src/pixmaps/ulist_halfop.png b/src/pixmaps/ulist_halfop.png deleted file mode 100644 index ac5a5162..00000000 Binary files a/src/pixmaps/ulist_halfop.png and /dev/null differ diff --git a/src/pixmaps/ulist_netop.png b/src/pixmaps/ulist_netop.png deleted file mode 100644 index aba96858..00000000 Binary files a/src/pixmaps/ulist_netop.png and /dev/null differ diff --git a/src/pixmaps/ulist_op.png b/src/pixmaps/ulist_op.png deleted file mode 100644 index ef3c04cf..00000000 Binary files a/src/pixmaps/ulist_op.png and /dev/null differ diff --git a/src/pixmaps/ulist_owner.png b/src/pixmaps/ulist_owner.png deleted file mode 100644 index e0fe13a6..00000000 Binary files a/src/pixmaps/ulist_owner.png and /dev/null differ diff --git a/src/pixmaps/ulist_voice.png b/src/pixmaps/ulist_voice.png deleted file mode 100644 index dbc13ad8..00000000 Binary files a/src/pixmaps/ulist_voice.png and /dev/null differ -- cgit 1.4.1