changeset 18451:7122bcebf7c9

Since we have the file-selected signal, we might as well emit it.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 07 Jul 2007 00:30:45 +0000
parents 8457bb35bf8c
children 45865fb3f4f9 7a5025b8698c 25542d5c94ed
files finch/libgnt/gntfilesel.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }