GTK: Move .ui string into a GResource
This makes it easier to edit those files in Glade or such, while keeping it inside the final binary. As a bonus, XML data is getting minified at the packing step.
This commit is contained in:
parent
02e49123da
commit
b568fbc5dc
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/org/desmume/DeSmuME">
|
||||
<file preprocess="xml-stripblanks" compressed="true">org.desmume.DeSmuME.svg</file>
|
||||
<file preprocess="xml-stripblanks" compressed="true">toolbar.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
|
@ -1124,42 +1124,6 @@ static const GActionEntry app_entries[] = {
|
|||
{ "about", About },
|
||||
};
|
||||
|
||||
static const char *toolbar =
|
||||
"<?xml version='1.0' encoding='UTF-8'?>"
|
||||
"<interface>"
|
||||
" <requires lib='gtk+' version='3.24'/>"
|
||||
" <object class='GtkBox' id='toolbar'>"
|
||||
" <child>"
|
||||
" <object class='GtkToolButton'>"
|
||||
" <property name='label' translatable='yes'>_Open</property>"
|
||||
" <property name='icon-name'>document-open</property>"
|
||||
" <property name='action-name'>app.open</property>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" <child>"
|
||||
" <object class='GtkToolButton'>"
|
||||
" <property name='label' translatable='yes'>_Run</property>"
|
||||
" <property name='icon-name'>media-playback-start</property>"
|
||||
" <property name='action-name'>app.run</property>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" <child>"
|
||||
" <object class='GtkToolButton'>"
|
||||
" <property name='label' translatable='yes'>_Pause</property>"
|
||||
" <property name='icon-name'>media-playback-pause</property>"
|
||||
" <property name='action-name'>app.pause</property>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" <child>"
|
||||
" <object class='GtkToolButton'>"
|
||||
" <property name='label' translatable='yes'>_Quit</property>"
|
||||
" <property name='icon-name'>application-exit</property>"
|
||||
" <property name='action-name'>app.quit</property>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" </object>"
|
||||
"</interface>";
|
||||
|
||||
static const char *graphics_settings =
|
||||
"<?xml version='1.0' encoding='UTF-8'?>"
|
||||
"<interface>"
|
||||
|
@ -4052,7 +4016,7 @@ common_gtk_main(GApplication *app, gpointer user_data)
|
|||
gtk_container_add(GTK_CONTAINER(pWindow), pBox);
|
||||
|
||||
/* Create the toolbar */
|
||||
GtkBuilder *builder = gtk_builder_new_from_string(toolbar, -1);
|
||||
GtkBuilder *builder = gtk_builder_new_from_resource("/org/desmume/DeSmuME/toolbar.ui");
|
||||
pToolBar = GTK_WIDGET(gtk_builder_get_object(builder, "toolbar"));
|
||||
gtk_container_add(GTK_CONTAINER(pBox), pToolBar);
|
||||
g_object_unref(builder);
|
||||
|
|
|
@ -3,6 +3,12 @@ dep_x11 = dependency('x11')
|
|||
|
||||
gtk_dependencies = dependencies + [dep_gtk3, dep_x11]
|
||||
|
||||
gnome = import('gnome')
|
||||
|
||||
gresource = gnome.compile_resources(
|
||||
'gresource', 'desmume.gresource.xml',
|
||||
)
|
||||
|
||||
desmume_src = [
|
||||
'avout_pipe_base.cpp',
|
||||
'avout_x264.cpp',
|
||||
|
@ -17,6 +23,7 @@ desmume_src = [
|
|||
'sdl_3Demu.cpp',
|
||||
'cheatsGTK.cpp',
|
||||
'main.cpp',
|
||||
gresource,
|
||||
]
|
||||
|
||||
# TODO: why do we have to redeclare it here with one more fs level?
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<interface>
|
||||
<requires lib='gtk+' version='3.24'/>
|
||||
<object class='GtkBox' id='toolbar'>
|
||||
<child>
|
||||
<object class='GtkToolButton'>
|
||||
<property name='label' translatable='yes'>_Open</property>
|
||||
<property name='icon-name'>document-open</property>
|
||||
<property name='action-name'>app.open</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class='GtkToolButton'>
|
||||
<property name='label' translatable='yes'>_Run</property>
|
||||
<property name='icon-name'>media-playback-start</property>
|
||||
<property name='action-name'>app.run</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class='GtkToolButton'>
|
||||
<property name='label' translatable='yes'>_Pause</property>
|
||||
<property name='icon-name'>media-playback-pause</property>
|
||||
<property name='action-name'>app.pause</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class='GtkToolButton'>
|
||||
<property name='label' translatable='yes'>_Quit</property>
|
||||
<property name='icon-name'>application-exit</property>
|
||||
<property name='action-name'>app.quit</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
Loading…
Reference in New Issue