[yelp/yelp-3-0] Adding --editor-mode, show revision status and comments



commit b1114ff52f4c716e50d382ebe37fe6de1d994fd1
Author: Shaun McCance <shaunm gnome org>
Date:   Mon Mar 22 16:20:06 2010 -0500

    Adding --editor-mode, show revision status and comments
    
    Still to do: editor mode in docbook, show .page.stub files

 libyelp/yelp-settings.c    |   18 +++++++++++++++++-
 libyelp/yelp-settings.h    |    3 +++
 src/yelp-application.c     |   20 ++++++++++++++++++--
 src/yelp-application.h     |    1 -
 src/yelp.c                 |   11 +++--------
 stylesheets/db2html.xsl.in |    2 +-
 6 files changed, 42 insertions(+), 13 deletions(-)
---
diff --git a/libyelp/yelp-settings.c b/libyelp/yelp-settings.c
index fe49bbb..f74da60 100644
--- a/libyelp/yelp-settings.c
+++ b/libyelp/yelp-settings.c
@@ -44,6 +44,8 @@ struct _YelpSettingsPriv {
     gulong        gtk_theme_changed;
     gulong        gtk_font_changed;
     gulong        icon_theme_changed;
+
+    gboolean      editor_mode;
 };
 
 enum {
@@ -626,6 +628,15 @@ yelp_settings_get_icon_param (YelpSettingsIcon icon)
 
 /******************************************************************************/
 
+void
+yelp_settings_set_editor_mode (YelpSettings *settings,
+                               gboolean      editor_mode)
+{
+    settings->priv->editor_mode = editor_mode;
+}
+
+/******************************************************************************/
+
 gchar **
 yelp_settings_get_all_params (YelpSettings *settings,
 			      gint          extra,
@@ -635,7 +646,7 @@ yelp_settings_get_all_params (YelpSettings *settings,
     gint i, ix;
 
     params = g_new0 (gchar *,
-                     (2*YELP_SETTINGS_NUM_COLORS) + (2*YELP_SETTINGS_NUM_ICONS) + extra + 3);
+                     (2*YELP_SETTINGS_NUM_COLORS) + (2*YELP_SETTINGS_NUM_ICONS) + extra + 5);
 
     for (i = 0; i < YELP_SETTINGS_NUM_COLORS; i++) {
         gchar *val;
@@ -656,6 +667,11 @@ yelp_settings_get_all_params (YelpSettings *settings,
     ix = 2 * (YELP_SETTINGS_NUM_COLORS + YELP_SETTINGS_NUM_ICONS);
     params[ix++] = g_strdup ("theme.icon.admon.size");
     params[ix++] = g_strdup_printf ("%i", yelp_settings_get_icon_size (settings));
+    params[ix++] = g_strdup ("mal2html.editor_mode");
+    if (settings->priv->editor_mode)
+        params[ix++] = g_strdup ("true()");
+    else
+        params[ix++] = g_strdup ("false()");
     params[ix] = NULL;
 
     if (end != NULL)
diff --git a/libyelp/yelp-settings.h b/libyelp/yelp-settings.h
index 18cd816..511af87 100644
--- a/libyelp/yelp-settings.h
+++ b/libyelp/yelp-settings.h
@@ -118,6 +118,9 @@ gchar **            yelp_settings_get_all_params       (YelpSettings       *sett
                                                         gint                extra,
                                                         gint               *end);
 
+void                yelp_settings_set_editor_mode      (YelpSettings       *settings,
+                                                        gboolean            editor_mode);
+
 G_END_DECLS
 
 #endif /* __YELP_SETTINGS_H__ */
diff --git a/src/yelp-application.c b/src/yelp-application.c
index d908f57..cd0a430 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -36,6 +36,13 @@
 #include "yelp-dbus.h"
 #include "yelp-window.h"
 
+static gboolean editor_mode = FALSE;
+
+static const GOptionEntry entries[] = {
+    {"editor-mode", 0, 0, G_OPTION_ARG_NONE, &editor_mode, N_("Turn on editor mode"), NULL},
+    { NULL }
+};
+
 typedef struct _YelpApplicationLoad YelpApplicationLoad;
 struct _YelpApplicationLoad {
     YelpApplication *app;
@@ -163,16 +170,23 @@ yelp_application_new (void)
 
 gint
 yelp_application_run (YelpApplication  *app,
-                      GOptionContext   *context,
                       gint              argc,
                       gchar           **argv)
 {
+    GOptionContext *context;
     GError *error = NULL;
     DBusGProxy *proxy;
     guint request;
     YelpApplicationPrivate *priv = GET_PRIV (app);
     gchar *uri;
 
+    g_set_application_name (N_("Help"));
+
+    context = g_option_context_new (NULL);
+    g_option_context_add_group (context, gtk_get_option_group (TRUE));
+    g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+    g_option_context_parse (context, &argc, &argv, NULL);
+
     priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
     if (priv->connection == NULL) {
         g_warning ("Unable to connect to dbus: %s", error->message);
@@ -241,6 +255,8 @@ yelp_application_run (YelpApplication  *app,
                                          "/org/gnome/Yelp",
                                          G_OBJECT (app));
 
+    yelp_settings_set_editor_mode (yelp_settings_get_default (), editor_mode);
+
     yelp_application_load_uri (app, uri, gtk_get_current_event_time (), NULL);
 
     gtk_main ();
@@ -305,7 +321,7 @@ application_uri_resolved (YelpUri             *uri,
     if (gdk_window)
         gdk_x11_window_move_to_current_desktop (gdk_window);
 
-    gtk_window_present_with_time (GTK_WINDOW (window), data->timestamp);
+    gtk_window_present_with_time (GTK_WINDOW (window), GDK_CURRENT_TIME);
 
     g_free (data);
 }
diff --git a/src/yelp-application.h b/src/yelp-application.h
index 2387e5b..49542d4 100644
--- a/src/yelp-application.h
+++ b/src/yelp-application.h
@@ -47,7 +47,6 @@ struct _YelpApplicationClass
 GType             yelp_application_get_type    (void);
 YelpApplication*  yelp_application_new         (void);
 gint              yelp_application_run         (YelpApplication  *app,
-                                                GOptionContext   *context,
                                                 gint              argc,
                                                 gchar           **argv);
 gboolean          yelp_application_load_uri    (YelpApplication  *app,
diff --git a/src/yelp.c b/src/yelp.c
index ce20a3a..be70c66 100644
--- a/src/yelp.c
+++ b/src/yelp.c
@@ -26,24 +26,19 @@
 
 #include <glib.h>
 #include <glib/gi18n.h>
+#include <gtk/gtk.h>
 
 #include "yelp-application.h"
 
 int
 main (int argc, char **argv) 
 {
-    GOptionContext *context;
     YelpApplication *app;
 
     g_thread_init (NULL);
-
-    g_set_application_name (N_("Help"));
-
-    context = g_option_context_new (NULL);
-    g_option_context_add_group (context, gtk_get_option_group (TRUE));
-    g_option_context_parse (context, &argc, &argv, NULL);
+    g_type_init ();
 
     app = yelp_application_new ();
 
-    return yelp_application_run (app, context, argc, argv);
+    return yelp_application_run (app, argc, argv);
 }
diff --git a/stylesheets/db2html.xsl.in b/stylesheets/db2html.xsl.in
index 59762e4..3b39adb 100644
--- a/stylesheets/db2html.xsl.in
+++ b/stylesheets/db2html.xsl.in
@@ -69,7 +69,7 @@ FIXME: yelp:cache no longer works
 <!-- == db.xref.target == -->
 <xsl:template name="db.xref.target">
   <xsl:param name="linkend"/>
-  <xsl:value-of select="concat('xref:', $linkend)"/>
+  <xsl:value-of select="concat('xref:', $linkend, '#', $linkend)"/>
 </xsl:template>
 
 <!-- == db2html.division.head.extra == -->



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