[evolution-data-server] Bug #581288 - Use GtkBuilder instead of libglade
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #581288 - Use GtkBuilder instead of libglade
- Date: Thu, 20 Aug 2009 16:42:39 +0000 (UTC)
commit 4ef00fee180d2ff8d8f41e1f0ffbf1ff6d03d1c4
Author: Milan Crha <mcrha redhat com>
Date: Thu Aug 20 18:41:09 2009 +0200
Bug #581288 - Use GtkBuilder instead of libglade
configure.ac | 8 +-
libedataserverui/Makefile.am | 6 +-
libedataserverui/e-categories-dialog.c | 77 +++--
libedataserverui/e-categories-dialog.glade | 466 -----------------------
libedataserverui/e-name-selector-dialog.c | 62 ++--
libedataserverui/e-name-selector-dialog.glade | 398 -------------------
libedataserverui/e-name-selector-dialog.h | 3 +-
servers/exchange/storage/exchange-account.c | 1 -
servers/exchange/storage/exchange-folder-size.c | 1 -
9 files changed, 96 insertions(+), 926 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index cd8fb54..90f8388 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,6 @@ m4_define([gtk_minimum_version], [2.14.0])
m4_define([ORBit_minimum_version], [2.9.8])
m4_define([libbonobo_minimum_version], [2.20.3])
m4_define([gconf_minimum_version], [2.0.0]) dnl XXX Just a Guess
-m4_define([libglade_minimum_version], [2.0.0]) dnl XXX Just a Guess
m4_define([libxml_minimum_version], [2.0.0]) dnl XXX Just a Guess
m4_define([libsoup_minimum_version], [2.3.0])
m4_define([gnome_keyring_minimum_version], [2.20.1])
@@ -294,7 +293,6 @@ PKG_CHECK_MODULES(GNOME_PLATFORM,
ORBit-2.0 >= ORBit_minimum_version
libbonobo-2.0 >= libbonobo_minimum_version
gconf-2.0 >= gconf_minimum_version
- libglade-2.0 >= libglade_minimum_version
libxml-2.0 >= libxml_minimum_version
libsoup-2.4 >= libsoup_minimum_version])
@@ -1512,7 +1510,7 @@ AC_SUBST(E_DATA_SERVER_LIBS)
dnl ******************************
dnl libedataserverui
dnl ******************************
-E_DATA_SERVER_UI_DEPS="gtk+-2.0 libglade-2.0 gobject-2.0 gthread-2.0 gconf-2.0 $GNOME_KEYRING_REQUIREMENT"
+E_DATA_SERVER_UI_DEPS="gtk+-2.0 libxml-2.0 gobject-2.0 gthread-2.0 gconf-2.0 $GNOME_KEYRING_REQUIREMENT"
EVO_SET_COMPILE_FLAGS(E_DATA_SERVER_UI, $E_DATA_SERVER_UI_DEPS, $THREADS_CFLAGS, $THREADS_LIBS)
AC_SUBST(E_DATA_SERVER_UI_CFLAGS)
@@ -1690,8 +1688,8 @@ AC_SUBST(serverdir)
extensiondir='${libdir}'/evolution-data-server-$API_VERSION/extensions
AC_SUBST(extensiondir)
-gladedir="$privdatadir/glade"
-AC_SUBST(gladedir)
+uidir="$privdatadir/ui"
+AC_SUBST(uidir)
if test $use_gweather = yes; then
weatherdatadir="$privdatadir/weather"
diff --git a/libedataserverui/Makefile.am b/libedataserverui/Makefile.am
index 2daaf7b..2d2852b 100644
--- a/libedataserverui/Makefile.am
+++ b/libedataserverui/Makefile.am
@@ -3,7 +3,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/addressbook \
-I$(top_builddir)/addressbook \
-DG_LOG_DOMAIN=\"e-data-server-ui\" \
- -DE_DATA_SERVER_UI_GLADEDIR=\""$(gladedir)"\" \
+ -DE_DATA_SERVER_UI_UIDIR=\""$(uidir)"\" \
$(E_DATA_SERVER_UI_CFLAGS)
# The marshallers
@@ -104,10 +104,10 @@ test_name_selector_LDADD = \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libedataserverui-$(API_VERSION).pc
-glade_DATA = e-categories-dialog.glade e-name-selector-dialog.glade
+ui_DATA = e-categories-dialog.ui e-name-selector-dialog.ui
EXTRA_DIST = \
- $(glade_DATA) \
+ $(ui_DATA) \
$(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in)
DISTCLEANFILES = $(pkgconfig_DATA)
diff --git a/libedataserverui/e-categories-dialog.c b/libedataserverui/e-categories-dialog.c
index 43b32e8..c49656a 100644
--- a/libedataserverui/e-categories-dialog.c
+++ b/libedataserverui/e-categories-dialog.c
@@ -25,7 +25,6 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glib/gi18n-lib.h>
-#include <glade/glade-xml.h>
#include "libedataserver/e-categories.h"
#include "libedataserver/libedataserver-private.h"
#include "e-categories-dialog.h"
@@ -36,7 +35,7 @@
((obj), E_TYPE_CATEGORIES_DIALOG, ECategoriesDialogPrivate))
struct _ECategoriesDialogPrivate {
- GladeXML *gui;
+ GtkBuilder *gui;
GtkWidget *categories_entry;
GtkWidget *categories_list;
GtkWidget *new_button;
@@ -61,7 +60,7 @@ static gpointer parent_class;
typedef struct {
ECategoriesDialog *parent;
- GladeXML *gui;
+ GtkBuilder *gui;
GtkWidget *the_dialog;
GtkWidget *category_name;
GtkWidget *category_icon;
@@ -90,28 +89,40 @@ static CategoryPropertiesDialog *
load_properties_dialog (ECategoriesDialog *parent)
{
CategoryPropertiesDialog *prop_dialog;
- gchar *gladefile;
+ gchar *ui_to_load[] = { "properties-dialog", NULL };
+ gchar *uifile;
+ GError *error = NULL;
prop_dialog = g_new0 (CategoryPropertiesDialog, 1);
- gladefile = g_build_filename (E_DATA_SERVER_UI_GLADEDIR,
- "e-categories-dialog.glade",
+ uifile = g_build_filename (E_DATA_SERVER_UI_UIDIR,
+ "e-categories-dialog.ui",
NULL);
- prop_dialog->gui = glade_xml_new (gladefile, "properties-dialog", GETTEXT_PACKAGE);
- g_free (gladefile);
-
- if (!prop_dialog->gui) {
+ prop_dialog->gui = gtk_builder_new ();
+ gtk_builder_set_translation_domain (prop_dialog->gui, GETTEXT_PACKAGE);
+
+ if (!gtk_builder_add_objects_from_file (prop_dialog->gui, uifile, ui_to_load, &error)) {
+ g_object_unref (prop_dialog->gui);
g_free (prop_dialog);
+ g_free (uifile);
+
+ g_warning ("%s: Failed to load e-categories-dialog.ui, %s", G_STRFUNC, error ? error->message : "Unknown error");
+
+ if (error)
+ g_error_free (error);
+
return NULL;
}
+ g_free (uifile);
+
prop_dialog->parent = parent;
- prop_dialog->the_dialog = glade_xml_get_widget (prop_dialog->gui, "properties-dialog");
+ prop_dialog->the_dialog = GTK_WIDGET (gtk_builder_get_object (prop_dialog->gui, "properties-dialog"));
gtk_window_set_transient_for (GTK_WINDOW (prop_dialog->the_dialog), GTK_WINDOW (parent));
- prop_dialog->category_name = glade_xml_get_widget (prop_dialog->gui, "category-name");
- prop_dialog->category_icon = glade_xml_get_widget (prop_dialog->gui, "category-icon");
+ prop_dialog->category_name = GTK_WIDGET (gtk_builder_get_object (prop_dialog->gui, "category-name"));
+ prop_dialog->category_icon = GTK_WIDGET (gtk_builder_get_object (prop_dialog->gui, "category-icon"));
if (prop_dialog->category_icon) {
GtkFileChooser *chooser = GTK_FILE_CHOOSER (prop_dialog->category_icon);
@@ -552,30 +563,42 @@ categories_dialog_init (ECategoriesDialog *dialog)
GtkTreeView *tree_view;
GtkWidget *main_widget;
GtkWidget *content_area;
- gchar *gladefile;
+ gchar *uifile;
+ gchar *ui_to_load[] = {"table-categories", NULL};
+ GError *error = NULL;
dialog->priv = E_CATEGORIES_DIALOG_GET_PRIVATE (dialog);
dialog->priv->selected_categories = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- /* load the UI from our Glade file */
- gladefile = g_build_filename (E_DATA_SERVER_UI_GLADEDIR,
- "e-categories-dialog.glade",
+ /* load the UI from our UI file */
+ uifile = g_build_filename (E_DATA_SERVER_UI_UIDIR,
+ "e-categories-dialog.ui",
NULL);
- dialog->priv->gui = glade_xml_new (gladefile, "table-categories", GETTEXT_PACKAGE);
- g_free (gladefile);
+ dialog->priv->gui = gtk_builder_new ();
+ gtk_builder_set_translation_domain (dialog->priv->gui, GETTEXT_PACKAGE);
+
+ if (!gtk_builder_add_objects_from_file (dialog->priv->gui, uifile, ui_to_load, &error)) {
+ g_free (uifile);
+ g_object_unref (dialog->priv->gui);
+ dialog->priv->gui = NULL;
+
+ g_warning ("%s: can't load e-categories-dialog.ui file, %s", G_STRFUNC, error ? error->message : "Unknown error");
+
+ if (error)
+ g_error_free (error);
- if (!dialog->priv->gui) {
- g_warning (G_STRLOC ": can't load e-categories-dialog.glade file");
return;
}
+ g_free (uifile);
+
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
- main_widget = glade_xml_get_widget (dialog->priv->gui, "table-categories");
+ main_widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "table-categories"));
gtk_box_pack_start (GTK_BOX (content_area), main_widget, TRUE, TRUE, 0);
- dialog->priv->categories_entry = glade_xml_get_widget (dialog->priv->gui, "entry-categories");
- dialog->priv->categories_list = glade_xml_get_widget (dialog->priv->gui, "categories-list");
+ dialog->priv->categories_entry = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "entry-categories"));
+ dialog->priv->categories_list = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "categories-list"));
tree_view = GTK_TREE_VIEW (dialog->priv->categories_list);
selection = gtk_tree_view_get_selection (tree_view);
@@ -593,11 +616,11 @@ categories_dialog_init (ECategoriesDialog *dialog)
gtk_entry_set_completion (GTK_ENTRY (dialog->priv->categories_entry), completion);
g_object_unref (completion);
- dialog->priv->new_button = glade_xml_get_widget (dialog->priv->gui, "button-new");
+ dialog->priv->new_button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "button-new"));
g_signal_connect (G_OBJECT (dialog->priv->new_button), "clicked", G_CALLBACK (new_button_clicked_cb), dialog);
- dialog->priv->edit_button = glade_xml_get_widget (dialog->priv->gui, "button-edit");
+ dialog->priv->edit_button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "button-edit"));
g_signal_connect (G_OBJECT (dialog->priv->edit_button), "clicked", G_CALLBACK (edit_button_clicked_cb), dialog);
- dialog->priv->delete_button = glade_xml_get_widget (dialog->priv->gui, "button-delete");
+ dialog->priv->delete_button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "button-delete"));
g_signal_connect_swapped (
G_OBJECT (dialog->priv->delete_button), "clicked",
G_CALLBACK (categories_dialog_delete_cb), dialog);
diff --git a/libedataserverui/e-name-selector-dialog.c b/libedataserverui/e-name-selector-dialog.c
index d9ba49f..620fe7a 100644
--- a/libedataserverui/e-name-selector-dialog.c
+++ b/libedataserverui/e-name-selector-dialog.c
@@ -106,8 +106,8 @@ e_name_selector_dialog_populate_categories (ENameSelectorDialog *name_selector_d
GList *category_list, *iter;
/* "Any Category" is preloaded. */
- combo_box = glade_xml_get_widget (
- name_selector_dialog->gui, "combobox-category");
+ combo_box = GTK_WIDGET (gtk_builder_get_object (
+ name_selector_dialog->gui, "combobox-category"));
if (gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box)) == -1)
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
@@ -136,24 +136,40 @@ e_name_selector_dialog_init (ENameSelectorDialog *name_selector_dialog)
GtkWidget *parent;
GtkTreeSelection *selection;
ESourceList *source_list;
- gchar *gladefile;
+ gchar *uifile;
GConfClient *gconf_client;
gchar *uid;
+ GError *error = NULL;
ENameSelectorDialogPrivate *priv = E_NAME_SELECTOR_DIALOG_GET_PRIVATE (name_selector_dialog);
priv->destination_index = 0;
priv->user_query_fields = NULL;
- /* Get Glade GUI */
- gladefile = g_build_filename (E_DATA_SERVER_UI_GLADEDIR,
- "e-name-selector-dialog.glade",
- NULL);
- name_selector_dialog->gui = glade_xml_new (gladefile, NULL, GETTEXT_PACKAGE);
- g_free (gladefile);
+ /* Get GtkBuilder GUI */
+ uifile = g_build_filename (E_DATA_SERVER_UI_UIDIR,
+ "e-name-selector-dialog.ui",
+ NULL);
+ name_selector_dialog->gui = gtk_builder_new ();
+ gtk_builder_set_translation_domain (name_selector_dialog->gui, GETTEXT_PACKAGE);
+
+ if (!gtk_builder_add_from_file (name_selector_dialog->gui, uifile, &error)) {
+ g_free (uifile);
+ g_object_unref (name_selector_dialog->gui);
+ name_selector_dialog->gui = NULL;
+
+ g_warning ("%s: Cannot load e-name-selector-dialog.ui file, %s", G_STRFUNC, error ? error->message : "Unknown error");
+
+ if (error)
+ g_error_free (error);
+
+ return;
+ }
+
+ g_free (uifile);
- widget = glade_xml_get_widget (name_selector_dialog->gui, "name-selector-box");
+ widget = GTK_WIDGET (gtk_builder_get_object (name_selector_dialog->gui, "name-selector-box"));
if (!widget) {
- g_warning ("ENameSelectorDialog can't load Glade interface!");
+ g_warning ("%s: Cannot load e-name-selector-dialog.ui file", G_STRFUNC);
g_object_unref (name_selector_dialog->gui);
name_selector_dialog->gui = NULL;
return;
@@ -181,13 +197,13 @@ e_name_selector_dialog_init (ENameSelectorDialog *name_selector_dialog)
/* Store pointers to relevant widgets */
name_selector_dialog->contact_view = GTK_TREE_VIEW (
- glade_xml_get_widget (name_selector_dialog->gui, "source-tree-view"));
+ gtk_builder_get_object (name_selector_dialog->gui, "source-tree-view"));
name_selector_dialog->status_label = GTK_LABEL (
- glade_xml_get_widget (name_selector_dialog->gui, "status-message"));
+ gtk_builder_get_object (name_selector_dialog->gui, "status-message"));
name_selector_dialog->destination_box = GTK_BOX (
- glade_xml_get_widget (name_selector_dialog->gui, "destination-box"));
+ gtk_builder_get_object (name_selector_dialog->gui, "destination-box"));
name_selector_dialog->search_entry = GTK_ENTRY (
- glade_xml_get_widget (name_selector_dialog->gui, "search"));
+ gtk_builder_get_object (name_selector_dialog->gui, "search"));
/* Create size group for transfer buttons */
@@ -242,19 +258,19 @@ e_name_selector_dialog_init (ENameSelectorDialog *name_selector_dialog)
g_free (uid);
}
- label = glade_xml_get_widget (name_selector_dialog->gui, "AddressBookLabel");
+ label = GTK_WIDGET (gtk_builder_get_object (name_selector_dialog->gui, "AddressBookLabel"));
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
gtk_widget_show (widget);
- container = glade_xml_get_widget (name_selector_dialog->gui, "source-menu-box");
+ container = GTK_WIDGET (gtk_builder_get_object (name_selector_dialog->gui, "source-menu-box"));
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
e_name_selector_dialog_populate_categories (name_selector_dialog);
/* Set up search-as-you-type signal */
- widget = glade_xml_get_widget (name_selector_dialog->gui, "search");
+ widget = GTK_WIDGET (gtk_builder_get_object (name_selector_dialog->gui, "search"));
g_signal_connect_swapped (widget, "changed", G_CALLBACK (search_changed), name_selector_dialog);
/* Display initial source */
@@ -749,8 +765,8 @@ search_changed (ENameSelectorDialog *name_selector_dialog)
gchar *category_escaped;
gchar *user_fields_str;
- combo_box = glade_xml_get_widget (
- name_selector_dialog->gui, "combobox-category");
+ combo_box = GTK_WIDGET (gtk_builder_get_object (
+ name_selector_dialog->gui, "combobox-category"));
if (gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box)) == -1)
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
@@ -1263,9 +1279,9 @@ e_name_selector_dialog_set_destination_index (ENameSelectorDialog *name_selector
priv->destination_index = index;
}
-/* ----------------------------------- *
- * Widget creation functions for Glade *
- * ----------------------------------- */
+/* ---------------------------------------- *
+ * Widget creation functions for GtkBuilder *
+ * ---------------------------------------- */
#ifdef CATEGORIES_COMPONENTS_MOVED
diff --git a/libedataserverui/e-name-selector-dialog.h b/libedataserverui/e-name-selector-dialog.h
index 143914b..76cd3c6 100644
--- a/libedataserverui/e-name-selector-dialog.h
+++ b/libedataserverui/e-name-selector-dialog.h
@@ -25,7 +25,6 @@
#define E_NAME_SELECTOR_DIALOG_H
#include <gtk/gtk.h>
-#include <glade/glade.h>
#include <libebook/e-book.h>
#include <libedataserverui/e-contact-store.h>
#include <libedataserverui/e-name-selector-model.h>
@@ -68,7 +67,7 @@ struct _ENameSelectorDialog {
ENameSelectorModel *name_selector_model;
GtkTreeModelSort *contact_sort;
- GladeXML *gui;
+ GtkBuilder *gui;
GtkTreeView *contact_view;
GtkLabel *status_label;
GtkBox *destination_box;
diff --git a/servers/exchange/storage/exchange-account.c b/servers/exchange/storage/exchange-account.c
index ab6f077..b4e4ec7 100644
--- a/servers/exchange/storage/exchange-account.c
+++ b/servers/exchange/storage/exchange-account.c
@@ -43,7 +43,6 @@
#include "exchange-esource.h"
#include <libedataserverui/e-passwords.h>
-#include <glade/glade-xml.h>
#include <gtk/gtk.h>
#include <stdlib.h>
diff --git a/servers/exchange/storage/exchange-folder-size.c b/servers/exchange/storage/exchange-folder-size.c
index 5b87241..c041e7d 100644
--- a/servers/exchange/storage/exchange-folder-size.c
+++ b/servers/exchange/storage/exchange-folder-size.c
@@ -25,7 +25,6 @@
#include <string.h>
-#include <glade/glade-xml.h>
#include <gtk/gtk.h>
#include "exchange-hierarchy-webdav.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]