summaryrefslogtreecommitdiff
path: root/src/math-buttons.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-05-02 12:21:04 +0200
committerraveit65 <[email protected]>2019-05-04 21:11:48 +0200
commitb3605bee34d6b62eb4e5057bbad40513bdc600df (patch)
treeae1e2c3c91b19dca750974667b3d265b88c10557 /src/math-buttons.c
parentd97327cd31de7d47054ee4caa299de51d9b4349e (diff)
downloadmate-calc-b3605bee34d6b62eb4e5057bbad40513bdc600df.tar.bz2
mate-calc-b3605bee34d6b62eb4e5057bbad40513bdc600df.tar.xz
Use gresources for UI files
.ui files are combined into a binary resource bundle, and they are marked as compressed, so they will be automatically uncompressed when the resource is used. REF https://developer.gnome.org/gio/stable/GResource.html
Diffstat (limited to 'src/math-buttons.c')
-rw-r--r--src/math-buttons.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/math-buttons.c b/src/math-buttons.c
index a97d6ee..50b15a7 100644
--- a/src/math-buttons.c
+++ b/src/math-buttons.c
@@ -60,10 +60,10 @@ struct MathButtonsPrivate
G_DEFINE_TYPE_WITH_PRIVATE (MathButtons, math_buttons, GTK_TYPE_BOX);
-#define UI_BASIC_FILE UI_DIR "/buttons-basic.ui"
-#define UI_ADVANCED_FILE UI_DIR "/buttons-advanced.ui"
-#define UI_FINANCIAL_FILE UI_DIR "/buttons-financial.ui"
-#define UI_PROGRAMMING_FILE UI_DIR "/buttons-programming.ui"
+#define UI_BASIC_RESOURCE_PATH "/org/mate/calculator/ui/buttons-basic.ui"
+#define UI_ADVANCED_RESOURCE_PATH "/org/mate/calculator/ui/buttons-advanced.ui"
+#define UI_FINANCIAL_RESOURCE_PATH "/org/mate/calculator/ui/buttons-financial.ui"
+#define UI_PROGRAMMING_RESOURCE_PATH "/org/mate/calculator/ui/buttons-programming.ui"
#define GET_WIDGET(ui, name) \
GTK_WIDGET(gtk_builder_get_object((ui), (name)))
@@ -478,7 +478,7 @@ load_mode(MathButtons *buttons, ButtonMode mode)
GtkBuilder *builder, **builder_ptr;
gint i;
gchar *name;
- const gchar *builder_file;
+ const gchar *path;
static gchar *objects[] = { "button_panel", "character_code_dialog", "currency_dialog",
"ctrm_dialog", "ddb_dialog", "fv_dialog", "gpm_dialog",
"pmt_dialog", "pv_dialog", "rate_dialog", "sln_dialog",
@@ -490,22 +490,22 @@ load_mode(MathButtons *buttons, ButtonMode mode)
default:
case BASIC:
builder_ptr = &buttons->priv->basic_ui;
- builder_file = UI_BASIC_FILE;
+ path = UI_BASIC_RESOURCE_PATH;
panel = &buttons->priv->bas_panel;
break;
case ADVANCED:
builder_ptr = &buttons->priv->advanced_ui;
- builder_file = UI_ADVANCED_FILE;
+ path = UI_ADVANCED_RESOURCE_PATH;
panel = &buttons->priv->adv_panel;
break;
case FINANCIAL:
builder_ptr = &buttons->priv->financial_ui;
- builder_file = UI_FINANCIAL_FILE;
+ path = UI_FINANCIAL_RESOURCE_PATH;
panel = &buttons->priv->fin_panel;
break;
case PROGRAMMING:
builder_ptr = &buttons->priv->programming_ui;
- builder_file = UI_PROGRAMMING_FILE;
+ path = UI_PROGRAMMING_RESOURCE_PATH;
panel = &buttons->priv->prog_panel;
break;
}
@@ -515,7 +515,7 @@ load_mode(MathButtons *buttons, ButtonMode mode)
builder = *builder_ptr = gtk_builder_new();
// FIXME: Show dialog if failed to load
- gtk_builder_add_objects_from_file(builder, builder_file, objects, &error);
+ gtk_builder_add_objects_from_resource(builder, path, objects, &error);
if (error) {
g_warning("Error loading button UI: %s", error->message);
g_clear_error(&error);