comparison src/gtkimhtmltoolbar.c @ 8892:ed62fb44aa30

[gaim-migrate @ 9661] " This patch does two things: 1) Fixes a crash in themes.c if the smiley theme has no smileys and you attempt to get a list of them elsewhere in gaim. 2) Makes the insert smiley dialog have a little text label that says the smiley theme has no available smileys if it would otherwise contain nothing. This solution was suggested as acceptable for letting the user know there's no smileys without disabling the button, blah blah blah. You can ask me for the gory details if you want to know what I would have had to code to make it work the other way." --Kevin Stange committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 06 May 2004 14:02:06 +0000
parents 482fc53c969d
children 4ff4c34b7500
comparison
equal deleted inserted replaced
8891:4f7c365c5c5a 8892:ed62fb44aa30
572 return; 572 return;
573 } 573 }
574 574
575 if (toolbar->sml) 575 if (toolbar->sml)
576 smileys = get_proto_smileys(toolbar->sml); 576 smileys = get_proto_smileys(toolbar->sml);
577 else 577 else
578 smileys = get_proto_smileys(GAIM_PROTO_DEFAULT); 578 smileys = get_proto_smileys(GAIM_PROTO_DEFAULT);
579 579
580 while(smileys) { 580 while(smileys) {
581 GtkIMHtmlSmiley *smiley = smileys->data; 581 GtkIMHtmlSmiley *smiley = smileys->data;
582 if(!smiley->hidden) { 582 if(!smiley->hidden) {
583 if(smiley_is_unique(unique_smileys, smiley)) 583 if(smiley_is_unique(unique_smileys, smiley))
584 unique_smileys = g_slist_append(unique_smileys, smiley); 584 unique_smileys = g_slist_append(unique_smileys, smiley);
585 } 585 }
586 smileys = smileys->next; 586 smileys = smileys->next;
587 } 587 }
588 588
589
590 width = floor(sqrt(g_slist_length(unique_smileys)));
591
592 GAIM_DIALOG(dialog); 589 GAIM_DIALOG(dialog);
590
593 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); 591 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
594 gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog"); 592 gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog");
595 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); 593 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
596 594
597 smiley_table = gtk_table_new(width, width, TRUE); 595 if(g_slist_length(unique_smileys)) {
598 596
599 /* pack buttons */ 597 width = floor(sqrt(g_slist_length(unique_smileys)));
600 598
601 while(unique_smileys) { 599 smiley_table = gtk_table_new(width, width, TRUE);
602 GtkIMHtmlSmiley *smiley = unique_smileys->data; 600
603 if(!smiley->hidden) { 601 /* pack buttons */
604 add_smiley(toolbar, smiley_table, row, col, smiley->file, smiley->smile); 602
605 if(++col >= width) { 603 while(unique_smileys) {
606 col = 0; 604 GtkIMHtmlSmiley *smiley = unique_smileys->data;
607 row++; 605 if(!smiley->hidden) {
606 add_smiley(toolbar, smiley_table, row, col, smiley->file, smiley->smile);
607 if(++col >= width) {
608 col = 0;
609 row++;
610 }
608 } 611 }
612 unique_smileys = unique_smileys->next;
609 } 613 }
610 unique_smileys = unique_smileys->next; 614 }
615 else {
616 smiley_table = gtk_label_new(_("This theme has no available smileys."));
611 } 617 }
612 618
613 gtk_container_add(GTK_CONTAINER(dialog), smiley_table); 619 gtk_container_add(GTK_CONTAINER(dialog), smiley_table);
614 620
615 gtk_widget_show(smiley_table); 621 gtk_widget_show(smiley_table);