summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorArnavion <arnavion@gmail.com>2015-10-10 16:14:07 -0700
committerArnavion <arnavion@gmail.com>2015-10-10 16:14:07 -0700
commit671a838b52e75216a4c8389be2ca569488fea8ac (patch)
tree4b0345b6db8ed324a9befa152942fceff0dc968f
parent6ca29b2eb423f638af24d4342abb30691046e850 (diff)
fe-gtk: Use manual registration for resources.
-rw-r--r--.gitignore3
-rw-r--r--src/fe-gtk/Makefile.am9
-rw-r--r--src/fe-gtk/fe-gtk.vcxproj7
-rw-r--r--src/fe-gtk/pixmaps.c3
4 files changed, 13 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 63675ee5..e5493eea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,6 +54,8 @@ src/common/textenums.h
 src/common/textevents.h
 src/fe-gtk/hexchat
 src/fe-gtk/hexchat.rc
+src/fe-gtk/resources.c
+src/fe-gtk/resources.h
 src/fe-text/hexchat-text
 src/htm/Main.resources
 src/htm/thememan.exe
@@ -74,7 +76,6 @@ src/**/*.plist
 # Win32 generated files
 plugins/wmpa/wmpa_h.h
 plugins/wmpa/wmpa_i.c
-src/fe-gtk/resources.c
 src/htm/obj/*
 win32/ipch/*
 win32/ext/perl/perl-x86-cache
diff --git a/src/fe-gtk/Makefile.am b/src/fe-gtk/Makefile.am
index 71179853..778b6cfb 100644
--- a/src/fe-gtk/Makefile.am
+++ b/src/fe-gtk/Makefile.am
@@ -17,7 +17,7 @@ EXTRA_DIST = \
 	sexy-spell-entry.h textgui.h urlgrab.h userlistgui.h xtext.h \
 	../../data/hexchat.gresource.xml
 
-BUILT_SOURCES = resources.c
+BUILT_SOURCES = resources.h resources.c
 
 CLEANFILES = $(BUILT_SOURCES)
 
@@ -43,12 +43,15 @@ 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 $(notify_c) palette.c pixmaps.c plugin-tray.c $(plugingui_c) \
-	plugin-notification.c rawlog.c resources.c servlistgui.c setup.c $(iso_codes_c) \
+	plugin-notification.c rawlog.c resources.h resources.c servlistgui.c setup.c $(iso_codes_c) \
 	sexy-spell-entry.c textgui.c urlgrab.c userlistgui.c xtext.c
 hexchat_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/common
 
+resources.h: $(top_srcdir)/data/hexchat.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(top_srcdir)/data --generate-dependencies $(top_srcdir)/data/hexchat.gresource.xml)
+	$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/data --generate-header --manual-register $<
+
 resources.c: $(top_srcdir)/data/hexchat.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(top_srcdir)/data --generate-dependencies $(top_srcdir)/data/hexchat.gresource.xml)
-	$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/data --generate-source $<
+	$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/data --generate-source --manual-register $<
 
 if DO_STATIC_ANALYSIS
 analyze_plists = $(hexchat_SOURCES:%.c=%.plist)
diff --git a/src/fe-gtk/fe-gtk.vcxproj b/src/fe-gtk/fe-gtk.vcxproj
index 401518b4..7a3cfb70 100644
--- a/src/fe-gtk/fe-gtk.vcxproj
+++ b/src/fe-gtk/fe-gtk.vcxproj
@@ -29,8 +29,6 @@
   </PropertyGroup>

   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

     <ClCompile>

-      <!-- WholeProgramOptimization must be turned off for gresource constructors to work, otherwise the .CRT$XCU section is not emitted. -->

-      <WholeProgramOptimization>false</WholeProgramOptimization>

       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>

       <AdditionalIncludeDirectories>..\common;$(HexChatLib);$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

       <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>

@@ -43,8 +41,6 @@
   </ItemDefinitionGroup>

   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

     <ClCompile>

-      <!-- WholeProgramOptimization must be turned off for gresource constructors to work, otherwise the .CRT$XCU section is not emitted. -->

-      <WholeProgramOptimization>false</WholeProgramOptimization>

       <PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>

       <AdditionalIncludeDirectories>..\common;$(HexChatLib);$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

       <DisableSpecificWarnings>4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>

@@ -62,7 +58,8 @@ SET SOLUTIONDIR=$(SolutionDir)..\
 powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.tt" "$(HexChatLib)hexchat.rc.utf8"

 REM hexchat.rc needs to be in UCS-2 or Resource Compiler will complain

 powershell "Get-Content -Encoding UTF8 '$(HexChatLib)hexchat.rc.utf8' | Out-File '$(HexChatLib)hexchat.rc'; Remove-Item '$(HexChatLib)hexchat.rc.utf8'"

-"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --sourcedir "$(DataDir)" --target "$(HexChatLib)resources.c" "$(DataDir)hexchat.gresource.xml"

+"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-header --manual-register --sourcedir "$(DataDir)" --target "$(HexChatLib)resources.h" "$(DataDir)hexchat.gresource.xml"

+"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --manual-register --sourcedir "$(DataDir)" --target "$(HexChatLib)resources.c" "$(DataDir)hexchat.gresource.xml"

       ]]></Command>

       <Message>Build hexchat.rc and gresource file</Message>

     </PreBuildEvent>

diff --git a/src/fe-gtk/pixmaps.c b/src/fe-gtk/pixmaps.c
index 053afaaf..b19c207d 100644
--- a/src/fe-gtk/pixmaps.c
+++ b/src/fe-gtk/pixmaps.c
@@ -24,6 +24,7 @@
 #include "../common/cfgfiles.h"
 #include "../common/hexchat.h"
 #include "../common/fe.h"
+#include "resources.h"
 
 #include <gio/gio.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
@@ -108,6 +109,8 @@ load_pixmap (const char *filename)
 void
 pixmaps_init (void)
 {
+	hexchat_register_resource();
+
 	pix_ulist_voice = load_pixmap ("ulist_voice");
 	pix_ulist_halfop = load_pixmap ("ulist_halfop");
 	pix_ulist_op = load_pixmap ("ulist_op");