Mercurial > pidgin.yaz
diff 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 |
line wrap: on
line diff
--- a/src/gtkutils.c Tue Aug 05 10:55:04 2003 +0000 +++ b/src/gtkutils.c Tue Aug 05 11:08:40 2003 +0000 @@ -451,7 +451,7 @@ GtkWidget *menuitem; menuitem = gtk_check_menu_item_new_with_mnemonic(str); - if(menu) + if (menu) gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); if (sf) @@ -464,6 +464,68 @@ return menuitem; } +GtkWidget * +gaim_pixbuf_toolbar_button_from_stock(const char *icon) +{ + GtkWidget *button, *image, *bbox; + + button = gtk_toggle_button_new(); + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + + bbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add (GTK_CONTAINER(button), bbox); + + image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU); + gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); + + gtk_widget_show_all(bbox); + + return button; +} + +GtkWidget * +gaim_pixbuf_button_from_stock(const char *text, const char *icon, + GaimButtonOrientation style) +{ + GtkWidget *button, *image, *label, *bbox, *ibox, *lbox; + + button = gtk_button_new(); + + if (style == GAIM_BUTTON_HORIZONTAL) { + bbox = gtk_hbox_new(FALSE, 5); + ibox = gtk_hbox_new(FALSE, 0); + lbox = gtk_hbox_new(FALSE, 0); + } + else { + bbox = gtk_vbox_new(FALSE, 5); + ibox = gtk_vbox_new(FALSE, 0); + lbox = gtk_vbox_new(FALSE, 0); + } + + gtk_container_add (GTK_CONTAINER(button), bbox); + + gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox); + gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox); + + if (icon) { + image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON); + gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, FALSE, 0); + } + + if (text) { + label = gtk_label_new(NULL); + gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); + gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0); + } + + gtk_widget_show_all(bbox); + + return button; +} + + 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) { GtkWidget *menuitem; @@ -926,5 +988,3 @@ break; } } - -