comparison src/dialogs.c @ 6372:9dd4bb3cf1df

[gaim-migrate @ 6877] Moved some utility functions out of dialogs.c and into gtkutils.c. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 05 Aug 2003 11:08:40 +0000
parents 8f94cce8faa5
children e9974608b319
comparison
equal deleted inserted replaced
6371:8f94cce8faa5 6372:9dd4bb3cf1df
23 #include "debug.h" 23 #include "debug.h"
24 #include "log.h" 24 #include "log.h"
25 #include "multi.h" 25 #include "multi.h"
26 #include "notify.h" 26 #include "notify.h"
27 #include "prefs.h" 27 #include "prefs.h"
28 #include "privacy.h"
29 #include "prpl.h" 28 #include "prpl.h"
30 #include "request.h" 29 #include "request.h"
31 #include "status.h" 30 #include "status.h"
32 #include "util.h" 31 #include "util.h"
33 32
3494 _("Please enter a new name for the selected group."), 3493 _("Please enter a new name for the selected group."),
3495 g->name, FALSE, FALSE, 3494 g->name, FALSE, FALSE,
3496 _("OK"), G_CALLBACK(do_rename_group), 3495 _("OK"), G_CALLBACK(do_rename_group),
3497 _("Cancel"), NULL, g); 3496 _("Cancel"), NULL, g);
3498 } 3497 }
3499
3500 GtkWidget *gaim_pixbuf_toolbar_button_from_stock(char *icon)
3501 {
3502 GtkWidget *button, *image, *bbox;
3503
3504 button = gtk_toggle_button_new();
3505 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
3506
3507 bbox = gtk_vbox_new(FALSE, 0);
3508
3509 gtk_container_add (GTK_CONTAINER(button), bbox);
3510
3511 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU);
3512 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0);
3513
3514 gtk_widget_show_all(bbox);
3515 return button;
3516 }
3517
3518 GtkWidget *
3519 gaim_pixbuf_button_from_stock(const char *text, const char *icon,
3520 GaimButtonOrientation style)
3521 {
3522 GtkWidget *button, *image, *label, *bbox, *ibox, *lbox;
3523 button = gtk_button_new();
3524
3525 if (style == GAIM_BUTTON_HORIZONTAL) {
3526 bbox = gtk_hbox_new(FALSE, 5);
3527 ibox = gtk_hbox_new(FALSE, 0);
3528 lbox = gtk_hbox_new(FALSE, 0);
3529 } else {
3530 bbox = gtk_vbox_new(FALSE, 5);
3531 ibox = gtk_vbox_new(FALSE, 0);
3532 lbox = gtk_vbox_new(FALSE, 0);
3533 }
3534
3535 gtk_container_add (GTK_CONTAINER(button), bbox);
3536
3537 gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox);
3538 gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox);
3539
3540 if (icon) {
3541 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON);
3542 gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, FALSE, 0);
3543 }
3544
3545 if (text) {
3546 label = gtk_label_new(NULL);
3547 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text);
3548 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button);
3549 gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0);
3550 }
3551
3552 gtk_widget_show_all(bbox);
3553 return button;
3554 }
3555
3556 GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonOrientation style)
3557 {
3558 GtkWidget *button, *image, *label, *bbox, *ibox, *lbox;
3559 button = gtk_button_new();
3560
3561 if (style == GAIM_BUTTON_HORIZONTAL) {
3562 bbox = gtk_hbox_new(FALSE, 5);
3563 ibox = gtk_hbox_new(FALSE, 0);
3564 lbox = gtk_hbox_new(FALSE, 0);
3565 } else {
3566 bbox = gtk_vbox_new(FALSE, 5);
3567 ibox = gtk_vbox_new(FALSE, 0);
3568 lbox = gtk_vbox_new(FALSE, 0);
3569 }
3570
3571 gtk_container_add (GTK_CONTAINER(button), bbox);
3572
3573 gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox);
3574 gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox);
3575
3576 if (iconfile) {
3577 char *filename;
3578 filename = g_build_filename (DATADIR, "pixmaps", "gaim", "buttons", iconfile, NULL);
3579 gaim_debug(GAIM_DEBUG_MISC, "gaim_pixbuf_button",
3580 "Loading: %s\n", filename);
3581 image = gtk_image_new_from_file(filename);
3582 gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, FALSE, 0);
3583 g_free(filename);
3584 }
3585
3586 if (text) {
3587 label = gtk_label_new(NULL);
3588 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text);
3589 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button);
3590 gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0);
3591 }
3592
3593 gtk_widget_show_all(bbox);
3594 return button;
3595 }