Commit 3d2d4891 authored by Morten Welinder's avatar Morten Welinder

UI: Use a resource for the ui definition file.

This allows running in-tree without an install ui file.  That, in turn,
saves a step in "git bisect" operations across versions of Gnumeric.
parent a511d454
2018-05-07 Morten Welinder <terra@gnome.org>
* src/wbc-gtk.c (wbc_gtk_init): Use a resource for the default ui
definition.
2018-05-06 Morten Welinder <terra@gnome.org>
* src/commands.c (cmd_area_set_array_expr): The clipboard now
......
......@@ -27,7 +27,6 @@ sstest
sstest.exe
ssdiff
ssdiff.exe
GNOME_Gnumeric-gtk.xml
libspreadsheet.def
local.def
stamp-local.def
......
......@@ -331,7 +331,7 @@
<menuitem action="HelpAbout"/>
</menu>
</menubar>
<toolbar _name="StandardToolbar">
<toolbar name="StandardToolbar">
<toolitem action="FileNew"/>
<toolitem action="FileOpen"/>
<toolitem action="FileSave"/>
......@@ -358,7 +358,7 @@
<toolitem action="Zoom"/>
<toolitem action="VZoom"/>
</toolbar>
<toolbar _name="FormatToolbar">
<toolbar name="FormatToolbar">
<toolitem action="FontName"/>
<toolitem action="VFontName"/>
<toolitem action="FontBold"/>
......@@ -388,7 +388,7 @@
<toolitem action="ColorBack"/>
<toolitem action="ColorFore"/>
</toolbar>
<toolbar _name="ObjectToolbar">
<toolbar name="ObjectToolbar">
<toolitem action="CreateRectangle"/>
<toolitem action="CreateEllipse"/>
<toolitem action="CreateFrame"/>
......
......@@ -527,14 +527,7 @@ EXTRA_DIST = \
gnm-marshalers.list \
README.gnm_float \
gnumeric.rc \
GNOME_Gnumeric-gtk.xml.in
gtkactiondir=$(gnumeric_datadir)
gtkaction_DATA = GNOME_Gnumeric-gtk.xml
GNOME_Gnumeric-gtk.xml: GNOME_Gnumeric-gtk.xml.in
sed -e 's/ _name *=/ name=/' <$< >$@
DISTCLEANFILES = GNOME_Gnumeric-gtk.xml
GNOME_Gnumeric-gtk.xml
if HAVE_INTROSPECTION
......
......@@ -181,5 +181,6 @@
<file alias="images/unknown_image.png">src/pixmaps/unknown_image.png</file>
<file alias="images/sheet_move_marker.png">src/pixmaps/sheet_move_marker.png</file>
<file alias="ui/gnumeric.css">src/gnumeric.css</file>
<file alias="ui/GNOME_Gnumeric-gtk.xml">src/GNOME_Gnumeric-gtk.xml</file>
</gresource>
</gresources>
......@@ -4996,6 +4996,7 @@ wbc_gtk_init (GObject *obj)
unsigned i;
GEnumClass *posclass;
GtkStyleContext *ctxt;
guint merge_id;
wbcg->gui = gnm_gtk_builder_load ("wbcg.ui", NULL, NULL);
wbcg->cancel_button = GET_GUI_ITEM ("cancel_button");
......@@ -5074,13 +5075,27 @@ wbc_gtk_init (GObject *obj)
gtk_action_group_add_actions (wbcg->actions, extra_actions,
extra_actions_nb, wbcg);
uifile = g_build_filename (gnm_sys_data_dir (),
(uifilename? uifilename: "GNOME_Gnumeric-gtk.xml"), NULL);
if (uifilename) {
if (strncmp (uifilename, "res:", 4) == 0)
uifile = g_strdup (uifilename);
else
uifile = g_build_filename (gnm_sys_data_dir (),
uifilename,
NULL);
} else
uifile = g_strdup ("res:/org/gnumeric/gnumeric/ui/GNOME_Gnumeric-gtk.xml");
if (!gtk_ui_manager_add_ui_from_file (wbcg->ui, uifile, &error)) {
if (strncmp (uifile, "res:", 4) == 0)
merge_id = gtk_ui_manager_add_ui_from_resource
(wbcg->ui, uifile + 4, &error);
else
merge_id = gtk_ui_manager_add_ui_from_file
(wbcg->ui, uifile, &error);
if (!merge_id) {
g_message ("building menus failed: %s", error->message);
g_error_free (error);
}
g_free (uifile);
wbcg->custom_uis = g_hash_table_new_full (g_direct_hash, g_direct_equal,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment