diff options
author | rbuj <[email protected]> | 2019-02-22 12:02:30 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-04-23 11:59:07 +0200 |
commit | de1be0a956d49a82b67ec92741899fea7da60e3a (patch) | |
tree | b73669266033a90ce39789f922ca90343138eaba /src/terminal-window.c | |
parent | 0aa5954350341dca1d262915b956b3bc2ee7577d (diff) | |
download | mate-terminal-de1be0a956d49a82b67ec92741899fea7da60e3a.tar.bz2 mate-terminal-de1be0a956d49a82b67ec92741899fea7da60e3a.tar.xz |
Use gresources for about_DATA, uimanager_DATA & builder_DATA
Diffstat (limited to 'src/terminal-window.c')
-rw-r--r-- | src/terminal-window.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c index b5f5e5f..df6347c 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -2237,14 +2237,10 @@ terminal_window_init (TerminalWindow *window) /* Load the UI */ error = NULL; - priv->ui_id = gtk_ui_manager_add_ui_from_file (manager, - TERM_PKGDATADIR G_DIR_SEPARATOR_S "terminal.xml", + priv->ui_id = gtk_ui_manager_add_ui_from_resource (manager, + TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/terminal.xml", &error); - if (error) - { - g_printerr ("Failed to load UI: %s\n", error->message); - g_error_free (error); - } + g_assert_no_error (error); priv->menubar = gtk_ui_manager_get_widget (manager, "/menubar"); gtk_box_pack_start (GTK_BOX (priv->main_vbox), @@ -4342,26 +4338,31 @@ help_about_callback (GtkAction *action, "Copyright © 2011 Perberos\n" "Copyright © 2012-2019 MATE developers"; char *licence_text; + GBytes *bytes; + const guint8 *data; GKeyFile *key_file; GError *error = NULL; char **authors, **contributors, **artists, **documenters, **array_strv; - gsize n_authors = 0, n_contributors = 0, n_artists = 0, n_documenters = 0 , i; + gsize data_len, n_authors = 0, n_contributors = 0, n_artists = 0, n_documenters = 0 , i; GPtrArray *array; + + bytes = g_resources_lookup_data (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/terminal.about", + G_RESOURCE_LOOKUP_FLAGS_NONE, + &error); + g_assert_no_error (error); + + data = g_bytes_get_data (bytes, &data_len); key_file = g_key_file_new (); - if (!g_key_file_load_from_file (key_file, TERM_PKGDATADIR G_DIR_SEPARATOR_S "terminal.about", 0, &error)) - { - g_warning ("Couldn't load about data: %s\n", error->message); - g_error_free (error); - g_key_file_free (key_file); - return; - } + g_key_file_load_from_data (key_file, (const char *) data, data_len, 0, &error); + g_assert_no_error (error); authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Authors", &n_authors, NULL); contributors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Contributors", &n_contributors, NULL); artists = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Artists", &n_artists, NULL); documenters = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Documenters", &n_documenters, NULL); g_key_file_free (key_file); + g_bytes_unref (bytes); array = g_ptr_array_new (); |