Mercurial > pidgin
comparison src/dialogs.c @ 1428:00b3d02a2168
[gaim-migrate @ 1438]
gtkhtml has gotten replaced by gtkimhtml.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Fri, 26 Jan 2001 02:02:36 +0000 |
| parents | 51620cc6ec4b |
| children | 6650776468b3 |
comparison
equal
deleted
inserted
replaced
| 1427:28278bd61403 | 1428:00b3d02a2168 |
|---|---|
| 37 #include <netinet/in.h> | 37 #include <netinet/in.h> |
| 38 #include <arpa/inet.h> | 38 #include <arpa/inet.h> |
| 39 | 39 |
| 40 #include <gtk/gtk.h> | 40 #include <gtk/gtk.h> |
| 41 #include "gaim.h" | 41 #include "gaim.h" |
| 42 #include "gtkhtml.h" | 42 #include "gtkimhtml.h" |
| 43 #include "prpl.h" | 43 #include "prpl.h" |
| 44 | 44 |
| 45 #include "pixmaps/gnome_preferences.xpm" | 45 #include "pixmaps/gnome_preferences.xpm" |
| 46 #include "pixmaps/cancel.xpm" | 46 #include "pixmaps/cancel.xpm" |
| 47 #include "pixmaps/save.xpm" | 47 #include "pixmaps/save.xpm" |
| 54 #include "pixmaps/burp.xpm" | 54 #include "pixmaps/burp.xpm" |
| 55 #include "pixmaps/crossedlips.xpm" | 55 #include "pixmaps/crossedlips.xpm" |
| 56 #include "pixmaps/cry.xpm" | 56 #include "pixmaps/cry.xpm" |
| 57 #include "pixmaps/embarrassed.xpm" | 57 #include "pixmaps/embarrassed.xpm" |
| 58 #include "pixmaps/kiss.xpm" | 58 #include "pixmaps/kiss.xpm" |
| 59 #include "pixmaps/luke03.xpm" | |
| 59 #include "pixmaps/moneymouth.xpm" | 60 #include "pixmaps/moneymouth.xpm" |
| 61 #include "pixmaps/oneeye.xpm" | |
| 60 #include "pixmaps/sad.xpm" | 62 #include "pixmaps/sad.xpm" |
| 61 #include "pixmaps/scream.xpm" | 63 #include "pixmaps/scream.xpm" |
| 62 #include "pixmaps/smile.xpm" | 64 #include "pixmaps/smile.xpm" |
| 63 #include "pixmaps/smile8.xpm" | 65 #include "pixmaps/smile8.xpm" |
| 64 #include "pixmaps/think.xpm" | 66 #include "pixmaps/think.xpm" |
| 65 #include "pixmaps/tongue.xpm" | 67 #include "pixmaps/tongue.xpm" |
| 66 #include "pixmaps/wink.xpm" | 68 #include "pixmaps/wink.xpm" |
| 67 #include "pixmaps/yell.xpm" | 69 #include "pixmaps/yell.xpm" |
| 70 | |
| 71 #include "pixmaps/aol_icon.xpm" | |
| 72 #include "pixmaps/free_icon.xpm" | |
| 73 #include "pixmaps/dt_icon.xpm" | |
| 74 #include "pixmaps/admin_icon.xpm" | |
| 68 | 75 |
| 69 #define DEFAULT_FONT_NAME "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1" | 76 #define DEFAULT_FONT_NAME "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1" |
| 70 | 77 |
| 71 #define PATHSIZE 1024 | 78 #define PATHSIZE 1024 |
| 72 | 79 |
| 1754 | 1761 |
| 1755 static void info_dlg_free(GtkWidget *b, struct info_dlg *d) { | 1762 static void info_dlg_free(GtkWidget *b, struct info_dlg *d) { |
| 1756 g_free(d); | 1763 g_free(d); |
| 1757 } | 1764 } |
| 1758 | 1765 |
| 1766 gchar **info_img_handler(gchar *url) | |
| 1767 { | |
| 1768 if (!g_strcasecmp(url, "free_icon.gif")) | |
| 1769 return free_icon_xpm; | |
| 1770 if (!g_strcasecmp(url, "aol_icon.gif")) | |
| 1771 return aol_icon_xpm; | |
| 1772 if (!g_strcasecmp(url, "dt_icon.gif")) | |
| 1773 return dt_icon_xpm; | |
| 1774 if (!g_strcasecmp(url, "admin_icon.gif")) | |
| 1775 return admin_icon_xpm; | |
| 1776 return NULL; | |
| 1777 } | |
| 1778 | |
| 1759 void g_show_info_text(char *info) | 1779 void g_show_info_text(char *info) |
| 1760 { | 1780 { |
| 1761 GtkWidget *ok; | 1781 GtkWidget *ok; |
| 1762 GtkWidget *label; | 1782 GtkWidget *label; |
| 1763 GtkWidget *text; | 1783 GtkWidget *text; |
| 1764 GtkWidget *bbox; | 1784 GtkWidget *bbox; |
| 1765 GtkWidget *sw; | 1785 GtkWidget *sw; |
| 1786 gint options = 0; | |
| 1766 | 1787 |
| 1767 struct info_dlg *b = g_new0(struct info_dlg, 1); | 1788 struct info_dlg *b = g_new0(struct info_dlg, 1); |
| 1768 | 1789 |
| 1769 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | 1790 b->window = gtk_window_new(GTK_WINDOW_DIALOG); |
| 1770 dialogwindows = g_list_prepend(dialogwindows, b->window); | 1791 dialogwindows = g_list_prepend(dialogwindows, b->window); |
| 1788 | 1809 |
| 1789 sw = gtk_scrolled_window_new (NULL, NULL); | 1810 sw = gtk_scrolled_window_new (NULL, NULL); |
| 1790 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), | 1811 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), |
| 1791 GTK_POLICY_NEVER, | 1812 GTK_POLICY_NEVER, |
| 1792 GTK_POLICY_ALWAYS); | 1813 GTK_POLICY_ALWAYS); |
| 1793 text = gtk_html_new(NULL, NULL); | 1814 text = gtk_imhtml_new(NULL, NULL); |
| 1794 b->text = text; | 1815 b->text = text; |
| 1795 gtk_container_add(GTK_CONTAINER(sw), text); | 1816 gtk_container_add(GTK_CONTAINER(sw), text); |
| 1796 | 1817 |
| 1797 GTK_HTML (text)->hadj->step_increment = 10.0; | 1818 GTK_LAYOUT(text)->hadjustment->step_increment = 10.0; |
| 1798 GTK_HTML (text)->vadj->step_increment = 10.0; | 1819 GTK_LAYOUT(text)->vadjustment->step_increment = 10.0; |
| 1799 gtk_widget_set_usize(sw, 300, 250); | 1820 gtk_widget_set_usize(sw, 300, 250); |
| 1821 gtk_imhtml_set_img_handler(GTK_IMHTML(text), info_img_handler); | |
| 1822 if (!(display_options & OPT_DISP_SHOW_SMILEY)) | |
| 1823 gtk_imhtml_show_smileys(GTK_IMHTML(b->text), FALSE); | |
| 1824 gtk_signal_connect(GTK_OBJECT(text), "url_clicked", GTK_SIGNAL_FUNC(open_url_nw), NULL); | |
| 1825 gtk_imhtml_associate_smiley(GTK_IMHTML(text), "C:)", luke03_xpm); | |
| 1826 gtk_imhtml_associate_smiley(GTK_IMHTML(text), "C:-)", luke03_xpm); | |
| 1827 gtk_imhtml_associate_smiley(GTK_IMHTML(text), "O-)", oneeye_xpm); | |
| 1800 | 1828 |
| 1801 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | 1829 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
| 1802 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0); | 1830 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0); |
| 1803 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); | 1831 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); |
| 1804 | 1832 |
| 1805 aol_icon(b->window->window); | 1833 aol_icon(b->window->window); |
| 1806 gtk_widget_show_all(b->window); | 1834 gtk_widget_show_all(b->window); |
| 1807 | 1835 |
| 1808 if (display_options & OPT_DISP_SHOW_SMILEY) | 1836 if (display_options & OPT_DISP_IGNORE_COLOUR) |
| 1809 write_html_with_smileys(b->window, b->text, info); | 1837 options ^= GTK_IMHTML_NO_COLOURS; |
| 1810 else | 1838 if (display_options & OPT_DISP_IGNORE_FONTS) |
| 1811 gtk_html_append_text(GTK_HTML(b->text), info, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0); | 1839 options ^= GTK_IMHTML_NO_FONTS; |
| 1812 gtk_html_append_text(GTK_HTML(b->text), "</BODY>", 0); | 1840 options ^= GTK_IMHTML_NO_COMMENTS; |
| 1841 options ^= GTK_IMHTML_NO_TITLE; | |
| 1842 options ^= GTK_IMHTML_NO_NEWLINE; | |
| 1843 options ^= GTK_IMHTML_NO_SCROLL; | |
| 1844 gtk_imhtml_append_text(GTK_IMHTML(b->text), info, options); | |
| 1845 gtk_imhtml_append_text(GTK_IMHTML(b->text), "<BR>", 0); | |
| 1813 | 1846 |
| 1814 gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)), 0); | 1847 gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)), 0); |
| 1815 } | 1848 } |
| 1816 | 1849 |
| 1817 void g_show_info(struct aim_user *user, char *url) { | 1850 void g_show_info(struct aim_user *user, char *url) { |
