diff --git a/moo/mooutils/moohistoryentry.c b/moo/mooutils/moohistoryentry.c index 6af221ae..ac0618be 100644 --- a/moo/mooutils/moohistoryentry.c +++ b/moo/mooutils/moohistoryentry.c @@ -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); } diff --git a/moo/mooutils/moohistoryentry.h b/moo/mooutils/moohistoryentry.h index 13a7bd73..4db74c87 100644 --- a/moo/mooutils/moohistoryentry.h +++ b/moo/mooutils/moohistoryentry.h @@ -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); diff --git a/moo/mooutils/mooscript/mooscript-zenity.c b/moo/mooutils/mooscript/mooscript-zenity.c index 655c644d..667929db 100644 --- a/moo/mooutils/mooscript/mooscript-zenity.c +++ b/moo/mooutils/mooscript/mooscript-zenity.c @@ -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)