mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 05:20:17 +00:00
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:
parent
e3b303c212
commit
57703d0170
13
ChangeLog
13
ChangeLog
@ -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>
|
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
||||||
|
@ -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>
|
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
||||||
|
@ -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>
|
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
||||||
|
@ -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>
|
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
||||||
|
@ -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>
|
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
||||||
|
@ -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>
|
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
||||||
|
@ -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>
|
Fri Apr 17 03:05:05 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
* ChangeLog split up into ChangeLog.pre-1-0 and ChangeLog.
|
||||||
|
@ -82,40 +82,45 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class)
|
|||||||
static void
|
static void
|
||||||
gtk_radio_button_init (GtkRadioButton *radio_button)
|
gtk_radio_button_init (GtkRadioButton *radio_button)
|
||||||
{
|
{
|
||||||
radio_button->group = NULL;
|
radio_button->group = g_slist_prepend (NULL, radio_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_radio_button_set_group (GtkRadioButton *radio_button,
|
gtk_radio_button_set_group (GtkRadioButton *radio_button,
|
||||||
GSList *group)
|
GSList *group)
|
||||||
{
|
{
|
||||||
GSList *tmp_list;
|
g_return_if_fail (radio_button != NULL);
|
||||||
GtkRadioButton *tmp_button;
|
g_return_if_fail (GTK_IS_RADIO_BUTTON (radio_button));
|
||||||
|
g_return_if_fail (!g_slist_find (group, radio_button));
|
||||||
|
|
||||||
if (radio_button->group)
|
if (radio_button->group)
|
||||||
{
|
{
|
||||||
|
GSList *slist;
|
||||||
|
|
||||||
radio_button->group = g_slist_remove (radio_button->group, radio_button);
|
radio_button->group = g_slist_remove (radio_button->group, radio_button);
|
||||||
|
|
||||||
tmp_list = radio_button->group;
|
for (slist = radio_button->group; slist; slist = slist->next)
|
||||||
while (tmp_list)
|
|
||||||
{
|
{
|
||||||
tmp_button = tmp_list->data;
|
GtkRadioButton *tmp_button;
|
||||||
tmp_list = tmp_list->next;
|
|
||||||
|
tmp_button = slist->data;
|
||||||
|
|
||||||
tmp_button->group = radio_button->group;
|
tmp_button->group = radio_button->group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
radio_button->group = g_slist_prepend (group, radio_button);
|
radio_button->group = g_slist_prepend (group, radio_button);
|
||||||
tmp_list = group;
|
|
||||||
|
if (group)
|
||||||
if (tmp_list)
|
|
||||||
{
|
{
|
||||||
while (tmp_list)
|
GSList *slist;
|
||||||
|
|
||||||
|
for (slist = group; slist; slist = slist->next)
|
||||||
{
|
{
|
||||||
tmp_button = tmp_list->data;
|
GtkRadioButton *tmp_button;
|
||||||
tmp_list = tmp_list->next;
|
|
||||||
|
tmp_button = slist->data;
|
||||||
|
|
||||||
tmp_button->group = radio_button->group;
|
tmp_button->group = radio_button->group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,30 +55,59 @@ GtkWidget*
|
|||||||
gtk_radio_menu_item_new (GSList *group)
|
gtk_radio_menu_item_new (GSList *group)
|
||||||
{
|
{
|
||||||
GtkRadioMenuItem *radio_menu_item;
|
GtkRadioMenuItem *radio_menu_item;
|
||||||
GtkRadioMenuItem *tmp_menu_item;
|
|
||||||
GSList *tmp_list;
|
|
||||||
|
|
||||||
radio_menu_item = gtk_type_new (gtk_radio_menu_item_get_type ());
|
radio_menu_item = gtk_type_new (gtk_radio_menu_item_get_type ());
|
||||||
|
|
||||||
tmp_list = group;
|
gtk_radio_menu_item_set_group (radio_menu_item, group);
|
||||||
radio_menu_item->group = g_slist_prepend (group, radio_menu_item);
|
|
||||||
|
|
||||||
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;
|
GtkRadioMenuItem *tmp_item;
|
||||||
tmp_list = tmp_list->next;
|
|
||||||
|
tmp_item = slist->data;
|
||||||
tmp_menu_item->group = radio_menu_item->group;
|
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
GTK_CHECK_MENU_ITEM (radio_menu_item)->active = TRUE;
|
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*
|
GtkWidget*
|
||||||
@ -125,7 +154,7 @@ gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass)
|
|||||||
static void
|
static void
|
||||||
gtk_radio_menu_item_init (GtkRadioMenuItem *radio_menu_item)
|
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
|
static void
|
||||||
|
@ -55,6 +55,8 @@ GtkWidget* gtk_radio_menu_item_new (GSList *group);
|
|||||||
GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group,
|
GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group,
|
||||||
const gchar *label);
|
const gchar *label);
|
||||||
GSList* gtk_radio_menu_item_group (GtkRadioMenuItem *radio_menu_item);
|
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
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user