2009-07-01 19:04:31 +00:00
|
|
|
/* testbuttons.c
|
|
|
|
* Copyright (C) 2009 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2009-07-01 19:04:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2016-10-02 18:10:22 +00:00
|
|
|
/* various combinations of use_underline */
|
2009-07-01 19:04:31 +00:00
|
|
|
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
GtkWidget *window, *box, *button, *hbox;
|
|
|
|
gchar *text;
|
2016-10-14 14:01:56 +00:00
|
|
|
const char *icon_name;
|
2016-10-02 18:10:22 +00:00
|
|
|
gboolean use_underline;
|
2016-10-14 14:01:56 +00:00
|
|
|
GtkWidget *label;
|
2009-07-01 19:04:31 +00:00
|
|
|
|
2016-12-28 13:53:22 +00:00
|
|
|
gtk_init ();
|
2009-07-01 19:04:31 +00:00
|
|
|
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
2009-07-01 19:04:31 +00:00
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), box);
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2009-07-01 19:04:31 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (box), hbox);
|
|
|
|
button = g_object_new (GTK_TYPE_BUTTON,
|
2010-08-21 01:08:15 +00:00
|
|
|
"label", "document-save",
|
2009-07-01 19:04:31 +00:00
|
|
|
NULL);
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
|
|
|
|
|
|
g_object_get (button,
|
|
|
|
"label", &text,
|
|
|
|
"use-underline", &use_underline,
|
2016-10-14 14:01:56 +00:00
|
|
|
"icon-name", &icon_name,
|
2009-07-01 19:04:31 +00:00
|
|
|
NULL);
|
2016-10-14 14:01:56 +00:00
|
|
|
text = g_strdup_printf ("label: \"%s\" icon-name: \"%s\" use-underline: %s\n", text, icon_name, use_underline ? "TRUE" : "FALSE");
|
2009-07-01 19:04:31 +00:00
|
|
|
label = gtk_label_new (text);
|
|
|
|
g_free (text);
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2009-07-01 19:04:31 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (box), hbox);
|
|
|
|
button = gtk_button_new_with_label ("_Save");
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
|
|
|
|
|
|
g_object_get (button,
|
|
|
|
"label", &text,
|
|
|
|
"use-underline", &use_underline,
|
2016-10-14 14:01:56 +00:00
|
|
|
"icon-name", &icon_name,
|
2009-07-01 19:04:31 +00:00
|
|
|
NULL);
|
2016-10-14 14:01:56 +00:00
|
|
|
text = g_strdup_printf ("label: \"%s\" icon-name: \"%s\" use-underline: %s\n", text, icon_name, use_underline ? "TRUE" : "FALSE");
|
2009-07-01 19:04:31 +00:00
|
|
|
label = gtk_label_new (text);
|
|
|
|
g_free (text);
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2009-07-01 19:04:31 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (box), hbox);
|
|
|
|
button = gtk_button_new_with_mnemonic ("_Save");
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
|
|
|
|
|
|
g_object_get (button,
|
|
|
|
"label", &text,
|
|
|
|
"use-underline", &use_underline,
|
2016-10-14 14:01:56 +00:00
|
|
|
"icon-name", &icon_name,
|
2009-07-01 19:04:31 +00:00
|
|
|
NULL);
|
2016-10-14 14:01:56 +00:00
|
|
|
text = g_strdup_printf ("label: \"%s\" icon-name: \"%s\" use-underline: %s\n", text, icon_name, use_underline ? "TRUE" : "FALSE");
|
2009-07-01 19:04:31 +00:00
|
|
|
label = gtk_label_new (text);
|
|
|
|
g_free (text);
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2009-07-01 19:04:31 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (box), hbox);
|
2017-01-20 07:02:48 +00:00
|
|
|
button = gtk_button_new_from_icon_name ("help-about");
|
2009-07-01 19:04:31 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
|
|
|
|
|
|
g_object_get (button,
|
|
|
|
"label", &text,
|
|
|
|
"use-underline", &use_underline,
|
2016-10-14 14:01:56 +00:00
|
|
|
"icon-name", &icon_name,
|
2009-07-01 19:04:31 +00:00
|
|
|
NULL);
|
2016-10-14 14:01:56 +00:00
|
|
|
text = g_strdup_printf ("label: \"%s\" icon-name: \"%s\" use-underline: %s\n", text, icon_name, use_underline ? "TRUE" : "FALSE");
|
2009-07-01 19:04:31 +00:00
|
|
|
label = gtk_label_new (text);
|
|
|
|
g_free (text);
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2009-07-01 19:04:31 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (box), hbox);
|
2016-10-14 14:01:56 +00:00
|
|
|
button = gtk_button_new ();
|
|
|
|
gtk_button_set_icon_name (GTK_BUTTON (button), "help-about");
|
|
|
|
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
|
2009-07-01 19:04:31 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
|
|
|
g_object_get (button,
|
|
|
|
"label", &text,
|
|
|
|
"use-underline", &use_underline,
|
2016-10-14 14:01:56 +00:00
|
|
|
"icon-name", &icon_name,
|
2009-07-01 19:04:31 +00:00
|
|
|
NULL);
|
2016-10-14 14:01:56 +00:00
|
|
|
text = g_strdup_printf ("label: \"%s\" icon-name: \"%s\" use-underline: %s\n", text, icon_name, use_underline ? "TRUE" : "FALSE");
|
2009-07-01 19:04:31 +00:00
|
|
|
label = gtk_label_new (text);
|
|
|
|
g_free (text);
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), label);
|
|
|
|
|
2017-01-19 09:02:04 +00:00
|
|
|
gtk_widget_show (window);
|
2009-07-01 19:04:31 +00:00
|
|
|
|
2020-02-10 03:24:47 +00:00
|
|
|
while (TRUE)
|
|
|
|
g_main_context_iteration (NULL, TRUE);
|
2009-07-01 19:04:31 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|