[geany/geany-plugins] 9ed01e: Merge pull request #403 from eht16/geniuspaste_win32_crash_fix
Colomban Wendling
git-noreply at xxxxx
Sun Mar 13 02:05:44 UTC 2016
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Sun, 13 Mar 2016 02:05:44 UTC
Commit: 9ed01e7b0b91016013d0ed820206f4309c4848d5
https://github.com/geany/geany-plugins/commit/9ed01e7b0b91016013d0ed820206f4309c4848d5
Log Message:
-----------
Merge pull request #403 from eht16/geniuspaste_win32_crash_fix
geniuspaste: Install a custom URL handler for Paste link
This works around an odd crash on Windows clicking the URI using GTK's
built-in URI handler.
Modified Paths:
--------------
geniuspaste/src/geniuspaste.c
Modified: geniuspaste/src/geniuspaste.c
24 lines changed, 24 insertions(+), 0 deletions(-)
===================================================================
@@ -585,12 +585,30 @@ static gchar *pastebin_parse_response(const Pastebin *pastebin,
return url;
}
+static gboolean message_dialog_label_link_activated(GtkLabel *label, gchar *uri, gpointer user_data)
+{
+ utils_open_browser(uri);
+ return TRUE;
+}
+
+static void message_dialog_label_set_url_hook(GtkWidget *widget, gpointer data)
+{
+ if (GTK_IS_LABEL(widget))
+ {
+ g_signal_connect(widget,
+ "activate-link",
+ G_CALLBACK(message_dialog_label_link_activated),
+ NULL);
+ }
+}
+
G_GNUC_PRINTF (4, 5)
static void show_msgbox(GtkMessageType type, GtkButtonsType buttons,
const gchar *main_text,
const gchar *secondary_markup, ...)
{
GtkWidget *dlg;
+ GtkWidget *dlg_vbox;
va_list ap;
gchar *markup;
@@ -608,6 +626,12 @@ static void show_msgbox(GtkMessageType type, GtkButtonsType buttons,
"secondary-text", markup,
"secondary-use-markup", TRUE,
NULL);
+ /* fetch the message area of the dialog and attach a custom URL hook to the labels */
+ dlg_vbox = gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(dlg));
+ gtk_container_foreach(GTK_CONTAINER(dlg_vbox),
+ message_dialog_label_set_url_hook,
+ NULL);
+ /* run the dialog */
gtk_dialog_run(GTK_DIALOG(dlg));
gtk_widget_destroy(dlg);
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list