mirror of
https://github.com/transmission/transmission
synced 2025-01-30 19:03:04 +00:00
load the UI from a resource file rather than a string. Patch by fmuellner
This commit is contained in:
parent
1b65933da1
commit
1966ffe4f5
5 changed files with 159 additions and 137 deletions
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
129
gtk/transmission-ui.xml
Normal file
129
gtk/transmission-ui.xml
Normal file
|
@ -0,0 +1,129 @@
|
|||
<ui>
|
||||
<menubar name='main-window-menu'>
|
||||
<menu action='file-menu'>
|
||||
<menuitem action='open-torrent-menu'/>
|
||||
<menuitem action='open-torrent-from-url'/>
|
||||
<menuitem action='new-torrent'/>
|
||||
<separator/>
|
||||
<menuitem action='start-all-torrents'/>
|
||||
<menuitem action='pause-all-torrents'/>
|
||||
<separator/>
|
||||
<menuitem action='quit'/>
|
||||
</menu>
|
||||
<menu action='edit-menu'>
|
||||
<menuitem action='select-all'/>
|
||||
<menuitem action='deselect-all'/>
|
||||
<separator/>
|
||||
<menuitem action='edit-preferences'/>
|
||||
</menu>
|
||||
<menu action='torrent-menu'>
|
||||
<menuitem action='show-torrent-properties'/>
|
||||
<menuitem action='open-torrent-folder'/>
|
||||
<separator/>
|
||||
<menuitem action='torrent-start'/>
|
||||
<menuitem action='torrent-start-now'/>
|
||||
<menuitem action='torrent-reannounce'/>
|
||||
<menu action='queue-menu'>
|
||||
<menuitem action='queue-move-top'/>
|
||||
<menuitem action='queue-move-up'/>
|
||||
<menuitem action='queue-move-down'/>
|
||||
<menuitem action='queue-move-bottom'/>
|
||||
</menu>
|
||||
<menuitem action='torrent-stop'/>
|
||||
<separator/>
|
||||
<menuitem action='relocate-torrent'/>
|
||||
<menuitem action='torrent-verify'/>
|
||||
<menuitem action='copy-magnet-link-to-clipboard'/>
|
||||
<separator/>
|
||||
<menuitem action='remove-torrent'/>
|
||||
<menuitem action='delete-torrent'/>
|
||||
</menu>
|
||||
<menu action='view-menu'>
|
||||
<menuitem action='compact-view'/>
|
||||
<separator/>
|
||||
<menuitem action='show-toolbar'/>
|
||||
<menuitem action='show-filterbar'/>
|
||||
<menuitem action='show-statusbar'/>
|
||||
<separator/>
|
||||
<menuitem action='sort-by-activity'/>
|
||||
<menuitem action='sort-by-age'/>
|
||||
<menuitem action='sort-by-name'/>
|
||||
<menuitem action='sort-by-progress'/>
|
||||
<menuitem action='sort-by-queue'/>
|
||||
<menuitem action='sort-by-ratio'/>
|
||||
<menuitem action='sort-by-size'/>
|
||||
<menuitem action='sort-by-state'/>
|
||||
<menuitem action='sort-by-time-left'/>
|
||||
<separator/>
|
||||
<menuitem action='sort-reversed'/>
|
||||
</menu>
|
||||
<menu action='help-menu'>
|
||||
<menuitem action='toggle-message-log'/>
|
||||
<menuitem action='show-stats'/>
|
||||
<separator/>
|
||||
<menuitem action='donate'/>
|
||||
<separator/>
|
||||
<menuitem action='help'/>
|
||||
<menuitem action='show-about-dialog'/>
|
||||
</menu>
|
||||
</menubar>
|
||||
|
||||
<toolbar name='main-window-toolbar'>
|
||||
<toolitem action='open-torrent-toolbar'/>
|
||||
<toolitem action='torrent-start'/>
|
||||
<toolitem action='torrent-stop'/>
|
||||
<toolitem action='remove-torrent'/>
|
||||
<separator/>
|
||||
<toolitem action='show-torrent-properties'/>
|
||||
</toolbar>
|
||||
|
||||
<popup name='main-window-popup'>
|
||||
<menuitem action='show-torrent-properties'/>
|
||||
<menuitem action='open-torrent-folder'/>
|
||||
<separator/>
|
||||
<menu action='sort-menu'>
|
||||
<menuitem action='sort-by-activity'/>
|
||||
<menuitem action='sort-by-age'/>
|
||||
<menuitem action='sort-by-name'/>
|
||||
<menuitem action='sort-by-progress'/>
|
||||
<menuitem action='sort-by-ratio'/>
|
||||
<menuitem action='sort-by-size'/>
|
||||
<menuitem action='sort-by-state'/>
|
||||
<menuitem action='sort-by-time-left'/>
|
||||
<separator/>
|
||||
<menuitem action='sort-reversed'/>
|
||||
</menu>
|
||||
<separator/>
|
||||
<menuitem action='torrent-start'/>
|
||||
<menuitem action='torrent-start-now'/>
|
||||
<menuitem action='torrent-reannounce'/>
|
||||
<menu action='queue-menu'>
|
||||
<menuitem action='queue-move-top'/>
|
||||
<menuitem action='queue-move-up'/>
|
||||
<menuitem action='queue-move-down'/>
|
||||
<menuitem action='queue-move-bottom'/>
|
||||
</menu>
|
||||
<menuitem action='torrent-stop'/>
|
||||
<separator/>
|
||||
<menuitem action='relocate-torrent'/>
|
||||
<menuitem action='torrent-verify'/>
|
||||
<menuitem action='copy-magnet-link-to-clipboard'/>
|
||||
<separator/>
|
||||
<menuitem action='remove-torrent'/>
|
||||
<menuitem action='delete-torrent'/>
|
||||
</popup>
|
||||
|
||||
<popup name='icon-popup'>
|
||||
<menuitem action='toggle-main-window'/>
|
||||
<separator/>
|
||||
<menuitem action='open-torrent-menu'/>
|
||||
<menuitem action='open-torrent-from-url'/>
|
||||
<separator/>
|
||||
<menuitem action='pause-all-torrents'/>
|
||||
<menuitem action='start-all-torrents'/>
|
||||
<separator/>
|
||||
<menuitem action='alt-speed-enabled'/>
|
||||
<separator/>
|
||||
<menuitem action='quit'/>
|
||||
</popup>
|
||||
</ui>
|
6
gtk/transmission.gresource.xml
Normal file
6
gtk/transmission.gresource.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/com/transmissionbt/transmission">
|
||||
<file>transmission-ui.xml</file>
|
||||
</gresource>
|
||||
</gresources>
|
132
gtk/ui.h
132
gtk/ui.h
|
@ -1,132 +0,0 @@
|
|||
static const char * fallback_ui_file =
|
||||
"<ui>\n"
|
||||
" <menubar name='main-window-menu'>\n"
|
||||
" <menu action='file-menu'>\n"
|
||||
" <menuitem action='open-torrent-menu'/>\n"
|
||||
" <menuitem action='open-torrent-from-url'/>\n"
|
||||
" <menuitem action='new-torrent'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='start-all-torrents'/>\n"
|
||||
" <menuitem action='pause-all-torrents'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='quit'/>\n"
|
||||
" </menu>\n"
|
||||
" <menu action='edit-menu'>\n"
|
||||
" <menuitem action='select-all'/>\n"
|
||||
" <menuitem action='deselect-all'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='edit-preferences'/>\n"
|
||||
" </menu>\n"
|
||||
" <menu action='torrent-menu'>\n"
|
||||
" <menuitem action='show-torrent-properties'/>\n"
|
||||
" <menuitem action='open-torrent-folder'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='torrent-start'/>\n"
|
||||
" <menuitem action='torrent-start-now'/>\n"
|
||||
" <menuitem action='torrent-reannounce'/>\n"
|
||||
" <menu action='queue-menu'>\n"
|
||||
" <menuitem action='queue-move-top'/>\n"
|
||||
" <menuitem action='queue-move-up'/>\n"
|
||||
" <menuitem action='queue-move-down'/>\n"
|
||||
" <menuitem action='queue-move-bottom'/>\n"
|
||||
" </menu>\n"
|
||||
" <menuitem action='torrent-stop'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='relocate-torrent'/>\n"
|
||||
" <menuitem action='torrent-verify'/>\n"
|
||||
" <menuitem action='copy-magnet-link-to-clipboard'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='remove-torrent'/>\n"
|
||||
" <menuitem action='delete-torrent'/>\n"
|
||||
" </menu>\n"
|
||||
" <menu action='view-menu'>\n"
|
||||
" <menuitem action='compact-view'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='show-toolbar'/>\n"
|
||||
" <menuitem action='show-filterbar'/>\n"
|
||||
" <menuitem action='show-statusbar'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='sort-by-activity'/>\n"
|
||||
" <menuitem action='sort-by-age'/>\n"
|
||||
" <menuitem action='sort-by-name'/>\n"
|
||||
" <menuitem action='sort-by-progress'/>\n"
|
||||
" <menuitem action='sort-by-queue'/>\n"
|
||||
" <menuitem action='sort-by-ratio'/>\n"
|
||||
" <menuitem action='sort-by-size'/>\n"
|
||||
" <menuitem action='sort-by-state'/>\n"
|
||||
" <menuitem action='sort-by-time-left'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='sort-reversed'/>\n"
|
||||
" </menu>\n"
|
||||
" <menu action='help-menu'>\n"
|
||||
" <menuitem action='toggle-message-log'/>\n"
|
||||
" <menuitem action='show-stats'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='donate'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='help'/>\n"
|
||||
" <menuitem action='show-about-dialog'/>\n"
|
||||
" </menu>\n"
|
||||
" </menubar>\n"
|
||||
"\n"
|
||||
" <toolbar name='main-window-toolbar'>\n"
|
||||
" <toolitem action='open-torrent-toolbar'/>\n"
|
||||
" <toolitem action='torrent-start'/>\n"
|
||||
" <toolitem action='torrent-stop'/>\n"
|
||||
" <toolitem action='remove-torrent'/>\n"
|
||||
" <separator/>\n"
|
||||
" <toolitem action='show-torrent-properties'/>\n"
|
||||
" </toolbar>\n"
|
||||
"\n"
|
||||
" <popup name='main-window-popup'>\n"
|
||||
" <menuitem action='show-torrent-properties'/>\n"
|
||||
" <menuitem action='open-torrent-folder'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menu action='sort-menu'>\n"
|
||||
" <menuitem action='sort-by-activity'/>\n"
|
||||
" <menuitem action='sort-by-age'/>\n"
|
||||
" <menuitem action='sort-by-name'/>\n"
|
||||
" <menuitem action='sort-by-progress'/>\n"
|
||||
" <menuitem action='sort-by-ratio'/>\n"
|
||||
" <menuitem action='sort-by-size'/>\n"
|
||||
" <menuitem action='sort-by-state'/>\n"
|
||||
" <menuitem action='sort-by-time-left'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='sort-reversed'/>\n"
|
||||
" </menu>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='torrent-start'/>\n"
|
||||
" <menuitem action='torrent-start-now'/>\n"
|
||||
" <menuitem action='torrent-reannounce'/>\n"
|
||||
" <menu action='queue-menu'>\n"
|
||||
" <menuitem action='queue-move-top'/>\n"
|
||||
" <menuitem action='queue-move-up'/>\n"
|
||||
" <menuitem action='queue-move-down'/>\n"
|
||||
" <menuitem action='queue-move-bottom'/>\n"
|
||||
" </menu>\n"
|
||||
" <menuitem action='torrent-stop'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='relocate-torrent'/>\n"
|
||||
" <menuitem action='torrent-verify'/>\n"
|
||||
" <menuitem action='copy-magnet-link-to-clipboard'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='remove-torrent'/>\n"
|
||||
" <menuitem action='delete-torrent'/>\n"
|
||||
" </popup>\n"
|
||||
"\n"
|
||||
" <popup name='icon-popup'>\n"
|
||||
" <menuitem action='toggle-main-window'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='open-torrent-menu'/>\n"
|
||||
" <menuitem action='open-torrent-from-url'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='pause-all-torrents'/>\n"
|
||||
" <menuitem action='start-all-torrents'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='alt-speed-enabled'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='quit'/>\n"
|
||||
" </popup>\n"
|
||||
"\n"
|
||||
"</ui>";
|
||||
|
Loading…
Reference in a new issue