done.
=================
+ GList *element;
+ gint counter = 0;
gtk_window_set_title (GTK_WINDOW (widget), _("User Account Editor"));
g_object_set_data (G_OBJECT (widget), "data", ud);
@@ -195,6 +202,16 @@ user_new_prepare (ug_data *ud)
combo_add_groups (gst_dialog_get_widget (tool->main_dialog,
"user_settings_group"), TRUE);
combo_add_shells (gst_dialog_get_widget (tool->main_dialog,
"user_settings_shell"));
combo_add_profiles (gst_dialog_get_widget (tool->main_dialog,
"user_settings_profile_menu"));
+
+ element = g_list_first (groups_list);
+
+ while ((element != NULL) && (strcmp (element->data, "other") != 0)) {
+ element = element->next;
+ counter++;
+ }
+ if (element == NULL) /* here group_list should have some entries in,
so element is Null only because not find "other" */
+ counter == 0;
+ gtk_combo_box_set_active (GTK_COMBO_BOX (gst_dialog_get_widget
(tool->main_dialog, "user_settings_group")), counter);
Henry Zhang ??:
> Hi Harry,
>
> Harry Lu ??:
>
>> Henry,
>> Please see my comments below.
>>
>> Harry
>>
>> On Mon, 2006-11-20 at 10:27 +0800, Henry Zhang wrote:
>>
>>
>>> I commited 2 patches, both are tested by myself..
>>>
>>> 1. fix for 6484279:
>>> This bug is to set a value to combo, which is created by glade. The
>>> value is the default group used to add new user...
>>>
>>> +
>>> + element = g_list_first (groups_list);
>>> +
>>> + while ((element != NULL) && (strcmp (element->data, "other") != 0)) {
>>>
>>>
>> Does the "other" above need to be translated?
>>
>>
> don't need to translated, it's a goup name, everyone when add user/group
> have to simply use english "other".
>
>>
>>
>>> + element = element->next;
>>> + counter++;
>>> + }
>>> + gtk_combo_box_set_active (GTK_COMBO_BOX (gst_dialog_get_widget
>>> (tool->main_dialog, "user_settings_group")), counter);
>>>
>>>
>> Is counter initialized to 0 somewhere before?
>>
> yes, counter is set to 0 at the function begin, I just copy main part
> here, maybe later I should copy all relative here. :)
>
>> And if you cannot find
>> "other", it will set the first item to be the default. Is this the
>> expected behavior?
>>
>>
> That's reasonable, will fix. thanks. :)
>
>
>> Harry@@ -185,6 +190,8 @@ user_new_prepare (ug_data *ud)
>> GtkWidget *button;
>> gchar *buf;
>> GtkWidget *widget = gst_dialog_get_widget (tool->main_dialog,
>> "user_settings_dialog");
>> + GList *element;
>> + gint counter = 0;
>>
>> gtk_window_set_title (GTK_WINDOW (widget), _("User Account Editor"));
>> g_object_set_data (G_OBJECT (widget), "data", ud);
>> @@ -195,6 +202,14 @@ user_new_prepare (ug_data *ud)
>> combo_add_groups (gst_dialog_get_widget (tool->main_dialog,
>> "user_settings_group"), TRUE);
>> combo_add_shells (gst_dialog_get_widget (tool->main_dialog,
>> "user_settings_shell"));
>> combo_add_profiles (gst_dialog_get_widget (tool->main_dialog,
>> "user_settings_profile_menu"));
>> +
>> + element = g_list_first (groups_list);
>> +
>> + while ((element != NULL) && (strcmp (element->data, "other")
>> != 0)) {
>> + element = element->next;
>> + counter++;
>> + }
>> + gtk_combo_box_set_active (GTK_COMBO_BOX
>> (gst_dialog_get_widget (tool->main_dialog, "user_settings_group")), counter);
>>
>>
> Thanks,
> Henry
>
>