Mercurial > pidgin.yaz
comparison pidgin/gtkutils.c @ 28777:596dc351c162
merge of '752623f68962a90397d0ac88cfa20f7435e704aa'
and 'e8f9d9be93f38aa597367b8f9bbb6322995e5ff3'
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 19 Oct 2009 22:56:57 +0000 |
parents | 3fdad8b715c7 |
children | 9c40a91d6c39 3a055fbe806b 7819d3819f4c |
comparison
equal
deleted
inserted
replaced
28776:0486e2a9b48f | 28777:596dc351c162 |
---|---|
73 GtkWidget *menu; | 73 GtkWidget *menu; |
74 gint default_item; | 74 gint default_item; |
75 } AopMenu; | 75 } AopMenu; |
76 | 76 |
77 static guint accels_save_timer = 0; | 77 static guint accels_save_timer = 0; |
78 static GList *gnome_url_handlers = NULL; | 78 static GSList *registered_url_handlers = NULL; |
79 | 79 |
80 static gboolean | 80 static gboolean |
81 url_clicked_idle_cb(gpointer data) | 81 url_clicked_idle_cb(gpointer data) |
82 { | 82 { |
83 purple_notify_uri(NULL, data); | 83 purple_notify_uri(NULL, data); |
3888 g_free(tmp2); | 3888 g_free(tmp2); |
3889 | 3889 |
3890 start += sizeof("/desktop/gnome/url-handlers/") - 1; | 3890 start += sizeof("/desktop/gnome/url-handlers/") - 1; |
3891 | 3891 |
3892 protocol = g_strdup_printf("%s:", start); | 3892 protocol = g_strdup_printf("%s:", start); |
3893 gnome_url_handlers = g_list_prepend(gnome_url_handlers, protocol); | 3893 registered_url_handlers = g_slist_prepend(registered_url_handlers, protocol); |
3894 gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, link_context_menu); | 3894 gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, link_context_menu); |
3895 } | 3895 } |
3896 start = c + 1; | 3896 start = c + 1; |
3897 } | 3897 } |
3898 } | 3898 } |
3899 g_free(tmp); | 3899 g_free(tmp); |
3900 | 3900 |
3901 return (gnome_url_handlers != NULL); | 3901 return (registered_url_handlers != NULL); |
3902 } | 3902 } |
3903 | 3903 |
3904 #ifdef _WIN32 | 3904 #ifdef _WIN32 |
3905 static void | 3905 static void |
3906 winpidgin_register_win32_url_handlers(void) | 3906 winpidgin_register_win32_url_handlers(void) |
3908 int idx = 0; | 3908 int idx = 0; |
3909 LONG ret = ERROR_SUCCESS; | 3909 LONG ret = ERROR_SUCCESS; |
3910 | 3910 |
3911 do { | 3911 do { |
3912 DWORD nameSize = 256; | 3912 DWORD nameSize = 256; |
3913 char protocol[256]; | 3913 char start[256]; |
3914 /* I don't think we need to worry about non-ASCII protocol names */ | 3914 /* I don't think we need to worry about non-ASCII protocol names */ |
3915 ret = RegEnumKeyExA(HKEY_CLASSES_ROOT, idx++, protocol, &nameSize, | 3915 ret = RegEnumKeyExA(HKEY_CLASSES_ROOT, idx++, start, &nameSize, |
3916 NULL, NULL, NULL, NULL); | 3916 NULL, NULL, NULL, NULL); |
3917 if (ret == ERROR_SUCCESS) { | 3917 if (ret == ERROR_SUCCESS) { |
3918 HKEY reg_key = NULL; | 3918 HKEY reg_key = NULL; |
3919 ret = RegOpenKeyExA(HKEY_CLASSES_ROOT, protocol, 0, KEY_READ, ®_key); | 3919 ret = RegOpenKeyExA(HKEY_CLASSES_ROOT, start, 0, KEY_READ, ®_key); |
3920 if (ret == ERROR_SUCCESS) { | 3920 if (ret == ERROR_SUCCESS) { |
3921 ret = RegQueryValueExA(reg_key, "URL Protocol", NULL, NULL, NULL, NULL); | 3921 ret = RegQueryValueExA(reg_key, "URL Protocol", NULL, NULL, NULL, NULL); |
3922 if (ret == ERROR_SUCCESS) { | 3922 if (ret == ERROR_SUCCESS) { |
3923 gchar *protocol = g_strdup_printf("%s:", start); | |
3924 registered_url_handlers = g_slist_prepend(registered_url_handlers, protocol); | |
3923 /* We still pass everything to the "http" "open" handler for security reasons */ | 3925 /* We still pass everything to the "http" "open" handler for security reasons */ |
3924 gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, link_context_menu); | 3926 gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, link_context_menu); |
3925 } | 3927 } |
3926 RegCloseKey(reg_key); | 3928 RegCloseKey(reg_key); |
3927 } | 3929 } |
3962 void pidgin_utils_uninit(void) | 3964 void pidgin_utils_uninit(void) |
3963 { | 3965 { |
3964 gtk_imhtml_class_register_protocol("open://", NULL, NULL); | 3966 gtk_imhtml_class_register_protocol("open://", NULL, NULL); |
3965 | 3967 |
3966 /* If we have GNOME handlers registered, unregister them. */ | 3968 /* If we have GNOME handlers registered, unregister them. */ |
3967 if (gnome_url_handlers) | 3969 if (registered_url_handlers) |
3968 { | 3970 { |
3969 GList *l; | 3971 GSList *l; |
3970 for (l = gnome_url_handlers ; l ; l = l->next) | 3972 for (l = registered_url_handlers; l; l = l->next) |
3971 { | 3973 { |
3972 gtk_imhtml_class_register_protocol((char *)l->data, NULL, NULL); | 3974 gtk_imhtml_class_register_protocol((char *)l->data, NULL, NULL); |
3973 g_free(l->data); | 3975 g_free(l->data); |
3974 } | 3976 } |
3975 g_list_free(gnome_url_handlers); | 3977 g_slist_free(registered_url_handlers); |
3976 gnome_url_handlers = NULL; | 3978 registered_url_handlers = NULL; |
3977 return; | 3979 return; |
3978 } | 3980 } |
3979 | 3981 |
3980 gtk_imhtml_class_register_protocol("audio://", NULL, NULL); | 3982 gtk_imhtml_class_register_protocol("audio://", NULL, NULL); |
3981 gtk_imhtml_class_register_protocol("file://", NULL, NULL); | 3983 gtk_imhtml_class_register_protocol("file://", NULL, NULL); |