diff --git a/gtk/Makefile.am b/gtk/Makefile.am index ff8ce591a..ea48c36d9 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -47,11 +47,11 @@ noinst_HEADERS = \ relocate.h \ stats.h \ torrent-cell-renderer.h \ + transmission-resources.h \ tr-core.h \ tr-icon.h \ tr-prefs.h \ tr-window.h \ - ui.h \ util.h bin_PROGRAMS = transmission-gtk @@ -74,6 +74,7 @@ transmission_gtk_SOURCES = \ relocate.c \ stats.c \ torrent-cell-renderer.c \ + transmission-resources.c \ tr-core.c \ tr-icon.c \ tr-prefs.c \ @@ -106,6 +107,16 @@ Productivity_DATA = $(DESKTOP_FILES) icon_DATA = transmission.png icondir = $(datadir)/pixmaps +UI_FILES = transmission-ui.xml + +transmission-resources.c: transmission.gresource.xml $(UI_FILES) + glib-compile-resources --target=$@ --sourcedir=$(srcdir) \ + --generate-source --c-name transmission $< + +transmission-resources.h: transmission.gresource.xml + glib-compile-resources --target=$@ --sourcedir=$(srcdir) \ + --generate-header --c-name transmission $< + EXTRA_DIST = \ $(DESKTOP_IN_FILES) \ transmission.png @@ -119,10 +130,14 @@ transmission.res: transmission.rc $(WINDRES) -J rc -i transmission.rc -O coff -o transmission.res BUILT_SOURCES = \ - setransmission.res + setransmission.res \ + transmission-resources.c \ + transmission-resources.h CLEANFILES = \ - transmission.res + setransmission.res \ + transmission-resources.c \ + transmission-resources.h transmission_gtk_LDADD += \ transmission.res diff --git a/gtk/main.c b/gtk/main.c index ec777018d..170156668 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -55,11 +55,12 @@ #include "tr-prefs.h" #include "tr-window.h" #include "util.h" -#include "ui.h" #define MY_CONFIG_NAME "transmission" #define MY_READABLE_NAME "transmission-gtk" +#define TR_RESOURCE_PATH "/com/transmissionbt/transmission/" + #define SHOW_LICENSE static const char * LICENSE = "The OS X client, CLI client, and parts of libtransmission are licensed under the terms of the MIT license.\n\n" @@ -481,6 +482,7 @@ static void app_setup( GtkWindow * wind, struct cbdata * cbdata ); static void on_startup( GApplication * application, gpointer user_data ) { + GError * error; const char * str; GtkWindow * win; GtkUIManager * ui_manager; @@ -506,9 +508,11 @@ on_startup( GApplication * application, gpointer user_data ) cbdata->core = gtr_core_new( session ); /* init the ui manager */ + error = NULL; ui_manager = gtk_ui_manager_new ( ); gtr_actions_init ( ui_manager, cbdata ); - gtk_ui_manager_add_ui_from_string ( ui_manager, fallback_ui_file, -1, NULL ); + gtk_ui_manager_add_ui_from_resource ( ui_manager, TR_RESOURCE_PATH "transmission-ui.xml", &error ); + g_assert_no_error (error); gtk_ui_manager_ensure_update ( ui_manager ); /* create main window now to be a parent to any error dialogs */ diff --git a/gtk/transmission-ui.xml b/gtk/transmission-ui.xml new file mode 100644 index 000000000..c48948100 --- /dev/null +++ b/gtk/transmission-ui.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gtk/transmission.gresource.xml b/gtk/transmission.gresource.xml new file mode 100644 index 000000000..4daf3cb57 --- /dev/null +++ b/gtk/transmission.gresource.xml @@ -0,0 +1,6 @@ + + + + transmission-ui.xml + + diff --git a/gtk/ui.h b/gtk/ui.h deleted file mode 100644 index 2ea24c41a..000000000 --- a/gtk/ui.h +++ /dev/null @@ -1,132 +0,0 @@ -static const char * fallback_ui_file = - "\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "\n" - ""; -