+/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
+
+
+gint hbtk_radio_button_get_active (GtkContainer *container)
+{
+GList *lchild, *list;
+GtkWidget *radio;
+gint i, retval = 0;
+
+ if(!GTK_IS_CONTAINER(container))
+ return -1;
+
+ lchild = list = gtk_container_get_children (container);
+ for(i=0;list != NULL;i++)
+ {
+ radio = list->data;
+ if(GTK_IS_TOGGLE_BUTTON(radio))
+ {
+ if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)) == TRUE )
+ {
+ retval = i;
+ break;
+ }
+ }
+ list = g_list_next(list);
+ }
+ g_list_free(lchild);
+
+ return retval;
+}
+
+
+void hbtk_radio_button_set_active (GtkContainer *container, gint active)
+{
+GList *lchild, *list;
+GtkWidget *radio;
+
+ if(!GTK_IS_CONTAINER(container))
+ return;
+
+ lchild = list = gtk_container_get_children (container);
+ radio = g_list_nth_data (list, active);
+ if(radio != NULL && GTK_IS_TOGGLE_BUTTON(radio))
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radio), TRUE);
+ }
+ g_list_free(lchild);
+}
+
+
+GtkWidget *hbtk_radio_button_get_nth (GtkContainer *container, gint nth)
+{
+GList *lchild, *list;
+GtkWidget *radio;
+
+ if(!GTK_IS_CONTAINER(container))
+ return NULL;
+
+ lchild = list = gtk_container_get_children (container);
+ radio = g_list_nth_data (list, nth);
+ g_list_free(lchild);
+ return radio; //may return NULL
+}
+
+
+void hbtk_radio_button_unblock_by_func(GtkContainer *container, GCallback c_handler, gpointer data)
+{
+GList *lchild, *list;
+GtkWidget *radio;
+gint i;
+
+ if(!GTK_IS_CONTAINER(container))
+ return;
+
+ lchild = list = gtk_container_get_children (container);
+ for(i=0;list != NULL;i++)
+ {
+ radio = list->data;
+ if(GTK_IS_TOGGLE_BUTTON(radio))
+ {
+ g_signal_handlers_unblock_by_func (radio, c_handler, data);
+ }
+ list = g_list_next(list);
+ }
+ g_list_free(lchild);
+}
+
+
+void hbtk_radio_button_block_by_func(GtkContainer *container, GCallback c_handler, gpointer data)
+{
+GList *lchild, *list;
+GtkWidget *radio;
+gint i;
+
+ if(!GTK_IS_CONTAINER(container))
+ return;
+
+ lchild = list = gtk_container_get_children (container);
+ for(i=0;list != NULL;i++)
+ {
+ radio = list->data;
+ if(GTK_IS_TOGGLE_BUTTON(radio))
+ {
+ g_signal_handlers_block_by_func (radio, c_handler, data);
+ }
+ list = g_list_next(list);
+ }
+ g_list_free(lchild);
+}
+
+
+void hbtk_radio_button_connect(GtkContainer *container, const gchar *detailed_signal, GCallback c_handler, gpointer data)
+{
+GList *lchild, *list;
+GtkWidget *radio;
+gint i;
+
+ if(!GTK_IS_CONTAINER(container))
+ return;
+
+ lchild = list = gtk_container_get_children (container);
+ for(i=0;list != NULL;i++)
+ {
+ radio = list->data;
+ if(GTK_IS_TOGGLE_BUTTON(radio))
+ {
+ g_signal_connect (radio, "toggled", c_handler, data);
+ }
+ list = g_list_next(list);
+ }
+ g_list_free(lchild);
+
+}
+
+
+GtkWidget *hbtk_radio_button_new (gchar **items, gboolean buttonstyle)
+{
+GtkWidget *box, *button, *newbutton;
+guint i;
+
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+
+ button = gtk_radio_button_new_with_label (NULL, _(items[0]));
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), !buttonstyle);
+ gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
+ for (i = 1; items[i] != NULL; i++)
+ {
+ newbutton = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), _(items[i]));
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (newbutton), !buttonstyle);
+ gtk_box_pack_start (GTK_BOX (box), newbutton, FALSE, FALSE, 0);
+ }
+
+ if(buttonstyle)
+ {
+ gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED);
+ gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED);
+ }
+
+ return box;
+}
+
+
+/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
+
+