| 795 int line_width = 0; |
795 int line_width = 0; |
| 796 |
796 |
| 797 if (!list) |
797 if (!list) |
| 798 return; |
798 return; |
| 799 |
799 |
| 800 line = gtk_hbox_new(FALSE, 0); |
800 line = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); |
| 801 gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); |
801 gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); |
| 802 for (; list; list = list->next) { |
802 for (; list; list = list->next) { |
| 803 if (custom != !!(pidgin_webview_smiley_get_flags(list->smiley) & PIDGIN_WEBVIEW_SMILEY_CUSTOM)) |
803 if (custom != !!(pidgin_webview_smiley_get_flags(list->smiley) & PIDGIN_WEBVIEW_SMILEY_CUSTOM)) |
| 804 continue; |
804 continue; |
| 805 gtk_box_pack_start(GTK_BOX(line), list->button, FALSE, FALSE, 0); |
805 gtk_box_pack_start(GTK_BOX(line), list->button, FALSE, FALSE, 0); |
| 806 gtk_widget_show(list->button); |
806 gtk_widget_show(list->button); |
| 807 line_width += list->width; |
807 line_width += list->width; |
| 808 if (line_width >= max_width) { |
808 if (line_width >= max_width) { |
| 809 if (list->next) { |
809 if (list->next) { |
| 810 line = gtk_hbox_new(FALSE, 0); |
810 line = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); |
| 811 gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); |
811 gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); |
| 812 } |
812 } |
| 813 line_width = 0; |
813 line_width = 0; |
| 814 } |
814 } |
| 815 } |
815 } |
| 875 |
875 |
| 876 /* We use hboxes packed in a vbox */ |
876 /* We use hboxes packed in a vbox */ |
| 877 ls = NULL; |
877 ls = NULL; |
| 878 max_line_width = 0; |
878 max_line_width = 0; |
| 879 num_lines = floor(sqrt(g_slist_length(unique_smileys))); |
879 num_lines = floor(sqrt(g_slist_length(unique_smileys))); |
| 880 smiley_table = gtk_vbox_new(FALSE, 0); |
880 smiley_table = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); |
| 881 |
881 |
| 882 if (supports_custom) { |
882 if (supports_custom) { |
| 883 GtkWidget *manage = gtk_button_new_with_mnemonic(_("_Manage custom smileys")); |
883 GtkWidget *manage = gtk_button_new_with_mnemonic(_("_Manage custom smileys")); |
| 884 GtkRequisition req; |
884 GtkRequisition req; |
| 885 g_signal_connect(G_OBJECT(manage), "clicked", |
885 g_signal_connect(G_OBJECT(manage), "clicked", |
| 903 max_line_width = MAX(button_width, max_line_width / num_lines); |
903 max_line_width = MAX(button_width, max_line_width / num_lines); |
| 904 |
904 |
| 905 /* pack buttons of the list */ |
905 /* pack buttons of the list */ |
| 906 add_smiley_list(smiley_table, ls, max_line_width, FALSE); |
906 add_smiley_list(smiley_table, ls, max_line_width, FALSE); |
| 907 if (supports_custom) { |
907 if (supports_custom) { |
| 908 gtk_box_pack_start(GTK_BOX(smiley_table), gtk_hseparator_new(), TRUE, FALSE, 0); |
908 gtk_box_pack_start(GTK_BOX(smiley_table), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), TRUE, FALSE, 0); |
| 909 add_smiley_list(smiley_table, ls, max_line_width, TRUE); |
909 add_smiley_list(smiley_table, ls, max_line_width, TRUE); |
| 910 } |
910 } |
| 911 while (ls) { |
911 while (ls) { |
| 912 struct smiley_button_list *tmp = ls->next; |
912 struct smiley_button_list *tmp = ls->next; |
| 913 g_free(ls); |
913 g_free(ls); |