changeset 253:a37ae6c8fa66

Embed prefs.ui in dll file (Windows only)
author Konosuke Watanabe <sasugaanija@gmail.com>
date Fri, 21 Nov 2008 22:22:33 +0900
parents 04395314960f
children c2620a99622b
files Makefile.mingw pidgin-twitter.c
diffstat 2 files changed, 77 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.mingw	Fri Nov 21 22:22:33 2008 +0900
@@ -0,0 +1,68 @@
+PIDGIN_TREE_TOP = ../pidgin-2.5.2
+GLIB_TOP = ../glib-dev-2.16.5
+GTK_TOP = ../gtk+-dev-2.12.11
+ATK_TOP = ../atk-dev-1.22.0
+PANGO_TOP = ../pango-dev-1.20.5
+CAIRO_TOP = ../cairo-dev-1.6.4-2
+ICONV_TOP = ../win_iconv-tml-20080320
+GETTEXT_TOP = ../gettext-runtime-dev-0.17-1
+
+include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak
+
+OBJCOPY = objcopy.exe
+STRIP = strip.exe
+
+TARGET = pidgin-twitter.dll
+SRCS = pidgin-twitter.c
+
+OBJS = $(SRCS:%.c=%.o) prefs_ui.o
+
+CPPFLAGS = -I$(GLIB_TOP)/include/glib-2.0 \
+	-I$(GLIB_TOP)/lib/glib-2.0/include \
+	-I$(GTK_TOP)/include/gtk-2.0 \
+	-I$(GTK_TOP)/lib/gtk-2.0/include \
+	-I$(ATK_TOP)/include/atk-1.0 \
+	-I$(PANGO_TOP)/include/pango-1.0 \
+	-I$(CAIRO_TOP)/include/cairo \
+	-I$(ICONV_TOP)/include \
+	-I$(LIBXML2_TOP)/include \
+	-I$(PURPLE_TOP) \
+	-I$(PURPLE_TOP)/win32 \
+	-I$(PIDGIN_TOP) \
+	-I$(PIDGIN_TOP)/win32
+
+LIB_PATHS = -L$(GLIB_TOP)/lib \
+	-L$(GTK_TOP)/lib \
+	-L$(LIBXML2_TOP)/lib \
+	-L$(GETTEXT_TOP)/lib \
+	-L$(PURPLE_TOP) \
+	-L$(PIDGIN_TOP)
+
+LIBS = -lgtk-win32-2.0 \
+	-lglib-2.0 \
+	-lgdk-win32-2.0 \
+	-lgobject-2.0 \
+	-lintl \
+	-lpurple \
+	-lpidgin \
+	-lxml2 \
+	-lgdk_pixbuf-2.0
+
+LDFLAGS = $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS)
+
+all: $(TARGET)
+
+strip: $(TARGET)
+	$(STRIP) $^
+
+$(TARGET): $(OBJS) 
+	$(CC) -shared $^ $(LDFLAGS) -o $@
+
+.c.o:
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
+
+prefs_ui.o: prefs.ui
+	$(OBJCOPY) -I binary -O pe-i386 -B i386 $^ $@
+
+clean:
+	rm -f $(OBJS) $(TARGET) *~
--- a/pidgin-twitter.c	Tue Oct 28 12:33:45 2008 +0900
+++ b/pidgin-twitter.c	Fri Nov 21 22:22:33 2008 +0900
@@ -1859,6 +1859,7 @@
             }
         }
     }
+
     if(!(target_imhtml && target_buffer)) {
         return;
     }
@@ -2940,17 +2941,22 @@
     GtkSpinButton *spin;
     GtkObject *adjust;
     gint value;
+#ifdef _WIN32
+    extern char binary_prefs_ui_start[];
+    extern char binary_prefs_ui_size[];
+#endif
 
     builder = gtk_builder_new();
 
 #ifdef _WIN32
-    filename = g_build_filename(purple_user_dir(),
-                                "pidgin-twitter", "prefs.ui", NULL);
+    gtk_builder_add_from_string(builder, binary_prefs_ui_start,
+                                (int)binary_prefs_ui_size, NULL);
 #else
     filename = g_build_filename(DATADIR,
                                 "pidgin-twitter", "prefs.ui", NULL);
+    gtk_builder_add_from_file(builder, filename, &err);
 #endif
-    gtk_builder_add_from_file(builder, filename, &err);
+
     if(err) {
         twitter_debug("%s\n", err->message);
         g_free(filename);