aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-09-25 06:04:36 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-11-17 08:33:32 +0800
commit054c0881696a85f537e93b4950a28f505a3dc0f7 (patch)
treee63cfece426e2de5898c926eb6737cff229bb38b /e-util
parent6348266ee635db59a12d75497f980dd85d0fcf58 (diff)
downloadgsoc2013-evolution-054c0881696a85f537e93b4950a28f505a3dc0f7.tar
gsoc2013-evolution-054c0881696a85f537e93b4950a28f505a3dc0f7.tar.gz
gsoc2013-evolution-054c0881696a85f537e93b4950a28f505a3dc0f7.tar.bz2
gsoc2013-evolution-054c0881696a85f537e93b4950a28f505a3dc0f7.tar.lz
gsoc2013-evolution-054c0881696a85f537e93b4950a28f505a3dc0f7.tar.xz
gsoc2013-evolution-054c0881696a85f537e93b4950a28f505a3dc0f7.tar.zst
gsoc2013-evolution-054c0881696a85f537e93b4950a28f505a3dc0f7.zip
BugĀ 589153 - Use GtkBuilder instead of libglade
Diffstat (limited to 'e-util')
-rw-r--r--e-util/Makefile.am6
-rw-r--r--e-util/e-util-private.h4
-rw-r--r--e-util/e-util.c59
-rw-r--r--e-util/e-util.h12
-rw-r--r--e-util/e-win32-reloc.c2
5 files changed, 72 insertions, 11 deletions
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 3014458f28..c0b12d63c1 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -63,7 +63,6 @@ libeutil_la_CPPFLAGS = \
-DEVOLUTION_ECPSDIR=\""$(ecpsdir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_HELPDIR=\""$(evolutionhelpdir)"\" \
-DEVOLUTION_ICONSDIR=\""$(imagesdir)"\" \
-DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
@@ -76,7 +75,7 @@ libeutil_la_CPPFLAGS = \
-DEVOLUTION_SOUNDDIR=\""$(soundsdir)"\" \
-DEVOLUTION_SYSCONFDIR=\""$(sysconfdir)"\" \
-DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \
- -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
+ -DEVOLUTION_UIDIR=\""$(uidir)"\" \
-DSEARCH_RULE_DIR=\"$(ruledir)\" \
-DG_LOG_DOMAIN=\"e-utils\" \
$(GNOME_PILOT_CFLAGS) \
@@ -166,7 +165,6 @@ libeconduit_la_CPPFLAGS = \
-DEVOLUTION_ECPSDIR=\""$(ecpsdir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_HELPDIR=\""$(evolutionhelpdir)"\" \
-DEVOLUTION_ICONSDIR=\""$(imagesdir)"\" \
-DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
@@ -179,7 +177,7 @@ libeconduit_la_CPPFLAGS = \
-DEVOLUTION_SOUNDDIR=\""$(soundsdir)"\" \
-DEVOLUTION_SYSCONFDIR=\""$(sysconfdir)"\" \
-DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \
- -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
+ -DEVOLUTION_UIDIR=\""$(uidir)"\" \
-DSEARCH_RULE_DIR=\"$(ruledir)\" \
-DG_LOG_DOMAIN=\"e-utils\" \
$(GNOME_PILOT_CFLAGS) \
diff --git a/e-util/e-util-private.h b/e-util/e-util-private.h
index 7c77f12d27..775895eba7 100644
--- a/e-util/e-util-private.h
+++ b/e-util/e-util-private.h
@@ -86,8 +86,8 @@ const gchar *_e_get_uidir (void) G_GNUC_CONST;
#undef EVOLUTION_GALVIEWSDIR
#define EVOLUTION_GALVIEWSDIR _e_get_galviewsdir ()
-#undef EVOLUTION_GLADEDIR
-#define EVOLUTION_GLADEDIR _e_get_gladedir ()
+#undef EVOLUTION_UIDIR
+#define EVOLUTION_UIDIR _e_get_gladedir ()
#undef EVOLUTION_HELPDIR
#define EVOLUTION_HELPDIR _e_get_helpdir ()
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 6a9ad6d780..800974577c 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -47,6 +47,7 @@
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-categories.h>
+#include <libedataserver/e-source-list.h>
#include "filter/e-filter-option.h"
@@ -281,7 +282,36 @@ e_lookup_action_group (GtkUIManager *ui_manager,
}
/**
- * e_load_ui_definition:
+ * e_load_ui_builder_definition:
+ * @builder: a #GtkBuilder
+ * @basename: basename of the UI definition file
+ *
+ * Loads a UI definition into @builder from Evolution's UI directory.
+ * Failure here is fatal, since the application can't function without
+ * its UI definitions.
+ **/
+void
+e_load_ui_builder_definition (GtkBuilder *builder,
+ const gchar *basename)
+{
+ gchar *filename;
+ GError *error = NULL;
+
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+ g_return_if_fail (basename != NULL);
+
+ filename = g_build_filename (EVOLUTION_UIDIR, basename, NULL);
+ gtk_builder_add_from_file (builder, filename, &error);
+ g_free (filename);
+
+ if (error != NULL) {
+ g_error ("%s: %s", basename, error->message);
+ g_assert_not_reached ();
+ }
+}
+
+/**
+ * e_load_ui_manager_definition:
* @ui_manager: a #GtkUIManager
* @basename: basename of the UI definition file
*
@@ -293,8 +323,8 @@ e_lookup_action_group (GtkUIManager *ui_manager,
* unmerge the UI with gtk_ui_manager_remove_ui().
**/
guint
-e_load_ui_definition (GtkUIManager *ui_manager,
- const gchar *basename)
+e_load_ui_manager_definition (GtkUIManager *ui_manager,
+ const gchar *basename)
{
gchar *filename;
guint merge_id;
@@ -1490,6 +1520,29 @@ e_util_get_category_filter_options (void)
return g_slist_reverse (res);
}
+/**
+ * e_util_set_source_combo_box_list:
+ * @source_combo_box: an #ESourceComboBox
+ * @source_gconf_path: GConf path with sources to use in an #ESourceList
+ *
+ * Sets an #ESourceList of a given GConf path to an #ESourceComboBox.
+ **/
+void
+e_util_set_source_combo_box_list (GtkWidget *source_combo_box, const gchar *source_gconf_path)
+{
+ ESourceList *source_list;
+ GConfClient *gconf_client;
+
+ g_return_if_fail (source_combo_box != NULL);
+ g_return_if_fail (source_gconf_path != NULL);
+
+ gconf_client = gconf_client_get_default ();
+ source_list = e_source_list_new_for_gconf (gconf_client, source_gconf_path);
+ g_object_set (G_OBJECT (source_combo_box), "source-list", source_list, NULL);
+ g_object_unref (source_list);
+ g_object_unref (gconf_client);
+}
+
static gpointer
e_camel_object_copy (gpointer camel_object)
{
diff --git a/e-util/e-util.h b/e-util/e-util.h
index d673cfe91a..7c4be25bd4 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -37,6 +37,11 @@
#include <e-util/e-marshal.h>
+/* Convenience macro to help migrate from libglade to GtkBuilder.
+ * Use it as a direct replacement for glade_xml_get_widget(). */
+#define e_builder_get_widget(builder, name) \
+ GTK_WIDGET (gtk_builder_get_object ((builder), (name)))
+
G_BEGIN_DECLS
typedef enum {
@@ -58,7 +63,9 @@ GtkAction * e_lookup_action (GtkUIManager *ui_manager,
const gchar *action_name);
GtkActionGroup *e_lookup_action_group (GtkUIManager *ui_manager,
const gchar *group_name);
-guint e_load_ui_definition (GtkUIManager *ui_manager,
+void e_load_ui_builder_definition (GtkBuilder *builder,
+ const gchar *basename);
+guint e_load_ui_manager_definition (GtkUIManager *ui_manager,
const gchar *basename);
gint e_action_compare_by_label (GtkAction *action1,
GtkAction *action2);
@@ -144,6 +151,9 @@ gboolean e_util_read_file (const gchar *filename,
GSList * e_util_get_category_filter_options
(void);
+void e_util_set_source_combo_box_list(GtkWidget *source_combo_box,
+ const gchar *source_gconf_path);
+
/* Camel uses its own object system, so we have to box
* CamelObjects to safely use them as GObject properties. */
#define E_TYPE_CAMEL_OBJECT (e_camel_object_get_type ())
diff --git a/e-util/e-win32-reloc.c b/e-util/e-win32-reloc.c
index 3ad8bbf5a4..2f31d647ac 100644
--- a/e-util/e-win32-reloc.c
+++ b/e-util/e-win32-reloc.c
@@ -120,7 +120,7 @@ setup (void)
ecpsdir = replace_prefix (full_prefix, EVOLUTION_ECPSDIR);
etspecdir = replace_prefix (full_prefix, EVOLUTION_ETSPECDIR);
galviewsdir = replace_prefix (full_prefix, EVOLUTION_GALVIEWSDIR);
- gladedir = replace_prefix (full_prefix, EVOLUTION_GLADEDIR);
+ gladedir = replace_prefix (full_prefix, EVOLUTION_UIDIR);
helpdir = replace_prefix (full_prefix, EVOLUTION_HELPDIR);
if (g_getenv ("EVOLUTION_ICONSDIR") &&
g_file_test (g_getenv ("EVOLUTION_ICONSDIR"), G_FILE_TEST_IS_DIR))