comparison src/dialogs.c @ 2773:a0fd8f91e294

[gaim-migrate @ 2786] SPAM!!! All recipients of the email generated by this commit each owe me $125 per email sent, plus a $75 handling fee for all messages combined. Or was that supposed to be the other way around. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 20 Nov 2001 01:01:22 +0000
parents 477a035d81e5
children 501de8a3b09f
comparison
equal deleted inserted replaced
2772:f9227268db25 2773:a0fd8f91e294
170 GtkWidget *stateentry; 170 GtkWidget *stateentry;
171 GtkWidget *countryentry; 171 GtkWidget *countryentry;
172 }; 172 };
173 173
174 struct info_dlg { 174 struct info_dlg {
175 struct gaim_connection *gc;
176 char *who;
175 GtkWidget *window; 177 GtkWidget *window;
176 GtkWidget *text; 178 GtkWidget *text;
177 GtkWidget *close;
178 }; 179 };
179 180 static GSList *info_dlgs = NULL;
181
182 static struct info_dlg *find_info_dlg(struct gaim_connection *gc, char *who)
183 {
184 GSList *i = info_dlgs;
185 while (i) {
186 struct info_dlg *d = i->data;
187 i = i->next;
188 if (d->gc != gc)
189 continue;
190 if (d->who == NULL)
191 continue;
192 if (!who)
193 continue;
194 if (!g_strcasecmp(normalize(who), d->who))
195 return d;
196 }
197 return NULL;
198 }
180 199
181 struct set_info_dlg { 200 struct set_info_dlg {
182 GtkWidget *window; 201 GtkWidget *window;
183 GtkWidget *menu; 202 GtkWidget *menu;
184 struct aim_user *user; 203 struct aim_user *user;
1730 /* The dialog for the info requests */ 1749 /* The dialog for the info requests */
1731 /*------------------------------------------------------------------------*/ 1750 /*------------------------------------------------------------------------*/
1732 1751
1733 static void info_dlg_free(GtkWidget *b, struct info_dlg *d) 1752 static void info_dlg_free(GtkWidget *b, struct info_dlg *d)
1734 { 1753 {
1754 if (g_slist_find(info_dlgs, d))
1755 info_dlgs = g_slist_remove(info_dlgs, d);
1756 g_free(d->who);
1735 g_free(d); 1757 g_free(d);
1736 } 1758 }
1737 1759
1738 gchar **info_img_handler(gchar *url) 1760 gchar **info_img_handler(gchar *url)
1739 { 1761 {
1748 if (!g_strcasecmp(url, "ab_icon.gif")) 1770 if (!g_strcasecmp(url, "ab_icon.gif"))
1749 return ab_xpm; 1771 return ab_xpm;
1750 return NULL; 1772 return NULL;
1751 } 1773 }
1752 1774
1753 void g_show_info_text(char *info, ...) 1775 void g_show_info_text(struct gaim_connection *gc, char *who, gboolean away, char *info, ...)
1754 { 1776 {
1755 GtkWidget *ok; 1777 GtkWidget *ok;
1756 GtkWidget *label; 1778 GtkWidget *label;
1757 GtkWidget *text; 1779 GtkWidget *text;
1758 GtkWidget *bbox; 1780 GtkWidget *bbox;
1759 GtkWidget *sw; 1781 GtkWidget *sw;
1760 gint options = 0; 1782 gint options = 0;
1761 char *more_info; 1783 char *more_info;
1762 va_list ap; 1784 va_list ap;
1763 1785
1764 struct info_dlg *b = g_new0(struct info_dlg, 1); 1786 struct info_dlg *b = find_info_dlg(gc, who);
1765 1787 if (!b && away)
1766 va_start(ap, info); 1788 return;
1767 1789 if (!b) {
1768 GAIM_DIALOG(b->window); 1790 b = g_new0(struct info_dlg, 1);
1769 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim"); 1791 b->gc = gc;
1770 gtk_container_border_width(GTK_CONTAINER(b->window), 5); 1792 b->who = who ? g_strdup(normalize(who)) : NULL;
1771 bbox = gtk_vbox_new(FALSE, 5); 1793 info_dlgs = g_slist_append(info_dlgs, b);
1772 gtk_container_add(GTK_CONTAINER(b->window), bbox); 1794
1773 gtk_widget_realize(GTK_WIDGET(b->window)); 1795 GAIM_DIALOG(b->window);
1774 ok = picture_button(b->window, _("OK"), ok_xpm); 1796 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim");
1775 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", GTK_SIGNAL_FUNC(destroy_dialog), b->window); 1797 gtk_container_border_width(GTK_CONTAINER(b->window), 5);
1776 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", GTK_SIGNAL_FUNC(info_dlg_free), b); 1798 gtk_widget_realize(GTK_WIDGET(b->window));
1777 gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(destroy_dialog), b->window); 1799 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", GTK_SIGNAL_FUNC(info_dlg_free), b);
1778 1800 aol_icon(b->window->window);
1779 label = gtk_label_new(_("Below are the results of your search: ")); 1801
1780 1802 bbox = gtk_vbox_new(FALSE, 5);
1781 sw = gtk_scrolled_window_new(NULL, NULL); 1803 gtk_container_add(GTK_CONTAINER(b->window), bbox);
1782 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); 1804
1783 text = gtk_imhtml_new(NULL, NULL); 1805 label = gtk_label_new(_("Below are the results of your search: "));
1784 b->text = text; 1806 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0);
1785 gtk_container_add(GTK_CONTAINER(sw), text); 1807
1786 1808 sw = gtk_scrolled_window_new(NULL, NULL);
1787 GTK_LAYOUT(text)->hadjustment->step_increment = 10.0; 1809 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
1788 GTK_LAYOUT(text)->vadjustment->step_increment = 10.0; 1810 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0);
1789 gtk_widget_set_usize(sw, 300, 250); 1811
1790 gtk_imhtml_set_img_handler(GTK_IMHTML(text), info_img_handler); 1812 text = gtk_imhtml_new(NULL, NULL);
1791 gaim_setup_imhtml(text); 1813 b->text = text;
1792 1814 gtk_container_add(GTK_CONTAINER(sw), text);
1793 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); 1815 GTK_LAYOUT(text)->hadjustment->step_increment = 10.0;
1794 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0); 1816 GTK_LAYOUT(text)->vadjustment->step_increment = 10.0;
1795 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); 1817 gtk_widget_set_usize(sw, 300, 250);
1796 1818 gtk_imhtml_set_img_handler(GTK_IMHTML(text), info_img_handler);
1797 aol_icon(b->window->window); 1819 gaim_setup_imhtml(text);
1798 gtk_widget_show_all(b->window); 1820
1821 ok = picture_button(b->window, _("OK"), ok_xpm);
1822 gtk_signal_connect_object(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy),
1823 GTK_OBJECT(b->window));
1824 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0);
1825
1826 gtk_widget_show_all(b->window);
1827 }
1799 1828
1800 if (convo_options & OPT_CONVO_IGNORE_COLOUR) 1829 if (convo_options & OPT_CONVO_IGNORE_COLOUR)
1801 options ^= GTK_IMHTML_NO_COLOURS; 1830 options ^= GTK_IMHTML_NO_COLOURS;
1802 if (convo_options & OPT_CONVO_IGNORE_FONTS) 1831 if (convo_options & OPT_CONVO_IGNORE_FONTS)
1803 options ^= GTK_IMHTML_NO_FONTS; 1832 options ^= GTK_IMHTML_NO_FONTS;
1805 options ^= GTK_IMHTML_NO_SIZES; 1834 options ^= GTK_IMHTML_NO_SIZES;
1806 options ^= GTK_IMHTML_NO_COMMENTS; 1835 options ^= GTK_IMHTML_NO_COMMENTS;
1807 options ^= GTK_IMHTML_NO_TITLE; 1836 options ^= GTK_IMHTML_NO_TITLE;
1808 options ^= GTK_IMHTML_NO_NEWLINE; 1837 options ^= GTK_IMHTML_NO_NEWLINE;
1809 options ^= GTK_IMHTML_NO_SCROLL; 1838 options ^= GTK_IMHTML_NO_SCROLL;
1839
1810 gtk_imhtml_append_text(GTK_IMHTML(b->text), info, options); 1840 gtk_imhtml_append_text(GTK_IMHTML(b->text), info, options);
1841
1842 va_start(ap, info);
1811 while ((more_info = va_arg(ap, char *)) != NULL) 1843 while ((more_info = va_arg(ap, char *)) != NULL)
1812 gtk_imhtml_append_text(GTK_IMHTML(b->text), more_info, options); 1844 gtk_imhtml_append_text(GTK_IMHTML(b->text), more_info, options);
1813 va_end(ap); 1845 va_end(ap);
1846
1814 gtk_imhtml_append_text(GTK_IMHTML(b->text), "<BR>", 0); 1847 gtk_imhtml_append_text(GTK_IMHTML(b->text), "<BR>", 0);
1815 1848
1816 gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)), 0); 1849 if (away)
1850 info_dlgs = g_slist_remove(info_dlgs, b);
1851 else
1852 serv_get_away(gc, who);
1817 } 1853 }
1818 1854
1819 /*------------------------------------------------------------------------*/ 1855 /*------------------------------------------------------------------------*/
1820 /* The dialog for adding to permit/deny */ 1856 /* The dialog for adding to permit/deny */
1821 /*------------------------------------------------------------------------*/ 1857 /*------------------------------------------------------------------------*/