aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-util.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-03-05 04:26:59 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-03-14 09:53:17 +0800
commitd7494c8f160b12e1199b06dcafdc8ff01b24b796 (patch)
tree28e4c85c915c770a4e7bfb48ede7f686d18da206 /e-util/e-util.c
parent51cbd483d163138c3b570b01f0921f767ca64a7e (diff)
downloadgsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.tar.gz
gsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.tar.zst
gsoc2013-evolution-d7494c8f160b12e1199b06dcafdc8ff01b24b796.zip
Shell and UI manager cleanups.
Replace the EVO_EXPRESS environment variable with an --express command line option. (Note, this adds a new translatable string for --help.) Add an EUIManager class with an "express-mode" property and custom load functions that use our new "express" preprocessor. This replaces the UI manager functions in e-utils.c. (Also going to see if I can get GTK+ to add an "add_ui_from_string" method to GtkUIManagerClass that we can override. Then we could just call gtk_ui_manager_add_ui_from_string() and the preprocessor would automatically do its thing and chain up.) Add an "express-mode" read-only GObject property to EShell. Add e_shell_configure_ui_manager() to e-shell-utils.c. For now this just creates a one-way property binding: EShell:express-mode -> EUIManager:express-mode Call this immediately after e_ui_manager_new(). (EUIManager can't do this itself because it lives too low in the dependency hierarchy and doesn't know about EShell.)
Diffstat (limited to 'e-util/e-util.c')
-rw-r--r--e-util/e-util.c119
1 files changed, 0 insertions, 119 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 3573952244..cf5c0b0464 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -310,125 +310,6 @@ e_load_ui_builder_definition (GtkBuilder *builder,
}
}
-
-void
-e_load_ui_manager_set_express (GtkUIManager *ui_manager,
- gboolean express)
-{
- g_object_set_data (G_OBJECT (ui_manager),
- "e-ui-mgr-express",
- GUINT_TO_POINTER (express));
-}
-
-static gboolean
-e_load_ui_manager_get_express (GtkUIManager *ui_manager)
-{
- gboolean express = GPOINTER_TO_UINT (
- g_object_get_data (G_OBJECT (ui_manager),
- "e-ui-mgr-express"));
- return express;
-}
-
-
-/**
- * e_load_ui_manager_definition_from_string:
- * @ui_manager: a #GtkUIManager
- * @string: the UI XML in NULL terminated string form
- *
- * Loads a UI definition into @ui_manager from Evolution's UI directory.
- * Depending on the mode signalled by the 'express' flag on the UI manager
- * a simplified version of the UI may be presented.
- *
- * Returns: The merge ID for the merged UI. The merge ID can be used to
- * unmerge the UI with gtk_ui_manager_remove_ui().
- **/
-guint
-e_load_ui_manager_definition_from_string (GtkUIManager *ui_manager,
- const gchar *ui_string,
- GError **error)
-{
- int i;
- guint merge_id;
- gchar *filtered, **lines;
- gboolean is_express, in_conditional = FALSE;
- gboolean include = TRUE;
-
- is_express = e_load_ui_manager_get_express (ui_manager);
-
- /*
- * Very simple line based pre-processing based on comments:
- * <!-- if [!]EXPRESS -->\n ... \n<!-- endif -->\n
- */
- lines = g_strsplit (ui_string, "\n", -1);
- for (i = 0; lines[i]; i++) {
- char *p;
- if ((p = strstr (lines[i], "<!-- if "))) {
- gboolean not_express = lines[i][8] == '!';
- include = is_express ^ not_express;
-/* g_warning ("not express: %d from '%s' include to %d (%d)",
- not_express, lines[i], include, is_express); */
- lines[i][0] = '\0';
- in_conditional = TRUE;
- } else if ((p = strstr (lines[i], "<!-- endif"))) {
- lines[i][0] = '\0';
- include = TRUE;
- in_conditional = FALSE;
- }
-/* if (in_conditional)
- g_warning ("conditional: (%d): '%s'", include, lines[i]); */
- if (!include)
- lines[i][0] = '\0';
- }
- filtered = g_strjoinv("\n", lines);
-
- merge_id = gtk_ui_manager_add_ui_from_string (ui_manager, filtered, -1, error);
-
- g_free (filtered);
-
- return merge_id;
-}
-
-/**
- * e_load_ui_manager_definition:
- * @ui_manager: a #GtkUIManager
- * @basename: basename of the UI definition file
- *
- * Loads a UI definition into @ui_manager from Evolution's UI directory.
- * Failure here is fatal, since the application can't function without
- * its UI definitions.
- * Depending on the mode signalled by the 'express' flag on the UI manager
- * a simplified version of the UI may be presented.
- *
- * Returns: The merge ID for the merged UI. The merge ID can be used to
- * unmerge the UI with gtk_ui_manager_remove_ui().
- **/
-guint
-e_load_ui_manager_definition (GtkUIManager *ui_manager,
- const gchar *basename)
-{
- gchar *filename;
- guint merge_id = 0;
- GError *error = NULL;
- gchar *buffer;
-
- g_return_val_if_fail (GTK_IS_UI_MANAGER (ui_manager), 0);
- g_return_val_if_fail (basename != NULL, 0);
-
- filename = g_build_filename (EVOLUTION_UIDIR, basename, NULL);
-
- if (g_file_get_contents (filename, &buffer, NULL, &error))
- merge_id = e_load_ui_manager_definition_from_string (ui_manager, buffer, &error);
-
- g_free (filename);
-
- if (error != NULL) {
- g_error ("%s: %s", basename, error->message);
- g_assert_not_reached ();
- }
-
- return merge_id;
-}
-
/**
* e_action_compare_by_label:
* @action1: a #GtkAction