mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't use gtk_show_about_dialog() for the about dialog
There is a bug in GTK 2.2x where the links in the about dialog (and URI's in general) do not work on Windows. To solve that we add the OS specific method subsurface_launch_for_uri(). But to dispatch URI requests from the about dialog we need to set a hook either with gtk_about_dialog_set_url_hook() (which is deprecated from 2.24) or using signals like "activate-link". One problem with the "activate-link" signal thought is that we need to have a reference of an about dialog to pass to g_signal_connect(). So instead of using gtk_show_about_dialog() let's manage a dialog ourself with gtk_about_dialog_new(), gtk_dialog_run(), gtk_widget_destroy(). Other changes: - for GTK _bellow_ (but not including) 2.24 use gtk_about_dialog_set_url_hook() - use g_object_set() which is a convenient replacement for the varargs list in gtk_show_about_dialog() (also makes the diff smaller). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9f8bbeb0cf
commit
cd5c61e102
1 changed files with 7 additions and 3 deletions
10
gtk-gui.c
10
gtk-gui.c
|
@ -1047,19 +1047,19 @@ static void about_dialog(GtkWidget *w, gpointer data)
|
||||||
{
|
{
|
||||||
const char *logo_property = NULL;
|
const char *logo_property = NULL;
|
||||||
GdkPixbuf *logo = NULL;
|
GdkPixbuf *logo = NULL;
|
||||||
GtkWidget * dialog;
|
GtkWidget *dialog;
|
||||||
|
|
||||||
if (need_icon) {
|
if (need_icon) {
|
||||||
logo_property = "logo";
|
logo_property = "logo";
|
||||||
logo = gdk_pixbuf_from_pixdata(&subsurface_icon_pixbuf, TRUE, NULL);
|
logo = gdk_pixbuf_from_pixdata(&subsurface_icon_pixbuf, TRUE, NULL);
|
||||||
}
|
}
|
||||||
dialog = gtk_about_dialog_new();
|
dialog = gtk_about_dialog_new();
|
||||||
#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION <= 24)
|
#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 24)
|
||||||
gtk_about_dialog_set_url_hook(about_dialog_link_cb, NULL, NULL); /* deprecated since GTK 2.24 */
|
gtk_about_dialog_set_url_hook(about_dialog_link_cb, NULL, NULL); /* deprecated since GTK 2.24 */
|
||||||
#else
|
#else
|
||||||
g_signal_connect(GTK_ABOUT_DIALOG(dialog), "activate-link", G_CALLBACK(about_dialog_link_cb), NULL);
|
g_signal_connect(GTK_ABOUT_DIALOG(dialog), "activate-link", G_CALLBACK(about_dialog_link_cb), NULL);
|
||||||
#endif
|
#endif
|
||||||
gtk_show_about_dialog(NULL,
|
g_object_set(GTK_OBJECT(dialog),
|
||||||
"title", _("About Subsurface"),
|
"title", _("About Subsurface"),
|
||||||
"program-name", "Subsurface",
|
"program-name", "Subsurface",
|
||||||
"comments", _("Multi-platform divelog software in C"),
|
"comments", _("Multi-platform divelog software in C"),
|
||||||
|
@ -1073,6 +1073,10 @@ static void about_dialog(GtkWidget *w, gpointer data)
|
||||||
/* Must be last: */
|
/* Must be last: */
|
||||||
logo_property, logo,
|
logo_property, logo,
|
||||||
NULL);
|
NULL);
|
||||||
|
if (logo)
|
||||||
|
g_object_unref(logo);
|
||||||
|
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||||
|
gtk_widget_destroy(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void view_list(GtkWidget *w, gpointer data)
|
static void view_list(GtkWidget *w, gpointer data)
|
||||||
|
|
Loading…
Add table
Reference in a new issue