[yelp] [yelp-window.c] Load UIManager ui defs from a string, remove old files



commit c81dc542ab6ed787c4c051857e48ae1fc1bbba11
Author: Shaun McCance <shaunm gnome org>
Date:   Fri Apr 23 15:58:58 2010 -0500

    [yelp-window.c] Load UIManager ui defs from a string, remove old files

 configure.in                  |    1 -
 data/Makefile.am              |    2 +-
 data/ui/Makefile.am           |    5 -
 data/ui/yelp-bookmarks-add.ui |  105 -------------------
 data/ui/yelp-bookmarks.ui     |  160 -----------------------------
 data/ui/yelp-open-location.ui |  100 ------------------
 data/ui/yelp-preferences.ui   |  222 -----------------------------------------
 data/ui/yelp-search-ui.xml    |    9 --
 data/ui/yelp-ui.xml           |   81 ---------------
 src/yelp-window.c             |   35 ++++---
 10 files changed, 23 insertions(+), 697 deletions(-)
---
diff --git a/configure.in b/configure.in
index 51c6f68..74659d3 100644
--- a/configure.in
+++ b/configure.in
@@ -276,7 +276,6 @@ data/icons/Makefile
 data/icons/hicolor/Makefile
 data/icons/hicolor/16x16/Makefile
 data/icons/hicolor/16x16/status/Makefile
-data/ui/Makefile
 po/Makefile.in
 tests/Makefile
 yelp.desktop.in
diff --git a/data/Makefile.am b/data/Makefile.am
index c6667d1..6537659 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = icons ui
+SUBDIRS = icons
 
 @INTLTOOL_XML_RULE@
 @INTLTOOL_SCHEMAS_RULE@
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 3f7fe0b..ef2dd1e 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -116,6 +116,27 @@ enum {
   COL_TERMS
 };
 
+static const gchar *YELP_UI =
+    "<ui>"
+    "<menubar>"
+    "<menu action='PageMenu'>"
+    "<menuitem action='NewWindow'/>"
+    "<menuitem action='CloseWindow'/>"
+    "</menu>"
+    "<menu action='ViewMenu'>"
+    "<menuitem action='LargerText'/>"
+    "<menuitem action='SmallerText'/>"
+    "<separator/>"
+    "<menuitem action='ShowTextCursor'/>"
+    "</menu>"
+    "<menu action='GoMenu'>"
+    "<menuitem action='GoBack'/>"
+    "<menuitem action='GoForward'/>"
+    "</menu>"
+    "</menubar>"
+    "<accelerator action='OpenLocation'/>"
+    "</ui>";
+
 typedef struct _YelpBackEntry YelpBackEntry;
 struct _YelpBackEntry {
     YelpUri *uri;
@@ -322,19 +343,7 @@ window_construct (YelpWindow *window)
                                         1);
     gtk_window_add_accel_group (GTK_WINDOW (window),
                                 gtk_ui_manager_get_accel_group (priv->ui_manager));
-    if (!gtk_ui_manager_add_ui_from_file (priv->ui_manager,
-					  DATADIR "/yelp/ui/yelp-ui.xml",
-					  &error)) {
-        GtkWidget *dialog = gtk_message_dialog_new (NULL, 0,
-                                                    GTK_MESSAGE_ERROR,
-                                                    GTK_BUTTONS_OK,
-                                                    "%s", _("Cannot create window"));
-        gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s",
-                                                    error->message);
-        gtk_dialog_run (GTK_DIALOG (dialog));
-        gtk_widget_destroy (dialog);
-        g_error_free (error);
-    }
+    gtk_ui_manager_add_ui_from_string (priv->ui_manager, YELP_UI, -1, NULL);
     gtk_box_pack_start (GTK_BOX (vbox),
                         gtk_ui_manager_get_widget (priv->ui_manager, "/ui/menubar"),
                         FALSE, FALSE, 0);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]