r23739 - gnucash/trunk/src/gnome-utils - Bug 721464 - Program won’t open the website link
John Ralls
jralls at code.gnucash.org
Tue Jan 21 20:52:54 EST 2014
Author: jralls
Date: 2014-01-21 20:52:53 -0500 (Tue, 21 Jan 2014)
New Revision: 23739
Trac: http://svn.gnucash.org/trac/changeset/23739
Modified:
gnucash/trunk/src/gnome-utils/gnc-main-window.c
Log:
Bug 721464 - Program won’t open the website link
Rejigger the about dialog call so that there's a signal to connect
to gnc_launch_assoc; gtk_show_uri requires gvfs.
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c 2014-01-21 20:39:27 UTC (rev 23738)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c 2014-01-22 01:52:53 UTC (rev 23739)
@@ -120,7 +120,6 @@
/** Count down timer for the save changes dialog. If the timer reaches zero
* any changes will be saved and the save dialog closed automatically */
static guint secs_to_save = 0;
-
#define MSG_AUTO_SAVE _("Changes will be saved automatically in %u seconds")
/* Declarations *********************************************************/
@@ -203,6 +202,11 @@
* window that is contained in the status bar. This pointer
* provides easy access for updating the progressbar. */
GtkWidget *progressbar;
+ /** Pointer to the about dialog. We need this so that we create
+ * only one, can attach to its activate-link signal, and can
+ * destroy it with the main window.
+ */
+ GtkWidget *about_dialog;
/** The group of all actions provided by the main window
* itself. This does not include any action provided by menu
@@ -2564,6 +2568,7 @@
/* Get the show_color_tabs value preference */
priv->show_color_tabs = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_COLOR);
+ priv->about_dialog = NULL;
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
GNC_PREF_TAB_COLOR,
@@ -2650,6 +2655,8 @@
g_list_foreach (plugins, gnc_main_window_remove_plugin, window);
g_list_free (plugins);
}
+ if (priv->about_dialog)
+ g_object_unref (priv->about_dialog);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@@ -4362,7 +4369,18 @@
g_free(text);
return lines;
}
+/** URL activation callback.
+ * Use our own function to activate the URL in the users browser
+ * instead of gtk_show_uri(), which requires gvfs.
+ * Signature described in gtk docs at GtkAboutDialog activate-link signal.
+ */
+static gboolean
+url_signal_cb (GtkAboutDialog *dialog, gchar *uri, gpointer data)
+{
+ gnc_launch_assoc (uri);
+ return TRUE;
+}
/** Create and display the "about" dialog for gnucash.
*
@@ -4373,56 +4391,69 @@
static void
gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window)
{
- const gchar *fixed_message = _("The GnuCash personal finance manager. "
+ GncMainWindowPrivate *priv;
+
+ priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+
+ if (priv->about_dialog == NULL)
+ {
+ const gchar *fixed_message = _("The GnuCash personal finance manager. "
"The GNU way to manage your money!");
- const gchar *copyright = _("© 1997-2013 Contributors");
- gchar **authors, **documenters, *license, *message;
- GdkPixbuf *logo;
+ const gchar *copyright = _("© 1997-2013 Contributors");
+ gchar **authors = get_file_strsplit("AUTHORS");
+ gchar **documenters = get_file_strsplit("DOCUMENTERS");
+ gchar *license = get_file("LICENSE");
+ gchar *message;
+ GdkPixbuf *logo = gnc_gnome_get_gdkpixbuf ("gnucash-icon-48x48.png");
- logo = gnc_gnome_get_gdkpixbuf ("gnucash-icon-48x48.png");
-
- authors = get_file_strsplit("AUTHORS");
- documenters = get_file_strsplit("DOCUMENTERS");
- license = get_file("LICENSE");
#ifdef GNUCASH_SCM
/* Development version */
/* Translators: 1st %s is a fixed message, which is translated independently;
2nd %s is the scm type (svn/svk/git/bzr);
3rd %s is the scm revision number;
4th %s is the build date */
- message = g_strdup_printf(_("%s\nThis copy was built from %s rev %s on %s."),
- fixed_message, GNUCASH_SCM, GNUCASH_SCM_REV,
- GNUCASH_BUILD_DATE);
+ message = g_strdup_printf(_("%s\nThis copy was built from %s rev %s on %s."),
+ fixed_message, GNUCASH_SCM, GNUCASH_SCM_REV,
+ GNUCASH_BUILD_DATE);
#else
/* Translators: 1st %s is a fixed message, which is translated independently;
2nd %s is the scm (svn/svk/git/bzr) revision number;
3rd %s is the build date */
- message = g_strdup_printf(_("%s\nThis copy was built from rev %s on %s."),
- fixed_message, GNUCASH_SCM_REV, GNUCASH_BUILD_DATE);
+ message = g_strdup_printf(_("%s\nThis copy was built from rev %s on %s."),
+ fixed_message, GNUCASH_SCM_REV,
+ GNUCASH_BUILD_DATE);
#endif
- gtk_show_about_dialog
- (GTK_WINDOW (window),
- "authors", authors,
- "documenters", documenters,
- "comments", message,
- "copyright", copyright,
- "license", license,
- "logo", logo,
- "name", "GnuCash",
+ priv->about_dialog = gtk_about_dialog_new ();
+ g_object_set (priv->about_dialog,
+ "authors", authors,
+ "documenters", documenters,
+ "comments", message,
+ "copyright", copyright,
+ "license", license,
+ "logo", logo,
+ "name", "GnuCash",
/* Translators: the following string will be shown in Help->About->Credits
* Enter your name or that of your team and an email contact for feedback.
* The string can have multiple rows, so you can also add a list of
* contributors. */
- "translator-credits", _("translator_credits"),
- "version", VERSION,
- "website", "http://www.gnucash.org",
- (gchar *)NULL);
+ "translator-credits", _("translator_credits"),
+ "version", VERSION,
+ "website", "http://www.gnucash.org",
+ NULL);
- g_free(message);
- if (license) g_free(license);
- if (documenters) g_strfreev(documenters);
- if (authors) g_strfreev(authors);
- g_object_unref (logo);
+ g_free(message);
+ if (license) g_free(license);
+ if (documenters) g_strfreev(documenters);
+ if (authors) g_strfreev(authors);
+ g_object_unref (logo);
+ g_signal_connect (priv->about_dialog, "activate-link",
+ G_CALLBACK (url_signal_cb), NULL);
+ g_signal_connect (priv->about_dialog, "response",
+ G_CALLBACK (gtk_widget_hide), NULL);
+ gtk_window_set_transient_for (GTK_WINDOW (priv->about_dialog),
+ GTK_WINDOW (window));
+ }
+ gtk_dialog_run (GTK_DIALOG (priv->about_dialog));
}
More information about the gnucash-changes
mailing list