I created a new Item with gtk_tool_button_new()
for GtkToolbar and after I set everything done I noticed that the “use-underline” property does not work.
Neither with g_object_set()
nor with gtk_tool_button_set_use_underline()
Here is an example Code:
#include <gtk/gtk.h>
void call_callback ( GtkToolButton *toolButton );
int main ( void )
{
GtkWidget *window;
GtkWidget *box;
GtkWidget *toolBar;
GtkToolItem *toolItem;
/// ***
gtk_init ( NULL, NULL );
/// *** Create a Window
window = gtk_window_new ( GTK_WINDOW_TOPLEVEL );
gtk_window_set_default_size ( GTK_WINDOW ( window ), 200, 200 );
g_signal_connect ( window, "delete-event", gtk_main_quit, NULL );
g_signal_connect ( window, "destroy", gtk_main_quit, NULL );
/// *** Create a Box
box = gtk_box_new ( GTK_ORIENTATION_VERTICAL, 5 );
gtk_container_add ( GTK_CONTAINER ( window ), box );
/// *** Create a ToolBar
toolBar = gtk_toolbar_new();
gtk_widget_set_name ( GTK_WIDGET ( toolBar ), "CallItem" );
gtk_toolbar_set_style ( GTK_TOOLBAR ( toolBar ), GTK_TOOLBAR_BOTH );
/// *** Create a ToolButton
toolItem = gtk_tool_button_new ( gtk_image_new_from_icon_name ( "call-start", GTK_ICON_SIZE_SMALL_TOOLBAR ), "_Call" );
gtk_widget_set_tooltip_text ( GTK_WIDGET ( toolItem ), "Make a Call" );
gtk_toolbar_insert ( GTK_TOOLBAR ( toolBar ), toolItem, 0 );
/// *** Monitor the CLICKED signal
g_signal_connect_swapped ( toolItem, "clicked", G_CALLBACK ( call_callback ), toolItem );
/// *** Add it to the Box
gtk_box_pack_start ( GTK_BOX ( box ), toolBar, 0, 0, 0 );
gtk_widget_set_halign ( toolBar, GTK_ALIGN_CENTER );
gtk_orientable_set_orientation ( GTK_ORIENTABLE ( toolBar ), GTK_ORIENTATION_HORIZONTAL );
/// *** Set use underline to TRUE
///gtk_tool_button_set_use_underline ( GTK_TOOL_BUTTON ( toolItem ), TRUE );
g_object_set( toolItem, "use-underline", TRUE, NULL );
/// ***
gtk_widget_show_all ( window );
gtk_main ();
}
void call_callback ( GtkToolButton *toolButton )
{
g_return_if_fail ( GTK_IS_TOOL_BUTTON ( toolButton ) );
g_print ( "The Call button was Clicked\n" );
}
Do I need to set it somehow different for the mnemonic accelerator key?