diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-12-02 05:01:54 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-12-02 05:01:54 +0800 |
commit | 646ed927c6691796df969502bf5031771ace99fb (patch) | |
tree | a6eb6f2379b37803c2afd0b67c89d29c3c80f4ac /libempathy-gtk | |
parent | 9def2fdc5c8a33a36a47b4552eb7e4c4368aab4f (diff) | |
download | gsoc2013-empathy-646ed927c6691796df969502bf5031771ace99fb.tar gsoc2013-empathy-646ed927c6691796df969502bf5031771ace99fb.tar.gz gsoc2013-empathy-646ed927c6691796df969502bf5031771ace99fb.tar.bz2 gsoc2013-empathy-646ed927c6691796df969502bf5031771ace99fb.tar.lz gsoc2013-empathy-646ed927c6691796df969502bf5031771ace99fb.tar.xz gsoc2013-empathy-646ed927c6691796df969502bf5031771ace99fb.tar.zst gsoc2013-empathy-646ed927c6691796df969502bf5031771ace99fb.zip |
Use GTK+ 2.14.0 and gtk_show_uri (Cosimo Cecchi).
svn path=/trunk/; revision=1942
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-chat-view.c | 29 | ||||
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.c | 12 | ||||
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.h | 3 |
3 files changed, 24 insertions, 20 deletions
diff --git a/libempathy-gtk/empathy-chat-view.c b/libempathy-gtk/empathy-chat-view.c index 2131cecb4..367b6308d 100644 --- a/libempathy-gtk/empathy-chat-view.c +++ b/libempathy-gtk/empathy-chat-view.c @@ -113,7 +113,7 @@ static gboolean chat_view_url_event_cb (GtkTextTag * GObject *object, GdkEvent *event, GtkTextIter *iter, - GtkTextBuffer *buffer); + EmpathyChatView *view); static void chat_view_open_address_cb (GtkMenuItem *menuitem, const gchar *url); static void chat_view_copy_address_cb (GtkMenuItem *menuitem, @@ -289,7 +289,7 @@ chat_view_setup_tags (EmpathyChatView *view) g_signal_connect (tag, "event", G_CALLBACK (chat_view_url_event_cb), - priv->buffer); + view); g_signal_connect (view, "motion-notify-event", @@ -497,17 +497,20 @@ chat_view_event_cb (EmpathyChatView *view, } static gboolean -chat_view_url_event_cb (GtkTextTag *tag, - GObject *object, - GdkEvent *event, - GtkTextIter *iter, - GtkTextBuffer *buffer) +chat_view_url_event_cb (GtkTextTag *tag, + GObject *object, + GdkEvent *event, + GtkTextIter *iter, + EmpathyChatView *view) { - GtkTextIter start, end; - gchar *str; + GtkTextIter start, end; + gchar *str; + EmpathyChatViewPriv *priv; + + priv = GET_PRIV (view); /* If the link is being selected, don't do anything. */ - gtk_text_buffer_get_selection_bounds (buffer, &start, &end); + gtk_text_buffer_get_selection_bounds (priv->buffer, &start, &end); if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end)) { return FALSE; } @@ -517,12 +520,12 @@ chat_view_url_event_cb (GtkTextTag *tag, if (gtk_text_iter_backward_to_tag_toggle (&start, tag) && gtk_text_iter_forward_to_tag_toggle (&end, tag)) { - str = gtk_text_buffer_get_text (buffer, + str = gtk_text_buffer_get_text (priv->buffer, &start, &end, FALSE); - empathy_url_show (str); + empathy_url_show (GTK_WIDGET (view), str); g_free (str); } } @@ -533,7 +536,7 @@ chat_view_url_event_cb (GtkTextTag *tag, static void chat_view_open_address_cb (GtkMenuItem *menuitem, const gchar *url) { - empathy_url_show (url); + empathy_url_show (GTK_WIDGET (menuitem), url); } static void diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 91783d7ce..cd5cf0766 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -1332,7 +1332,8 @@ fixup_url (const gchar *url) } void -empathy_url_show (const char *url) +empathy_url_show (GtkWidget *parent, + const char *url) { gchar *real_url; GError *error = NULL; @@ -1342,10 +1343,9 @@ empathy_url_show (const char *url) url = real_url; } - /* FIXME: this does not work for multihead, we should use - * GdkAppLaunchContext or gtk_show_url, see bug #514396. - */ - g_app_info_launch_default_for_uri (url, NULL, &error); + gtk_show_uri (gtk_widget_get_screen (parent), url, + gtk_get_current_event_time (), &error); + if (error) { GtkWidget *dialog; @@ -1371,7 +1371,7 @@ link_button_hook (GtkLinkButton *button, const gchar *link, gpointer user_data) { - empathy_url_show (link); + empathy_url_show (GTK_WIDGET (button), link); } GtkWidget * diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h index 932615027..4a6efc6d0 100644 --- a/libempathy-gtk/empathy-ui-utils.h +++ b/libempathy-gtk/empathy-ui-utils.h @@ -102,7 +102,8 @@ void empathy_window_present (GtkWindow *windo void empathy_window_iconify (GtkWindow *window, GtkStatusIcon *status_icon); GtkWindow * empathy_get_toplevel_window (GtkWidget *widget); -void empathy_url_show (const char *url); +void empathy_url_show (GtkWidget *parent, + const char *url); void empathy_toggle_button_set_state_quietly (GtkWidget *widget, GCallback callback, gpointer user_data, |