mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-25 02:36:07 +00:00
Have only one constructor and feed it whether the radio button group is
* libnautilus-extensions/nautilus-radio-button-group.c: (nautilus_radio_button_group_initialize), (nautilus_radio_button_group_new), (nautilus_radio_button_group_set_entry_pixbuf), (nautilus_radio_button_group_set_entry_description_text): * libnautilus-extensions/nautilus-radio-button-group.h: Have only one constructor and feed it whether the radio button group is horizontal or not. Changed the login of some assertions on code that is meant for the NOT horzontal case. This should fix the torrent of assertions at startup. * libnautilus-extensions/nautilus-preferences-item.c: (preferences_item_create_enum), (preferences_item_create_short_enum): Update for radio button group constructor change. * src/nautilus-first-time-druid.c: (set_up_user_level_page), (set_up_service_signup_page): Update for radio button group constructor change. * test/test-nautilus-widgets.c: (main), (radio_group_load_it_up), (test_radio_group), (test_radio_group_horizontal): Add a test for the radio button group horizontal case.
This commit is contained in:
parent
fd1bde5e38
commit
25ed636716
32
ChangeLog
32
ChangeLog
|
@ -1,3 +1,35 @@
|
|||
2000-08-02 Ramiro Estrugo <ramiro@eazel.com>
|
||||
|
||||
* libnautilus-extensions/nautilus-radio-button-group.c:
|
||||
(nautilus_radio_button_group_initialize),
|
||||
(nautilus_radio_button_group_new),
|
||||
(nautilus_radio_button_group_set_entry_pixbuf),
|
||||
(nautilus_radio_button_group_set_entry_description_text):
|
||||
* libnautilus-extensions/nautilus-radio-button-group.h:
|
||||
|
||||
Have only one constructor and feed it whether the radio button
|
||||
group is horizontal or not.
|
||||
|
||||
Changed the login of some assertions on code that is meant for the
|
||||
NOT horzontal case. This should fix the torrent of assertions at
|
||||
startup.
|
||||
|
||||
* libnautilus-extensions/nautilus-preferences-item.c:
|
||||
(preferences_item_create_enum),
|
||||
(preferences_item_create_short_enum):
|
||||
|
||||
Update for radio button group constructor change.
|
||||
|
||||
* src/nautilus-first-time-druid.c: (set_up_user_level_page),
|
||||
(set_up_service_signup_page):
|
||||
|
||||
Update for radio button group constructor change.
|
||||
|
||||
* test/test-nautilus-widgets.c: (main), (radio_group_load_it_up),
|
||||
(test_radio_group), (test_radio_group_horizontal):
|
||||
|
||||
Add a test for the radio button group horizontal case.
|
||||
|
||||
2000-08-02 Pavel Cisler <pavel@eazel.com>
|
||||
|
||||
* src/file-manager/fm-desktop-icon-view.c:
|
||||
|
|
|
@ -316,7 +316,7 @@ preferences_item_create_enum (NautilusPreferencesItem *item,
|
|||
|
||||
g_assert (item->details->preference_name != NULL);
|
||||
|
||||
item->details->child = nautilus_radio_button_group_new ();
|
||||
item->details->child = nautilus_radio_button_group_new (FALSE);
|
||||
|
||||
value = nautilus_preferences_get_enum (item->details->preference_name, 0);
|
||||
|
||||
|
@ -360,7 +360,7 @@ preferences_item_create_short_enum (NautilusPreferencesItem *item,
|
|||
|
||||
g_assert (item->details->preference_name != NULL);
|
||||
|
||||
item->details->child = nautilus_radio_button_group_new_horizontal ();
|
||||
item->details->child = nautilus_radio_button_group_new (TRUE);
|
||||
|
||||
value = nautilus_preferences_get_enum (item->details->preference_name, 0);
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ nautilus_radio_button_group_initialize (NautilusRadioButtonGroup *button_group)
|
|||
button_group->details->rows = NULL;
|
||||
button_group->details->group = NULL;
|
||||
button_group->details->num_items = 0;
|
||||
button_group->details->horizontal = 0;
|
||||
button_group->details->horizontal = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -197,22 +197,12 @@ button_toggled (GtkWidget *button, gpointer user_data)
|
|||
* NautilusRadioButtonGroup public methods
|
||||
*/
|
||||
GtkWidget*
|
||||
nautilus_radio_button_group_new (void)
|
||||
nautilus_radio_button_group_new (gboolean is_horizontal)
|
||||
{
|
||||
NautilusRadioButtonGroup *button_group;
|
||||
|
||||
button_group = gtk_type_new (nautilus_radio_button_group_get_type ());
|
||||
|
||||
return GTK_WIDGET (button_group);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
nautilus_radio_button_group_new_horizontal (void)
|
||||
{
|
||||
NautilusRadioButtonGroup *button_group;
|
||||
|
||||
button_group = gtk_type_new (nautilus_radio_button_group_get_type ());
|
||||
button_group->details->horizontal = TRUE;
|
||||
button_group->details->horizontal = is_horizontal;
|
||||
|
||||
return GTK_WIDGET (button_group);
|
||||
}
|
||||
|
@ -366,7 +356,7 @@ nautilus_radio_button_group_set_entry_pixbuf (NautilusRadioButtonGroup *button_g
|
|||
g_return_if_fail (button_group != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_RADIO_BUTTON_GROUP (button_group));
|
||||
g_return_if_fail (entry_index < g_list_length (button_group->details->rows));
|
||||
g_return_if_fail (button_group->details->horizontal);
|
||||
g_return_if_fail (button_group->details->horizontal == FALSE);
|
||||
|
||||
table = GTK_TABLE (button_group);
|
||||
|
||||
|
@ -407,7 +397,7 @@ nautilus_radio_button_group_set_entry_description_text (NautilusRadioButtonGroup
|
|||
g_return_if_fail (button_group != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_RADIO_BUTTON_GROUP (button_group));
|
||||
g_return_if_fail (entry_index < g_list_length (button_group->details->rows));
|
||||
g_return_if_fail (button_group->details->horizontal);
|
||||
g_return_if_fail (button_group->details->horizontal == FALSE);
|
||||
|
||||
table = GTK_TABLE (button_group);
|
||||
|
||||
|
|
|
@ -71,9 +71,7 @@ typedef struct
|
|||
} NautilusRadioButtonGroupSignalData;
|
||||
|
||||
GtkType nautilus_radio_button_group_get_type (void);
|
||||
GtkWidget* nautilus_radio_button_group_new (void);
|
||||
GtkWidget* nautilus_radio_button_group_new_horizontal (void);
|
||||
|
||||
GtkWidget* nautilus_radio_button_group_new (gboolean is_horizontal);
|
||||
|
||||
|
||||
/* Insert a new item to the group. Returns the new item's index */
|
||||
|
|
|
@ -316,7 +316,7 @@ preferences_item_create_enum (NautilusPreferencesItem *item,
|
|||
|
||||
g_assert (item->details->preference_name != NULL);
|
||||
|
||||
item->details->child = nautilus_radio_button_group_new ();
|
||||
item->details->child = nautilus_radio_button_group_new (FALSE);
|
||||
|
||||
value = nautilus_preferences_get_enum (item->details->preference_name, 0);
|
||||
|
||||
|
@ -360,7 +360,7 @@ preferences_item_create_short_enum (NautilusPreferencesItem *item,
|
|||
|
||||
g_assert (item->details->preference_name != NULL);
|
||||
|
||||
item->details->child = nautilus_radio_button_group_new_horizontal ();
|
||||
item->details->child = nautilus_radio_button_group_new (TRUE);
|
||||
|
||||
value = nautilus_preferences_get_enum (item->details->preference_name, 0);
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ nautilus_radio_button_group_initialize (NautilusRadioButtonGroup *button_group)
|
|||
button_group->details->rows = NULL;
|
||||
button_group->details->group = NULL;
|
||||
button_group->details->num_items = 0;
|
||||
button_group->details->horizontal = 0;
|
||||
button_group->details->horizontal = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -197,22 +197,12 @@ button_toggled (GtkWidget *button, gpointer user_data)
|
|||
* NautilusRadioButtonGroup public methods
|
||||
*/
|
||||
GtkWidget*
|
||||
nautilus_radio_button_group_new (void)
|
||||
nautilus_radio_button_group_new (gboolean is_horizontal)
|
||||
{
|
||||
NautilusRadioButtonGroup *button_group;
|
||||
|
||||
button_group = gtk_type_new (nautilus_radio_button_group_get_type ());
|
||||
|
||||
return GTK_WIDGET (button_group);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
nautilus_radio_button_group_new_horizontal (void)
|
||||
{
|
||||
NautilusRadioButtonGroup *button_group;
|
||||
|
||||
button_group = gtk_type_new (nautilus_radio_button_group_get_type ());
|
||||
button_group->details->horizontal = TRUE;
|
||||
button_group->details->horizontal = is_horizontal;
|
||||
|
||||
return GTK_WIDGET (button_group);
|
||||
}
|
||||
|
@ -366,7 +356,7 @@ nautilus_radio_button_group_set_entry_pixbuf (NautilusRadioButtonGroup *button_g
|
|||
g_return_if_fail (button_group != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_RADIO_BUTTON_GROUP (button_group));
|
||||
g_return_if_fail (entry_index < g_list_length (button_group->details->rows));
|
||||
g_return_if_fail (button_group->details->horizontal);
|
||||
g_return_if_fail (button_group->details->horizontal == FALSE);
|
||||
|
||||
table = GTK_TABLE (button_group);
|
||||
|
||||
|
@ -407,7 +397,7 @@ nautilus_radio_button_group_set_entry_description_text (NautilusRadioButtonGroup
|
|||
g_return_if_fail (button_group != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_RADIO_BUTTON_GROUP (button_group));
|
||||
g_return_if_fail (entry_index < g_list_length (button_group->details->rows));
|
||||
g_return_if_fail (button_group->details->horizontal);
|
||||
g_return_if_fail (button_group->details->horizontal == FALSE);
|
||||
|
||||
table = GTK_TABLE (button_group);
|
||||
|
||||
|
|
|
@ -71,9 +71,7 @@ typedef struct
|
|||
} NautilusRadioButtonGroupSignalData;
|
||||
|
||||
GtkType nautilus_radio_button_group_get_type (void);
|
||||
GtkWidget* nautilus_radio_button_group_new (void);
|
||||
GtkWidget* nautilus_radio_button_group_new_horizontal (void);
|
||||
|
||||
GtkWidget* nautilus_radio_button_group_new (gboolean is_horizontal);
|
||||
|
||||
|
||||
/* Insert a new item to the group. Returns the new item's index */
|
||||
|
|
|
@ -168,7 +168,7 @@ set_up_user_level_page (NautilusDruidPageStandard *page)
|
|||
gtk_widget_show (frame);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 8);
|
||||
|
||||
radio_buttons = nautilus_radio_button_group_new ();
|
||||
radio_buttons = nautilus_radio_button_group_new (FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (frame),
|
||||
radio_buttons);
|
||||
|
||||
|
@ -231,7 +231,7 @@ set_up_service_signup_page (NautilusDruidPageStandard *page)
|
|||
gtk_widget_show (frame);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 8);
|
||||
|
||||
radio_buttons = nautilus_radio_button_group_new ();
|
||||
radio_buttons = nautilus_radio_button_group_new (FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (frame),
|
||||
radio_buttons);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ create_pixbuf (const char *name)
|
|||
}
|
||||
|
||||
static void test_radio_group (void);
|
||||
static void test_radio_group_horizontal (void);
|
||||
static void test_caption_table (void);
|
||||
static void test_string_picker (void);
|
||||
static void test_text_caption (void);
|
||||
|
@ -48,6 +49,7 @@ main (int argc, char * argv[])
|
|||
gnome_init ("foo", "bar", argc, argv);
|
||||
|
||||
test_radio_group ();
|
||||
test_radio_group_horizontal ();
|
||||
test_caption_table ();
|
||||
test_string_picker ();
|
||||
test_text_caption ();
|
||||
|
@ -57,37 +59,77 @@ main (int argc, char * argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
radio_group_load_it_up (NautilusRadioButtonGroup *group,
|
||||
gboolean use_icons,
|
||||
gboolean use_descriptions)
|
||||
{
|
||||
g_return_if_fail (group != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_RADIO_BUTTON_GROUP (group));
|
||||
|
||||
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (group), "Apples");
|
||||
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (group), "Oranges");
|
||||
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (group), "Strawberries");
|
||||
|
||||
if (use_descriptions)
|
||||
{
|
||||
nautilus_radio_button_group_set_entry_description_text (NAUTILUS_RADIO_BUTTON_GROUP (group), 0, _("Apple description"));
|
||||
nautilus_radio_button_group_set_entry_description_text (NAUTILUS_RADIO_BUTTON_GROUP (group), 1, _("Oranges description"));
|
||||
nautilus_radio_button_group_set_entry_description_text (NAUTILUS_RADIO_BUTTON_GROUP (group), 2, _("Strawberries description"));
|
||||
}
|
||||
|
||||
if (use_icons)
|
||||
{
|
||||
GdkPixbuf *pixbufs[3];
|
||||
|
||||
pixbufs[0] = create_pixbuf ("novice.png");
|
||||
pixbufs[1] = create_pixbuf ("intermediate.png");
|
||||
pixbufs[2] = create_pixbuf ("expert.png");
|
||||
|
||||
nautilus_radio_button_group_set_entry_pixbuf (NAUTILUS_RADIO_BUTTON_GROUP (group), 0, pixbufs[0]);
|
||||
nautilus_radio_button_group_set_entry_pixbuf (NAUTILUS_RADIO_BUTTON_GROUP (group), 1, pixbufs[1]);
|
||||
nautilus_radio_button_group_set_entry_pixbuf (NAUTILUS_RADIO_BUTTON_GROUP (group), 2, pixbufs[2]);
|
||||
|
||||
gdk_pixbuf_unref (pixbufs[0]);
|
||||
gdk_pixbuf_unref (pixbufs[1]);
|
||||
gdk_pixbuf_unref (pixbufs[2]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_radio_group (void)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *buttons;
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
GdkPixbuf *pixbufs[3];
|
||||
buttons = nautilus_radio_button_group_new (FALSE);
|
||||
|
||||
radio_group_load_it_up (NAUTILUS_RADIO_BUTTON_GROUP (buttons), TRUE, TRUE);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (buttons),
|
||||
"changed",
|
||||
GTK_SIGNAL_FUNC (test_radio_changed_callback),
|
||||
(gpointer) NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), buttons);
|
||||
|
||||
gtk_widget_show (buttons);
|
||||
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
|
||||
static void
|
||||
test_radio_group_horizontal (void)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *buttons;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
buttons = nautilus_radio_button_group_new ();
|
||||
buttons = nautilus_radio_button_group_new (TRUE);
|
||||
|
||||
pixbufs[0] = create_pixbuf ("novice.png");
|
||||
pixbufs[1] = create_pixbuf ("intermediate.png");
|
||||
pixbufs[2] = create_pixbuf ("expert.png");
|
||||
|
||||
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (buttons), "Apples");
|
||||
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (buttons), "Oranges");
|
||||
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (buttons), "Strawberries");
|
||||
|
||||
nautilus_radio_button_group_set_entry_pixbuf (NAUTILUS_RADIO_BUTTON_GROUP (buttons), 0, pixbufs[0]);
|
||||
nautilus_radio_button_group_set_entry_pixbuf (NAUTILUS_RADIO_BUTTON_GROUP (buttons), 1, pixbufs[1]);
|
||||
nautilus_radio_button_group_set_entry_pixbuf (NAUTILUS_RADIO_BUTTON_GROUP (buttons), 2, pixbufs[2]);
|
||||
|
||||
nautilus_radio_button_group_set_entry_description_text (NAUTILUS_RADIO_BUTTON_GROUP (buttons), 0, _("Apple description"));
|
||||
nautilus_radio_button_group_set_entry_description_text (NAUTILUS_RADIO_BUTTON_GROUP (buttons), 1, _("Oranges description"));
|
||||
nautilus_radio_button_group_set_entry_description_text (NAUTILUS_RADIO_BUTTON_GROUP (buttons), 2, _("Strawberries description"));
|
||||
|
||||
gdk_pixbuf_unref (pixbufs[0]);
|
||||
gdk_pixbuf_unref (pixbufs[1]);
|
||||
gdk_pixbuf_unref (pixbufs[2]);
|
||||
radio_group_load_it_up (NAUTILUS_RADIO_BUTTON_GROUP (buttons), FALSE, FALSE);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (buttons),
|
||||
"changed",
|
||||
|
|
Loading…
Reference in a new issue