comparison src/dialogs.c @ 4061:890b4f1318df

[gaim-migrate @ 4271] fixed g_build_filename memory leaks committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Wed, 11 Dec 2002 14:44:10 +0000
parents c3c36d2444af
children 3ccbdf8e7f8d
comparison
equal deleted inserted replaced
4060:c3c36d2444af 4061:890b4f1318df
3592 gtk_text_buffer_insert_at_cursor(c->entry_buffer, 3592 gtk_text_buffer_insert_at_cursor(c->entry_buffer,
3593 current_smiley, -1); 3593 current_smiley, -1);
3594 close_smiley_dialog(NULL, c); 3594 close_smiley_dialog(NULL, c);
3595 } 3595 }
3596 3596
3597 static void toolbar_add_smiley(struct conversation *c, GtkWidget *bar, char *filename, char *face) 3597 static void toolbar_add_smiley(struct conversation *c, GtkWidget *bar, char* path, char *filename, char *face)
3598 { 3598 {
3599 GtkWidget *tpm; 3599 GtkWidget *image;
3600 GtkImage *image;
3601 GtkWidget *button; 3600 GtkWidget *button;
3602 3601 char *buf;
3603 image = gtk_image_new_from_file(filename); 3602
3603 buf = g_build_filename(path, filename, NULL);
3604 image = gtk_image_new_from_file(buf);
3605 g_free(buf);
3604 button = 3606 button =
3605 gtk_toolbar_append_item(GTK_TOOLBAR(bar), NULL, NULL, NULL, 3607 gtk_toolbar_append_item(GTK_TOOLBAR(bar), NULL, NULL, NULL,
3606 image, GTK_SIGNAL_FUNC(set_smiley), (char *)face); 3608 image, GTK_SIGNAL_FUNC(set_smiley), (char *)face);
3607 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); 3609 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c);
3608 3610
3614 { 3616 {
3615 GtkWidget *dialog; 3617 GtkWidget *dialog;
3616 GtkWidget *vbox, *smiley_box = NULL; 3618 GtkWidget *vbox, *smiley_box = NULL;
3617 GtkWidget *win; 3619 GtkWidget *win;
3618 GtkWidget *bbox; 3620 GtkWidget *bbox;
3619 GSList *smilies; 3621 char *smiley_path = 0;
3620 int smiley_count = 0;
3621 int total_count = 0;
3622 3622
3623 if (c->smiley_dialog) 3623 if (c->smiley_dialog)
3624 return; 3624 return;
3625 3625
3626 win = c->window; 3626 win = c->window;
3640 /* pack buttons */ 3640 /* pack buttons */
3641 3641
3642 smiley_box = gtk_toolbar_new(); 3642 smiley_box = gtk_toolbar_new();
3643 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0); 3643 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0);
3644 3644
3645 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "angel.png", NULL), "O:-)"); 3645 smiley_path = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", NULL);
3646 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "bigsmile.png", NULL), ":-D"); 3646 toolbar_add_smiley(c, smiley_box, smiley_path, "angel.png", "O:-)");
3647 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "burp.png", NULL), ":-!"); 3647 toolbar_add_smiley(c, smiley_box, smiley_path, "bigsmile.png", ":-D");
3648 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "crossedlips.png", NULL), ":-X"); 3648 toolbar_add_smiley(c, smiley_box, smiley_path, "burp.png", ":-!");
3649 toolbar_add_smiley(c, smiley_box, smiley_path, "crossedlips.png", ":-X");
3649 3650
3650 smiley_box = gtk_toolbar_new(); 3651 smiley_box = gtk_toolbar_new();
3651 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0); 3652 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0);
3652 3653 toolbar_add_smiley(c, smiley_box, smiley_path, "cry.png", ":'(");
3653 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "cry.png", NULL), ":'("); 3654 toolbar_add_smiley(c, smiley_box, smiley_path, "embarrassed.png", ":-[");
3654 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "embarrassed.png", NULL), ":-["); 3655 toolbar_add_smiley(c, smiley_box, smiley_path, "kiss.png", ":-*");
3655 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "kiss.png", NULL), ":-*"); 3656 toolbar_add_smiley(c, smiley_box, smiley_path, "moneymouth.png", ":-$");
3656 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "moneymouth.png", NULL), ":-$");
3657 3657
3658 smiley_box = gtk_toolbar_new(); 3658 smiley_box = gtk_toolbar_new();
3659 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0); 3659 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0);
3660 3660 toolbar_add_smiley(c, smiley_box, smiley_path, "sad.png", ":-(");
3661 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "sad.png", NULL), ":-("); 3661 toolbar_add_smiley(c, smiley_box, smiley_path, "scream.png", "=-O");
3662 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "scream.png", NULL), "=-O"); 3662 toolbar_add_smiley(c, smiley_box, smiley_path, "smile.png", ":-)");
3663 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "smile.png", NULL), ":-)"); 3663 toolbar_add_smiley(c, smiley_box, smiley_path, "cool.png", "8-)");
3664 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "cool.png", NULL), "8-)");
3665 3664
3666 smiley_box = gtk_toolbar_new(); 3665 smiley_box = gtk_toolbar_new();
3667 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0); 3666 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0);
3668 3667 toolbar_add_smiley(c, smiley_box, smiley_path, "think.png", ":-/");
3669 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "think.png", NULL), ":-/"); 3668 toolbar_add_smiley(c, smiley_box, smiley_path, "tongue.png", ":-P");
3670 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "tongue.png", NULL), ":-P"); 3669 toolbar_add_smiley(c, smiley_box, smiley_path, "wink.png", ";-)");
3671 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "wink.png", NULL), ";-)"); 3670 toolbar_add_smiley(c, smiley_box, smiley_path, "yell.png", ">:o");
3672 toolbar_add_smiley(c, smiley_box, g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "yell.png", NULL), ">:o"); 3671
3672 g_free(smiley_path);
3673 3673
3674 gtk_container_add(GTK_CONTAINER(dialog), vbox); 3674 gtk_container_add(GTK_CONTAINER(dialog), vbox);
3675 gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); 3675 gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
3676 3676
3677 /* connect signals */ 3677 /* connect signals */