|
Packit Service |
fb6fa5 |
/* testbuttons.c
|
|
Packit Service |
fb6fa5 |
* Copyright (C) 2009 Red Hat, Inc.
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
fb6fa5 |
* modify it under the terms of the GNU Library General Public
|
|
Packit Service |
fb6fa5 |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
fb6fa5 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
fb6fa5 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
fb6fa5 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
fb6fa5 |
* Library General Public License for more details.
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* You should have received a copy of the GNU Library General Public
|
|
Packit Service |
fb6fa5 |
* License along with this library; if not, write to the
|
|
Packit Service |
fb6fa5 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Packit Service |
fb6fa5 |
* Boston, MA 02111-1307, USA.
|
|
Packit Service |
fb6fa5 |
*/
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
#include <gtk/gtk.h>
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
/* various combinations of use_underline and use_stock */
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
int main (int argc, char *argv[])
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
GtkWidget *window, *box, *button, *hbox;
|
|
Packit Service |
fb6fa5 |
gchar *text;
|
|
Packit Service |
fb6fa5 |
gboolean use_underline, use_stock;
|
|
Packit Service |
fb6fa5 |
GtkWidget *image, *label;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_init (&argc, &argv);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
box = gtk_vbox_new (0, FALSE);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (window), box);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
hbox = gtk_hbox_new (0, FALSE);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (box), hbox);
|
|
Packit Service |
fb6fa5 |
button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_object_get (button,
|
|
Packit Service |
fb6fa5 |
"label", &text,
|
|
Packit Service |
fb6fa5 |
"use-stock", &use_stock,
|
|
Packit Service |
fb6fa5 |
"use-underline", &use_underline,
|
|
Packit Service |
fb6fa5 |
"image", &image,
|
|
Packit Service |
fb6fa5 |
NULL);
|
|
Packit Service |
fb6fa5 |
text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
|
|
Packit Service |
fb6fa5 |
label = gtk_label_new (text);
|
|
Packit Service |
fb6fa5 |
g_free (text);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
hbox = gtk_hbox_new (0, FALSE);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (box), hbox);
|
|
Packit Service |
fb6fa5 |
button = g_object_new (GTK_TYPE_BUTTON,
|
|
Packit Service |
fb6fa5 |
"label", "gtk-save",
|
|
Packit Service |
fb6fa5 |
"use-stock", TRUE,
|
|
Packit Service |
fb6fa5 |
NULL);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_object_get (button,
|
|
Packit Service |
fb6fa5 |
"label", &text,
|
|
Packit Service |
fb6fa5 |
"use-stock", &use_stock,
|
|
Packit Service |
fb6fa5 |
"use-underline", &use_underline,
|
|
Packit Service |
fb6fa5 |
"image", &image,
|
|
Packit Service |
fb6fa5 |
NULL);
|
|
Packit Service |
fb6fa5 |
text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
|
|
Packit Service |
fb6fa5 |
label = gtk_label_new (text);
|
|
Packit Service |
fb6fa5 |
g_free (text);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
hbox = gtk_hbox_new (0, FALSE);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (box), hbox);
|
|
Packit Service |
fb6fa5 |
button = gtk_button_new_with_label ("_Save");
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_object_get (button,
|
|
Packit Service |
fb6fa5 |
"label", &text,
|
|
Packit Service |
fb6fa5 |
"use-stock", &use_stock,
|
|
Packit Service |
fb6fa5 |
"use-underline", &use_underline,
|
|
Packit Service |
fb6fa5 |
"image", &image,
|
|
Packit Service |
fb6fa5 |
NULL);
|
|
Packit Service |
fb6fa5 |
text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
|
|
Packit Service |
fb6fa5 |
label = gtk_label_new (text);
|
|
Packit Service |
fb6fa5 |
g_free (text);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
hbox = gtk_hbox_new (0, FALSE);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (box), hbox);
|
|
Packit Service |
fb6fa5 |
button = gtk_button_new_with_mnemonic ("_Save");
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_object_get (button,
|
|
Packit Service |
fb6fa5 |
"label", &text,
|
|
Packit Service |
fb6fa5 |
"use-stock", &use_stock,
|
|
Packit Service |
fb6fa5 |
"use-underline", &use_underline,
|
|
Packit Service |
fb6fa5 |
"image", &image,
|
|
Packit Service |
fb6fa5 |
NULL);
|
|
Packit Service |
fb6fa5 |
text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
|
|
Packit Service |
fb6fa5 |
label = gtk_label_new (text);
|
|
Packit Service |
fb6fa5 |
g_free (text);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
hbox = gtk_hbox_new (0, FALSE);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (box), hbox);
|
|
Packit Service |
fb6fa5 |
button = gtk_button_new_with_label ("_Save");
|
|
Packit Service |
fb6fa5 |
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON));
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_object_get (button,
|
|
Packit Service |
fb6fa5 |
"label", &text,
|
|
Packit Service |
fb6fa5 |
"use-stock", &use_stock,
|
|
Packit Service |
fb6fa5 |
"use-underline", &use_underline,
|
|
Packit Service |
fb6fa5 |
"image", &image,
|
|
Packit Service |
fb6fa5 |
NULL);
|
|
Packit Service |
fb6fa5 |
text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
|
|
Packit Service |
fb6fa5 |
label = gtk_label_new (text);
|
|
Packit Service |
fb6fa5 |
g_free (text);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
hbox = gtk_hbox_new (0, FALSE);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (box), hbox);
|
|
Packit Service |
fb6fa5 |
button = gtk_button_new_with_mnemonic ("_Save");
|
|
Packit Service |
fb6fa5 |
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON));
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
Packit Service |
fb6fa5 |
g_object_get (button,
|
|
Packit Service |
fb6fa5 |
"label", &text,
|
|
Packit Service |
fb6fa5 |
"use-stock", &use_stock,
|
|
Packit Service |
fb6fa5 |
"use-underline", &use_underline,
|
|
Packit Service |
fb6fa5 |
"image", &image,
|
|
Packit Service |
fb6fa5 |
NULL);
|
|
Packit Service |
fb6fa5 |
text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
|
|
Packit Service |
fb6fa5 |
label = gtk_label_new (text);
|
|
Packit Service |
fb6fa5 |
g_free (text);
|
|
Packit Service |
fb6fa5 |
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_widget_show_all (window);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_main ();
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
return 0;
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|