[Xfce4-commits] <libxfce4ui:master> Add xfce_dialog_show_help_with_version().

Nick Schermer noreply at xfce.org
Sun Feb 16 23:04:01 CET 2014


Updating branch refs/heads/master
         to d5467df1c64ff6cf6884cd7347a3c8c62c49b32e (commit)
       from 835861af91de444561b7c0de420332de68d32587 (commit)

commit d5467df1c64ff6cf6884cd7347a3c8c62c49b32e
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Feb 16 23:01:19 2014 +0100

    Add xfce_dialog_show_help_with_version().
    
    Allow applications to send their own version string to the wiki
    help.php script.

 NEWS                          |    5 ++
 docs/libxfce4ui-sections.txt  |    1 +
 libxfce4ui/libxfce4ui.symbols |    1 +
 libxfce4ui/xfce-dialogs.c     |   41 +++++++++++++++-
 libxfce4ui/xfce-dialogs.h     |  106 ++++++++++++++++++++++-------------------
 5 files changed, 103 insertions(+), 51 deletions(-)

diff --git a/NEWS b/NEWS
index 6f3e323..ef41ed9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+4.11.x
+======
+- Add xfce_dialog_show_help_with_version() so applications can send
+  their own version number and not the desktop version.
+
 4.11.0
 ======
 - Compile GTK+-3 version of libxfce4ui when possible.
diff --git a/docs/libxfce4ui-sections.txt b/docs/libxfce4ui-sections.txt
index 7df732f..e7b7459 100644
--- a/docs/libxfce4ui-sections.txt
+++ b/docs/libxfce4ui-sections.txt
@@ -39,6 +39,7 @@ xfce_message_dialog_new
 xfce_message_dialog_new_valist
 xfce_message_dialog
 xfce_dialog_show_help
+xfce_dialog_show_help_with_version
 xfce_dialog_show_info
 xfce_dialog_show_warning
 xfce_dialog_show_error
diff --git a/libxfce4ui/libxfce4ui.symbols b/libxfce4ui/libxfce4ui.symbols
index f572f23..e054f5f 100644
--- a/libxfce4ui/libxfce4ui.symbols
+++ b/libxfce4ui/libxfce4ui.symbols
@@ -58,6 +58,7 @@ xfce_sm_client_shutdown_hint_get_type
 #if IN_HEADER(__XFCE_DIALOGS_H__)
 #if IN_SOURCE(__XFCE_DIALOGS_C__)
 xfce_dialog_show_help
+xfce_dialog_show_help_with_version
 xfce_dialog_show_info G_GNUC_PRINTF (3, 4)
 xfce_dialog_show_warning G_GNUC_PRINTF (3, 4)
 xfce_dialog_show_error G_GNUC_PRINTF (3, 4)
diff --git a/libxfce4ui/xfce-dialogs.c b/libxfce4ui/xfce-dialogs.c
index 762b610..ca7a9b8 100644
--- a/libxfce4ui/xfce-dialogs.c
+++ b/libxfce4ui/xfce-dialogs.c
@@ -142,6 +142,8 @@ xfce_dialog_show_help_response (GtkWidget *dialog,
  * Appart from the @component, @page and @offset the following information
  * is also send to the server: user language and the xfce_version_string().
  *
+ * See also: xfce_dialog_show_help_with_version().
+ *
  * Since 4.10
  */
 void
@@ -150,6 +152,39 @@ xfce_dialog_show_help (GtkWindow   *parent,
                        const gchar *page,
                        const gchar *offset)
 {
+
+}
+
+
+
+/**
+ * xfce_dialog_show_help_with_version:
+ * @parent    : transient parent of the dialog, or %NULL.
+ * @component : name of the component opening the help page or %NULL. If the
+ *              value is %NULL the target will be the main page of the
+ *              documentation website.
+ * @page      : subpage of the @component on the website or %NULL.
+ * @offset    : anchor offset in @page or %NULL.
+ * @version   : alternative version, or %NULL to use xfce_version_string().
+ *
+ * Asks the user to visit the online documentation. If confirmed, it will open
+ * the webbrowser and redirect the user to the correct location.
+ *
+ * Appart from the @component, @page and @offset the following information
+ * is also send to the server: user language and the xfce_version_string()
+ * or @version if set.
+ *
+ * See also: xfce_dialog_show_help().
+ *
+ * Since 4.12
+ */
+void
+xfce_dialog_show_help_with_version (GtkWindow   *parent,
+                                    const gchar *component,
+                                    const gchar *page,
+                                    const gchar *offset,
+                                    const gchar *version)
+{
   GtkWidget   *dialog;
   const gchar *name;
   gchar       *primary;
@@ -170,9 +205,13 @@ xfce_dialog_show_help (GtkWindow   *parent,
   else
     locale = g_strdup ("C");
 
+  /* use desktop version if none is set */
+  if (version == NULL)
+    version = xfce_version_string ();
+
   /* build the redirect uri */
   uri = g_string_new (MANUAL_WEBSITE);
-  g_string_append_printf (uri, "?version=%s&locale=%s", xfce_version_string (), locale);
+  g_string_append_printf (uri, "?version=%s&locale=%s", version, locale);
   g_free (locale);
 
   if (component != NULL)
diff --git a/libxfce4ui/xfce-dialogs.h b/libxfce4ui/xfce-dialogs.h
index f004c3f..f5bd357 100644
--- a/libxfce4ui/xfce-dialogs.h
+++ b/libxfce4ui/xfce-dialogs.h
@@ -31,56 +31,62 @@ G_BEGIN_DECLS
 #define XFCE_BUTTON_TYPE_MIXED  "button-mixed"
 #define XFCE_BUTTON_TYPE_PIXBUF "button-pixbuf"
 
-void       xfce_dialog_show_help          (GtkWindow    *parent,
-                                           const gchar  *application,
-                                           const gchar  *page,
-                                           const gchar  *offset);
-
-void       xfce_dialog_show_info          (GtkWindow    *parent,
-                                           const gchar  *secondary_text,
-                                           const gchar  *primary_format,
-                                           ...) G_GNUC_PRINTF (3, 4);
-
-void       xfce_dialog_show_warning       (GtkWindow    *parent,
-                                           const gchar  *secondary_text,
-                                           const gchar  *primary_format,
-                                           ...) G_GNUC_PRINTF (3, 4);
-
-void       xfce_dialog_show_error         (GtkWindow    *parent,
-                                           const GError *error,
-                                           const gchar  *primary_format,
-                                           ...) G_GNUC_PRINTF (3, 4);
-
-gboolean   xfce_dialog_confirm            (GtkWindow    *parent,
-                                           const gchar  *stock_id,
-                                           const gchar  *confirm_label,
-                                           const gchar  *secondary_text,
-                                           const gchar  *primary_format,
-                                           ...) G_GNUC_PRINTF (5, 6);
-
-GtkWidget *xfce_message_dialog_new_valist (GtkWindow   *parent,
-                                           const gchar *title,
-                                           const gchar *icon_stock_id,
-                                           const gchar *primary_text,
-                                           const gchar *secondary_text,
-                                           const gchar *first_button_text,
-                                           va_list      args) G_GNUC_MALLOC;
-
-GtkWidget *xfce_message_dialog_new        (GtkWindow    *parent,
-                                           const gchar  *title,
-                                           const gchar  *stock_id,
-                                           const gchar  *primary_text,
-                                           const gchar  *secondary_text,
-                                           const gchar  *first_button_text,
-                                           ...) G_GNUC_NULL_TERMINATED G_GNUC_MALLOC;
-
-gint       xfce_message_dialog            (GtkWindow    *parent,
-                                           const gchar  *title,
-                                           const gchar  *stock_id,
-                                           const gchar  *primary_text,
-                                           const gchar  *secondary_text,
-                                           const gchar  *first_button_text,
-                                           ...) G_GNUC_NULL_TERMINATED;
+void       xfce_dialog_show_help              (GtkWindow    *parent,
+                                               const gchar  *application,
+                                               const gchar  *page,
+                                               const gchar  *offset);
+
+void       xfce_dialog_show_help_with_version (GtkWindow    *parent,
+                                               const gchar  *application,
+                                               const gchar  *page,
+                                               const gchar  *offset,
+                                               const gchar  *version);
+
+void       xfce_dialog_show_info              (GtkWindow    *parent,
+                                               const gchar  *secondary_text,
+                                               const gchar  *primary_format,
+                                               ...) G_GNUC_PRINTF (3, 4);
+
+void       xfce_dialog_show_warning           (GtkWindow    *parent,
+                                               const gchar  *secondary_text,
+                                               const gchar  *primary_format,
+                                               ...) G_GNUC_PRINTF (3, 4);
+
+void       xfce_dialog_show_error             (GtkWindow    *parent,
+                                               const GError *error,
+                                               const gchar  *primary_format,
+                                               ...) G_GNUC_PRINTF (3, 4);
+
+gboolean   xfce_dialog_confirm                (GtkWindow    *parent,
+                                               const gchar  *stock_id,
+                                               const gchar  *confirm_label,
+                                               const gchar  *secondary_text,
+                                               const gchar  *primary_format,
+                                               ...) G_GNUC_PRINTF (5, 6);
+
+GtkWidget *xfce_message_dialog_new_valist     (GtkWindow   *parent,
+                                               const gchar *title,
+                                               const gchar *icon_stock_id,
+                                               const gchar *primary_text,
+                                               const gchar *secondary_text,
+                                               const gchar *first_button_text,
+                                               va_list      args) G_GNUC_MALLOC;
+
+GtkWidget *xfce_message_dialog_new            (GtkWindow    *parent,
+                                               const gchar  *title,
+                                               const gchar  *stock_id,
+                                               const gchar  *primary_text,
+                                               const gchar  *secondary_text,
+                                               const gchar  *first_button_text,
+                                               ...) G_GNUC_NULL_TERMINATED G_GNUC_MALLOC;
+
+gint       xfce_message_dialog                (GtkWindow    *parent,
+                                               const gchar  *title,
+                                               const gchar  *stock_id,
+                                               const gchar  *primary_text,
+                                               const gchar  *secondary_text,
+                                               const gchar  *first_button_text,
+                                               ...) G_GNUC_NULL_TERMINATED;
 
 G_END_DECLS
 


More information about the Xfce4-commits mailing list