new function ala gtk_radio_button_set_group. (gtk_radio_menu_item_init):

Sat Apr 18 22:18:12 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkradiomenuitem.h:
                * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_set_group): new function
                        ala gtk_radio_button_set_group.
                                (gtk_radio_menu_item_init): assure that we always have at least a group
                                        that points to self.

                                                * gtk/gtkradiobutton.c (gtk_radio_button_set_group): few cleanups and
                                                        added g_return_if_fail() statements.
                                                                (gtk_radio_button_init): assure that we always have at least a group
                                                                        that points to self.
This commit is contained in:
Tim Janik 1998-04-18 20:33:35 +00:00 committed by Tim Janik
parent e3b303c212
commit 57703d0170
10 changed files with 156 additions and 29 deletions

View File

@ -1,3 +1,16 @@
Sat Apr 18 22:18:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtkradiomenuitem.h:
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_set_group): new function
ala gtk_radio_button_set_group.
(gtk_radio_menu_item_init): assure that we always have at least a group
that points to self.
* gtk/gtkradiobutton.c (gtk_radio_button_set_group): few cleanups and
added g_return_if_fail() statements.
(gtk_radio_button_init): assure that we always have at least a group
that points to self.
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.

View File

@ -1,3 +1,16 @@
Sat Apr 18 22:18:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtkradiomenuitem.h:
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_set_group): new function
ala gtk_radio_button_set_group.
(gtk_radio_menu_item_init): assure that we always have at least a group
that points to self.
* gtk/gtkradiobutton.c (gtk_radio_button_set_group): few cleanups and
added g_return_if_fail() statements.
(gtk_radio_button_init): assure that we always have at least a group
that points to self.
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.

View File

@ -1,3 +1,16 @@
Sat Apr 18 22:18:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtkradiomenuitem.h:
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_set_group): new function
ala gtk_radio_button_set_group.
(gtk_radio_menu_item_init): assure that we always have at least a group
that points to self.
* gtk/gtkradiobutton.c (gtk_radio_button_set_group): few cleanups and
added g_return_if_fail() statements.
(gtk_radio_button_init): assure that we always have at least a group
that points to self.
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.

View File

@ -1,3 +1,16 @@
Sat Apr 18 22:18:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtkradiomenuitem.h:
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_set_group): new function
ala gtk_radio_button_set_group.
(gtk_radio_menu_item_init): assure that we always have at least a group
that points to self.
* gtk/gtkradiobutton.c (gtk_radio_button_set_group): few cleanups and
added g_return_if_fail() statements.
(gtk_radio_button_init): assure that we always have at least a group
that points to self.
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.

View File

@ -1,3 +1,16 @@
Sat Apr 18 22:18:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtkradiomenuitem.h:
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_set_group): new function
ala gtk_radio_button_set_group.
(gtk_radio_menu_item_init): assure that we always have at least a group
that points to self.
* gtk/gtkradiobutton.c (gtk_radio_button_set_group): few cleanups and
added g_return_if_fail() statements.
(gtk_radio_button_init): assure that we always have at least a group
that points to self.
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.

View File

@ -1,3 +1,16 @@
Sat Apr 18 22:18:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtkradiomenuitem.h:
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_set_group): new function
ala gtk_radio_button_set_group.
(gtk_radio_menu_item_init): assure that we always have at least a group
that points to self.
* gtk/gtkradiobutton.c (gtk_radio_button_set_group): few cleanups and
added g_return_if_fail() statements.
(gtk_radio_button_init): assure that we always have at least a group
that points to self.
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.

View File

@ -1,3 +1,16 @@
Sat Apr 18 22:18:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtkradiomenuitem.h:
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_set_group): new function
ala gtk_radio_button_set_group.
(gtk_radio_menu_item_init): assure that we always have at least a group
that points to self.
* gtk/gtkradiobutton.c (gtk_radio_button_set_group): few cleanups and
added g_return_if_fail() statements.
(gtk_radio_button_init): assure that we always have at least a group
that points to self.
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.

View File

@ -82,40 +82,45 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class)
static void
gtk_radio_button_init (GtkRadioButton *radio_button)
{
radio_button->group = NULL;
radio_button->group = g_slist_prepend (NULL, radio_button);
}
void
gtk_radio_button_set_group (GtkRadioButton *radio_button,
GSList *group)
{
GSList *tmp_list;
GtkRadioButton *tmp_button;
g_return_if_fail (radio_button != NULL);
g_return_if_fail (GTK_IS_RADIO_BUTTON (radio_button));
g_return_if_fail (!g_slist_find (group, radio_button));
if (radio_button->group)
{
GSList *slist;
radio_button->group = g_slist_remove (radio_button->group, radio_button);
tmp_list = radio_button->group;
while (tmp_list)
for (slist = radio_button->group; slist; slist = slist->next)
{
tmp_button = tmp_list->data;
tmp_list = tmp_list->next;
GtkRadioButton *tmp_button;
tmp_button = slist->data;
tmp_button->group = radio_button->group;
}
}
radio_button->group = g_slist_prepend (group, radio_button);
tmp_list = group;
if (tmp_list)
if (group)
{
while (tmp_list)
GSList *slist;
for (slist = group; slist; slist = slist->next)
{
tmp_button = tmp_list->data;
tmp_list = tmp_list->next;
GtkRadioButton *tmp_button;
tmp_button = slist->data;
tmp_button->group = radio_button->group;
}
}

View File

@ -55,30 +55,59 @@ GtkWidget*
gtk_radio_menu_item_new (GSList *group)
{
GtkRadioMenuItem *radio_menu_item;
GtkRadioMenuItem *tmp_menu_item;
GSList *tmp_list;
radio_menu_item = gtk_type_new (gtk_radio_menu_item_get_type ());
tmp_list = group;
radio_menu_item->group = g_slist_prepend (group, radio_menu_item);
gtk_radio_menu_item_set_group (radio_menu_item, group);
if (tmp_list)
return GTK_WIDGET (radio_menu_item);
}
void
gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item,
GSList *group)
{
g_return_if_fail (radio_menu_item != NULL);
g_return_if_fail (GTK_IS_RADIO_MENU_ITEM (radio_menu_item));
g_return_if_fail (!g_slist_find (group, radio_menu_item));
if (radio_menu_item->group)
{
while (tmp_list)
GSList *slist;
radio_menu_item->group = g_slist_remove (radio_menu_item->group, radio_menu_item);
for (slist = radio_menu_item->group; slist; slist = slist->next)
{
tmp_menu_item = tmp_list->data;
tmp_list = tmp_list->next;
tmp_menu_item->group = radio_menu_item->group;
GtkRadioMenuItem *tmp_item;
tmp_item = slist->data;
tmp_item->group = radio_menu_item->group;
}
}
radio_menu_item->group = g_slist_prepend (group, radio_menu_item);
if (group)
{
GSList *slist;
for (slist = group; slist; slist = slist->next)
{
GtkRadioMenuItem *tmp_item;
tmp_item = slist->data;
tmp_item->group = radio_menu_item->group;
}
}
else
{
GTK_CHECK_MENU_ITEM (radio_menu_item)->active = TRUE;
/* gtk_widget_set_state (GTK_WIDGET (radio_menu_item), GTK_STATE_ACTIVE);
*/
}
return GTK_WIDGET (radio_menu_item);
}
GtkWidget*
@ -125,7 +154,7 @@ gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass)
static void
gtk_radio_menu_item_init (GtkRadioMenuItem *radio_menu_item)
{
radio_menu_item->group = NULL;
radio_menu_item->group = g_slist_prepend (NULL, radio_menu_item);
}
static void

View File

@ -55,6 +55,8 @@ GtkWidget* gtk_radio_menu_item_new (GSList *group);
GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group,
const gchar *label);
GSList* gtk_radio_menu_item_group (GtkRadioMenuItem *radio_menu_item);
void gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item,
GSList *group);
#ifdef __cplusplus