# HG changeset patch # User Sadrul Habib Chowdhury # Date 1183768245 0 # Node ID 7122bcebf7c93ef173a1177f41dbf26b6a4c6d4a # Parent 8457bb35bf8cf620ebd78e3b14408fbb4bd3cb66 Since we have the file-selected signal, we might as well emit it. diff -r 8457bb35bf8c -r 7122bcebf7c9 finch/libgnt/gntfilesel.c --- a/finch/libgnt/gntfilesel.c Fri Jul 06 21:48:50 2007 +0000 +++ b/finch/libgnt/gntfilesel.c Sat Jul 07 00:30:45 2007 +0000 @@ -587,7 +587,7 @@ G_STRUCT_OFFSET(GntFileSelClass, file_selected), NULL, NULL, gnt_closure_marshal_VOID__STRING_STRING, - G_TYPE_NONE, 0); + G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); gnt_bindable_class_register_action(bindable, "toggle-tag", toggle_tag_selection, "t", NULL); gnt_bindable_class_register_action(bindable, "clear-tags", clear_tags, "c", NULL); @@ -634,6 +634,16 @@ return type; } +static void +select_activated_cb(GntWidget *button, GntFileSel *sel) +{ + char *path = gnt_file_sel_get_selected_file(sel); + char *file = g_path_get_basename(path); + g_signal_emit(sel, signals[SIG_FILE_SELECTED], 0, path, file); + g_free(file); + g_free(path); +} + GntWidget *gnt_file_sel_new(void) { GntWidget *widget = g_object_new(GNT_TYPE_FILE_SEL, NULL); @@ -663,6 +673,8 @@ sel->cancel = gnt_button_new("Cancel"); sel->select = gnt_button_new("Select"); + g_signal_connect(G_OBJECT(sel->select), "activate", G_CALLBACK(select_activated_cb), sel); + return widget; }