| 762 } |
762 } |
| 763 |
763 |
| 764 static void |
764 static void |
| 765 insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar) |
765 insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar) |
| 766 { |
766 { |
| 767 GtkWidget *dialog; |
767 GtkWidget *dialog, *vbox; |
| 768 GtkWidget *smiley_table = NULL; |
768 GtkWidget *smiley_table = NULL; |
| 769 GSList *smileys, *unique_smileys = NULL; |
769 GSList *smileys, *unique_smileys = NULL; |
| 770 const GSList *custom_smileys = NULL; |
770 const GSList *custom_smileys = NULL; |
| 771 gboolean supports_custom = FALSE; |
771 gboolean supports_custom = FALSE; |
| 772 GtkRequisition req; |
772 GtkRequisition req; |
| 804 } |
804 } |
| 805 } |
805 } |
| 806 |
806 |
| 807 dialog = pidgin_create_dialog(_("Smile!"), 0, "smiley_dialog", FALSE); |
807 dialog = pidgin_create_dialog(_("Smile!"), 0, "smiley_dialog", FALSE); |
| 808 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); |
808 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); |
| |
809 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(dialog), FALSE, 0); |
| 809 |
810 |
| 810 if (unique_smileys != NULL) { |
811 if (unique_smileys != NULL) { |
| 811 struct smiley_button_list *ls; |
812 struct smiley_button_list *ls; |
| 812 int max_line_width, num_lines, button_width = 0; |
813 int max_line_width, num_lines, button_width = 0; |
| 813 |
814 |
| 822 GtkRequisition req; |
823 GtkRequisition req; |
| 823 g_signal_connect(G_OBJECT(manage), "clicked", |
824 g_signal_connect(G_OBJECT(manage), "clicked", |
| 824 G_CALLBACK(pidgin_smiley_manager_show), NULL); |
825 G_CALLBACK(pidgin_smiley_manager_show), NULL); |
| 825 g_signal_connect_swapped(G_OBJECT(manage), "clicked", |
826 g_signal_connect_swapped(G_OBJECT(manage), "clicked", |
| 826 G_CALLBACK(gtk_widget_destroy), dialog); |
827 G_CALLBACK(gtk_widget_destroy), dialog); |
| 827 gtk_box_pack_end(GTK_BOX(smiley_table), manage, TRUE, FALSE, 0); |
828 gtk_box_pack_end(GTK_BOX(vbox), manage, FALSE, TRUE, 0); |
| 828 gtk_widget_size_request(manage, &req); |
829 gtk_widget_size_request(manage, &req); |
| 829 button_width = req.width; |
830 button_width = req.width; |
| 830 } |
831 } |
| 831 |
832 |
| 832 /* create list of smileys sorted by height */ |
833 /* create list of smileys sorted by height */ |
| 862 |
863 |
| 863 scrolled = gtk_scrolled_window_new (NULL, NULL); |
864 scrolled = gtk_scrolled_window_new (NULL, NULL); |
| 864 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_NONE); |
865 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_NONE); |
| 865 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled), |
866 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled), |
| 866 GTK_POLICY_NEVER, GTK_POLICY_NEVER); |
867 GTK_POLICY_NEVER, GTK_POLICY_NEVER); |
| 867 gtk_container_add(GTK_CONTAINER(pidgin_dialog_get_vbox(GTK_DIALOG(dialog))), scrolled); |
868 gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0); |
| 868 gtk_widget_show(scrolled); |
869 gtk_widget_show(scrolled); |
| 869 |
870 |
| 870 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), smiley_table); |
871 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), smiley_table); |
| 871 gtk_widget_show(smiley_table); |
872 gtk_widget_show(smiley_table); |
| 872 |
873 |
| 882 |
883 |
| 883 /* show everything */ |
884 /* show everything */ |
| 884 gtk_widget_show_all(dialog); |
885 gtk_widget_show_all(dialog); |
| 885 |
886 |
| 886 gtk_widget_size_request(viewport, &req); |
887 gtk_widget_size_request(viewport, &req); |
| 887 gtk_widget_set_size_request(scrolled, req.width, req.height); |
888 gtk_widget_set_size_request(scrolled, MIN(300, req.width), MIN(290, req.height)); |
| 888 |
889 |
| 889 /* The window has to be made resizable, and the scrollbars in the scrolled window |
890 /* The window has to be made resizable, and the scrollbars in the scrolled window |
| 890 * enabled only after setting the desired size of the window. If we do either of |
891 * enabled only after setting the desired size of the window. If we do either of |
| 891 * these tasks before now, GTK+ miscalculates the required size, and erronously |
892 * these tasks before now, GTK+ miscalculates the required size, and erronously |
| 892 * makes one or both scrollbars visible (sometimes). |
893 * makes one or both scrollbars visible (sometimes). |