Mercurial > pidgin
comparison src/gtkutils.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 | 4b2d8d7d0118 |
comparison
equal
deleted
inserted
replaced
6371:8f94cce8faa5 | 6372:9dd4bb3cf1df |
---|---|
449 GtkSignalFunc sf, gpointer data, gboolean checked) | 449 GtkSignalFunc sf, gpointer data, gboolean checked) |
450 { | 450 { |
451 GtkWidget *menuitem; | 451 GtkWidget *menuitem; |
452 menuitem = gtk_check_menu_item_new_with_mnemonic(str); | 452 menuitem = gtk_check_menu_item_new_with_mnemonic(str); |
453 | 453 |
454 if(menu) | 454 if (menu) |
455 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | 455 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
456 | 456 |
457 if (sf) | 457 if (sf) |
458 g_signal_connect(G_OBJECT(menuitem), "activate", sf, data); | 458 g_signal_connect(G_OBJECT(menuitem), "activate", sf, data); |
459 | 459 |
461 | 461 |
462 gtk_widget_show_all(menuitem); | 462 gtk_widget_show_all(menuitem); |
463 | 463 |
464 return menuitem; | 464 return menuitem; |
465 } | 465 } |
466 | |
467 GtkWidget * | |
468 gaim_pixbuf_toolbar_button_from_stock(const char *icon) | |
469 { | |
470 GtkWidget *button, *image, *bbox; | |
471 | |
472 button = gtk_toggle_button_new(); | |
473 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
474 | |
475 bbox = gtk_vbox_new(FALSE, 0); | |
476 | |
477 gtk_container_add (GTK_CONTAINER(button), bbox); | |
478 | |
479 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU); | |
480 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
481 | |
482 gtk_widget_show_all(bbox); | |
483 | |
484 return button; | |
485 } | |
486 | |
487 GtkWidget * | |
488 gaim_pixbuf_button_from_stock(const char *text, const char *icon, | |
489 GaimButtonOrientation style) | |
490 { | |
491 GtkWidget *button, *image, *label, *bbox, *ibox, *lbox; | |
492 | |
493 button = gtk_button_new(); | |
494 | |
495 if (style == GAIM_BUTTON_HORIZONTAL) { | |
496 bbox = gtk_hbox_new(FALSE, 5); | |
497 ibox = gtk_hbox_new(FALSE, 0); | |
498 lbox = gtk_hbox_new(FALSE, 0); | |
499 } | |
500 else { | |
501 bbox = gtk_vbox_new(FALSE, 5); | |
502 ibox = gtk_vbox_new(FALSE, 0); | |
503 lbox = gtk_vbox_new(FALSE, 0); | |
504 } | |
505 | |
506 gtk_container_add (GTK_CONTAINER(button), bbox); | |
507 | |
508 gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox); | |
509 gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox); | |
510 | |
511 if (icon) { | |
512 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON); | |
513 gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, FALSE, 0); | |
514 } | |
515 | |
516 if (text) { | |
517 label = gtk_label_new(NULL); | |
518 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); | |
519 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); | |
520 gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0); | |
521 } | |
522 | |
523 gtk_widget_show_all(bbox); | |
524 | |
525 return button; | |
526 } | |
527 | |
466 | 528 |
467 GtkWidget *gaim_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod) | 529 GtkWidget *gaim_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod) |
468 { | 530 { |
469 GtkWidget *menuitem; | 531 GtkWidget *menuitem; |
470 /* | 532 /* |
924 case 1: /* short message */ | 986 case 1: /* short message */ |
925 printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name); | 987 printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name); |
926 break; | 988 break; |
927 } | 989 } |
928 } | 990 } |
929 | |
930 |