@@ -75,50 +75,43 @@ static void gui_widget_table_insert(const gchar *name, const GtkWidget *widget)
7575GtkWidget * gui_toolbar_new (toolbar_item_t * tbitems )
7676{
7777 GtkWidget * icon ;
78- GtkWidget * toolbar ;
79- GtkToolItem * item ;
80- int i ;
81-
82- toolbar = gtk_toolbar_new ();
83-
84- gtk_orientable_set_orientation (GTK_ORIENTABLE (toolbar ), GTK_ORIENTATION_HORIZONTAL );
85- gtk_toolbar_set_style (GTK_TOOLBAR (toolbar ), GTK_TOOLBAR_BOTH );
86-
87- for (i = 0 ; tbitems [i ].icon != NULL ; i ++ )
88- {
89- if (strcmp (tbitems [i ].icon ,TOOLBAR_ITEM_SEPARATOR )== 0 )
90- {
91- item = gtk_separator_tool_item_new ();
92- gtk_toolbar_insert (GTK_TOOLBAR (toolbar ), GTK_TOOL_ITEM (item ),-1 );
93-
94- }
95- else if (strcmp (tbitems [i ].icon ,TOOLBAR_ITEM_EXPANDER )== 0 )
96- {
97- item = gtk_separator_tool_item_new ();
98- gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item ),FALSE);
99- gtk_tool_item_set_expand (GTK_TOOL_ITEM (item ),TRUE);
100- gtk_toolbar_insert (GTK_TOOLBAR (toolbar ), GTK_TOOL_ITEM (item ),-1 );
101-
102- }
103- else
104- {
78+ GtkWidget * toolbar ;
79+ GtkToolItem * item ;
80+ int i ;
81+
82+ toolbar = gtk_toolbar_new ();
83+
84+ gtk_orientable_set_orientation (GTK_ORIENTABLE (toolbar ), GTK_ORIENTATION_HORIZONTAL );
85+ gtk_toolbar_set_style (GTK_TOOLBAR (toolbar ), GTK_TOOLBAR_BOTH );
86+
87+ for (i = 0 ; tbitems [i ].icon != NULL ; i ++ )
88+ {
89+ if (strcmp (tbitems [i ].icon ,TOOLBAR_ITEM_SEPARATOR )== 0 )
90+ {
91+ item = gtk_separator_tool_item_new ();
92+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar ), GTK_TOOL_ITEM (item ),-1 );
93+
94+ }
95+ else if (strcmp (tbitems [i ].icon ,TOOLBAR_ITEM_EXPANDER )== 0 )
96+ {
97+ item = gtk_separator_tool_item_new ();
98+ gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item ),FALSE);
99+ gtk_tool_item_set_expand (GTK_TOOL_ITEM (item ),TRUE);
100+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar ), GTK_TOOL_ITEM (item ),-1 );
101+
102+ }
103+ else
104+ {
105105 icon = gtk_image_new_from_icon_name (tbitems [i ].icon , GTK_ICON_SIZE_LARGE_TOOLBAR );
106- //item = gtk_tool_button_new_from_stock (tbitems[i].icon);
107106 item = gtk_tool_button_new (icon , tbitems [i ].text );
108- //if (tbitems[i].text)
109- // gtk_tool_button_set_label(GTK_TOOL_BUTTON(item),tbitems[i].text);
110- if (tbitems [i ].callback )
111- g_signal_connect (G_OBJECT (item ),"clicked" ,G_CALLBACK (tbitems [i ].callback ),(gpointer )tbitems [i ].callback_data );
112- if (tbitems [i ].tooltip )
113- gtk_widget_set_tooltip_text (GTK_WIDGET (item ),tbitems [i ].tooltip );
114- gtk_toolbar_insert (GTK_TOOLBAR (toolbar ), GTK_TOOL_ITEM (item ),-1 );
115- }
116- /*
117- if (tbitems[i].id)
118- gui_widget_table_insert(tbitems[i].id, GTK_WIDGET(item));
119- */
120- }
121- return toolbar ;
107+ if (tbitems [i ].callback )
108+ g_signal_connect (G_OBJECT (item ),"clicked" ,G_CALLBACK (tbitems [i ].callback ),(gpointer )tbitems [i ].callback_data );
109+ if (tbitems [i ].tooltip )
110+ gtk_widget_set_tooltip_text (GTK_WIDGET (item ),tbitems [i ].tooltip );
111+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar ), GTK_TOOL_ITEM (item ),-1 );
112+ }
113+ }
114+ return toolbar ;
122115}
123116
124117void gui_toolbar_run_command_cb (GtkWidget * w , gconstpointer user_data )
0 commit comments