Added user_id argument to moo_history_entry_new()

This commit is contained in:
Yevgen Muntyan 2006-04-17 01:41:13 -05:00
parent 5ca74dfae7
commit bd13f2eb99
3 changed files with 15 additions and 12 deletions

View File

@ -442,9 +442,20 @@ default_filter_func (const char *entry_text,
GtkWidget*
moo_history_entry_new (void)
moo_history_entry_new (const char *user_id)
{
return g_object_new (MOO_TYPE_HISTORY_ENTRY, NULL);
MooHistoryEntry *entry;
entry = g_object_new (MOO_TYPE_HISTORY_ENTRY, NULL);
if (user_id)
{
MooHistoryList *list = moo_history_list_new (user_id);
moo_history_entry_set_list (entry, list);
g_object_unref (list);
}
return GTK_WIDGET (entry);
}

View File

@ -51,7 +51,7 @@ typedef gboolean (*MooHistoryEntryFilterFunc) (const char *text,
GType moo_history_entry_get_type (void) G_GNUC_CONST;
GtkWidget *moo_history_entry_new (void);
GtkWidget *moo_history_entry_new (const char *user_id);
void moo_history_entry_set_list (MooHistoryEntry *entry,
MooHistoryList *list);

View File

@ -99,7 +99,6 @@ history_entry_func (MSValue **args,
int response;
GtkWidget *dialog, *entry;
MSValue *result;
MooHistoryList *list;
CHECK_GTK (ctx);
@ -125,20 +124,13 @@ history_entry_func (MSValue **args,
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, FALSE, FALSE, 0);
}
entry = moo_history_entry_new ();
entry = moo_history_entry_new (user_id);
moo_combo_set_use_button (MOO_COMBO (entry), FALSE);
gtk_widget_show (entry);
moo_combo_entry_set_text (MOO_COMBO (entry), entry_text ? entry_text : "");
moo_combo_entry_set_activates_default (MOO_COMBO (entry), TRUE);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), entry, FALSE, FALSE, 0);
if (user_id)
{
list = moo_history_list_new (user_id);
moo_history_entry_set_list (MOO_HISTORY_ENTRY (entry), list);
g_object_unref (list);
}
response = gtk_dialog_run (GTK_DIALOG (dialog));
if (response == GTK_RESPONSE_OK)