[easytag/wip/future-gtk: 13/15] Use gtk_builder_new_from_resource()
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/future-gtk: 13/15] Use gtk_builder_new_from_resource()
- Date: Thu, 14 May 2015 05:41:08 +0000 (UTC)
commit 122f513736ab36592e4c43ddd83716c153b8f088
Author: David King <amigadave amigadave com>
Date: Thu May 14 07:01:03 2015 +0200
Use gtk_builder_new_from_resource()
src/application.c | 10 +--------
src/application_window.c | 12 +----------
src/browser.c | 47 +++------------------------------------------
src/log.c | 11 +---------
src/tag_area.c | 12 +----------
5 files changed, 8 insertions(+), 84 deletions(-)
---
diff --git a/src/application.c b/src/application.c
index 7e12b9b..590e258 100644
--- a/src/application.c
+++ b/src/application.c
@@ -522,7 +522,6 @@ static void
et_application_startup (GApplication *application)
{
GtkBuilder *builder;
- GError *error = NULL;
GMenuModel *appmenu;
GMenuModel *menubar;
@@ -533,14 +532,7 @@ et_application_startup (GApplication *application)
/* gtk_init() calls setlocale(), so gettext must be called after that. */
g_set_application_name (_(PACKAGE_NAME));
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder, "/org/gnome/EasyTAG/menus.ui",
- &error);
-
- if (error != NULL)
- {
- g_error ("Unable to get app menu from resource: %s", error->message);
- }
+ builder = gtk_builder_new_from_resource ("/org/gnome/EasyTAG/menus.ui");
appmenu = G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"));
gtk_application_set_app_menu (GTK_APPLICATION (application), appmenu);
diff --git a/src/application_window.c b/src/application_window.c
index 66e2a6f..e5083f7 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -1653,19 +1653,9 @@ et_application_window_init (EtApplicationWindow *self)
/* Menu bar and tool bar. */
{
GtkBuilder *builder;
- GError *error = NULL;
GtkWidget *toolbar;
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder,
- "/org/gnome/EasyTAG/toolbar.ui",
- &error);
-
- if (error != NULL)
- {
- g_error ("Unable to get toolbar from resource: %s",
- error->message);
- }
+ builder = gtk_builder_new_from_resource ("/org/gnome/EasyTAG/toolbar.ui");
toolbar = GTK_WIDGET (gtk_builder_get_object (builder, "main_toolbar"));
gtk_box_pack_start (GTK_BOX (main_vbox), toolbar, FALSE, FALSE, 0);
diff --git a/src/browser.c b/src/browser.c
index a9758af..9c99a97 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -3853,7 +3853,6 @@ create_browser (EtBrowser *self)
EtBrowserPrivate *priv;
gsize i;
GtkBuilder *builder;
- GError *error = NULL;
GMenuModel *menu_model;
priv = et_browser_get_instance_private (self);
@@ -3873,15 +3872,7 @@ create_browser (EtBrowser *self)
Browser_Tree_Initialize (self);
/* Create popup menu on browser tree view. */
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder, "/org/gnome/EasyTAG/menus.ui",
- &error);
-
- if (error != NULL)
- {
- g_error ("Unable to get popup menu from resource: %s",
- error->message);
- }
+ builder = gtk_builder_new_from_resource ("/org/gnome/EasyTAG/menus.ui");
menu_model = G_MENU_MODEL (gtk_builder_get_object (builder,
"directory-menu"));
@@ -4043,7 +4034,6 @@ et_browser_show_rename_directory_dialog (EtBrowser *self)
{
EtBrowserPrivate *priv;
GtkBuilder *builder;
- GError *error = NULL;
GtkWidget *label;
GtkWidget *button;
gchar *directory_parent = NULL;
@@ -4087,16 +4077,7 @@ et_browser_show_rename_directory_dialog (EtBrowser *self)
directory_name_utf8 = filename_to_display(directory_name);
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder,
- "/org/gnome/EasyTAG/browser_dialogs.ui",
- &error);
-
- if (error != NULL)
- {
- g_error ("Unable to get rename directory dialog from resource: %s",
- error->message);
- }
+ builder = gtk_builder_new_from_resource ("/org/gnome/EasyTAG/browser_dialogs.ui");
priv->rename_directory_dialog = GTK_WIDGET (gtk_builder_get_object (builder,
"rename_directory_dialog"));
@@ -4485,7 +4466,6 @@ et_browser_show_open_directory_with_dialog (EtBrowser *self)
{
EtBrowserPrivate *priv;
GtkBuilder *builder;
- GError *error = NULL;
GtkWidget *button;
gchar *current_directory = NULL;
@@ -4507,16 +4487,7 @@ et_browser_show_open_directory_with_dialog (EtBrowser *self)
current_directory = g_strdup (priv->current_path);
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder,
- "/org/gnome/EasyTAG/browser_dialogs.ui",
- &error);
-
- if (error != NULL)
- {
- g_error ("Unable to get open directory with dialog from resource: %s",
- error->message);
- }
+ builder = gtk_builder_new_from_resource ("/org/gnome/EasyTAG/browser_dialogs.ui");
priv->open_directory_with_dialog = GTK_WIDGET (gtk_builder_get_object (builder,
"open_directory_dialog"));
@@ -4721,7 +4692,6 @@ et_browser_show_open_files_with_dialog (EtBrowser *self)
{
EtBrowserPrivate *priv;
GtkBuilder *builder;
- GError *error = NULL;
GtkWidget *button;
g_return_if_fail (ET_BROWSER (self));
@@ -4734,16 +4704,7 @@ et_browser_show_open_files_with_dialog (EtBrowser *self)
return;
}
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder,
- "/org/gnome/EasyTAG/browser_dialogs.ui",
- &error);
-
- if (error != NULL)
- {
- g_error ("Unable to get open with files dialog from resource: %s",
- error->message);
- }
+ builder = gtk_builder_new_from_resource ("/org/gnome/EasyTAG/browser_dialogs.ui");
priv->open_files_with_dialog = GTK_WIDGET (gtk_builder_get_object (builder,
"open_files_dialog"));
diff --git a/src/log.c b/src/log.c
index 6f0b59d..cbb0c50 100644
--- a/src/log.c
+++ b/src/log.c
@@ -137,7 +137,6 @@ et_log_area_init (EtLogArea *self)
{
EtLogAreaPrivate *priv;
GtkBuilder *builder;
- GError *error = NULL;
GMenuModel *menu_model;
priv = et_log_area_get_instance_private (self);
@@ -145,15 +144,7 @@ et_log_area_init (EtLogArea *self)
gtk_widget_init_template (GTK_WIDGET (self));
/* Create popup menu. */
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder, "/org/gnome/EasyTAG/menus.ui",
- &error);
-
- if (error != NULL)
- {
- g_error ("Unable to get popup menu from resource: %s",
- error->message);
- }
+ builder = gtk_builder_new_from_resource ("/org/gnome/EasyTAG/menus.ui");
menu_model = G_MENU_MODEL (gtk_builder_get_object (builder, "log-menu"));
priv->menu = gtk_menu_new_from_model (menu_model);
diff --git a/src/tag_area.c b/src/tag_area.c
index 2ebca50..cee3207 100644
--- a/src/tag_area.c
+++ b/src/tag_area.c
@@ -1655,7 +1655,6 @@ on_picture_properties_button_clicked (GObject *object,
GtkTreePath *rowPath;
gboolean valid;
GtkBuilder *builder;
- GError *error = NULL;
/* Get corresponding picture. */
valid = gtk_tree_model_get_iter (model, &iter, path);
@@ -1670,16 +1669,7 @@ on_picture_properties_button_clicked (GObject *object,
break;
}
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder,
- "/org/gnome/EasyTAG/image_properties_dialog.ui",
- &error);
-
- if (error != NULL)
- {
- g_error ("Unable to get image properties dialog from resource: %s",
- error->message);
- }
+ builder = gtk_builder_new_from_resource ("/org/gnome/EasyTAG/image_properties_dialog.ui");
title = g_strdup_printf (_("Image Properties %d/%d"), selection_i++,
selection_nbr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]