Refactor the Help menu.
[pspp-builds.git] / src / ui / gui / psppire-output-window.c
index e217c0edca665274a7a9d28daa8c60bb69693558..f78b8855bb9d72d129258d96b45121915b93db64 100644 (file)
@@ -32,7 +32,7 @@
 #include <output/tab.h>
 #include <stdlib.h>
 
-#include "about.h"
+#include "help-menu.h"
 
 #include "psppire-output-window.h"
 
@@ -216,7 +216,29 @@ psppire_output_submit (struct output_driver *this,
 
   cr = gdk_cairo_create (GTK_WIDGET (pod->viewer)->window);
   if (pod->xr == NULL)
-    pod->xr = xr_create_driver (cr);
+    {
+      const GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (viewer));
+      struct string_map options = STRING_MAP_INITIALIZER (options);
+      PangoFontDescription *font_desc;
+      char *font_name;
+
+      /* Use GTK+ default font as proportional font. */
+      font_name = pango_font_description_to_string (style->font_desc);
+      string_map_insert (&options, "prop-font", font_name);
+      g_free (font_name);
+
+      /* Derived emphasized font from proportional font. */
+      font_desc = pango_font_description_copy (style->font_desc);
+      pango_font_description_set_style (font_desc, PANGO_STYLE_ITALIC);
+      font_name = pango_font_description_to_string (font_desc);
+      string_map_insert (&options, "emph-font", font_name);
+      g_free (font_name);
+      pango_font_description_free (font_desc);
+
+      pod->xr = xr_create_driver (cr, &options);
+
+      string_map_destroy (&options);
+    }
 
   r = xr_rendering_create (pod->xr, item, cr);
   if (r == NULL)
@@ -531,16 +553,6 @@ psppire_output_window_init (PsppireOutputWindow *window)
                    G_CALLBACK (cancel_urgency),
                    NULL);
 
-  g_signal_connect (get_action_assert (xml,"help_about"),
-                   "activate",
-                   G_CALLBACK (about_new),
-                   window);
-
-  g_signal_connect (get_action_assert (xml,"help_reference"),
-                   "activate",
-                   G_CALLBACK (reference_manual),
-                   NULL);
-
   g_signal_connect (get_action_assert (xml,"windows_minimise-all"),
                    "activate",
                    G_CALLBACK (psppire_window_minimise_all),
@@ -548,9 +560,10 @@ psppire_output_window_init (PsppireOutputWindow *window)
 
   {
     GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (xml, "uimanager1", GTK_TYPE_UI_MANAGER));
+    merge_help_menu (uim);
 
     PSPPIRE_WINDOW (window)->menu =
-      GTK_MENU_SHELL (gtk_ui_manager_get_widget (uim,"/ui/menubar1/windows_menuitem/windows_minimise-all")->parent);
+      GTK_MENU_SHELL (gtk_ui_manager_get_widget (uim,"/ui/menubar/windows_menuitem/windows_minimise-all")->parent);
   }
 
   g_signal_connect_swapped (get_action_assert (xml, "file_export"), "activate",