Revision 3373e976438182796e93bab7ded908eba4db04ed

wabz at pidgin.im wabz at pidgin.im
Mon Mar 26 20:52:37 EDT 2007


o   -----------------------------------------------------------------
|   Revision: 3373e976438182796e93bab7ded908eba4db04ed
|   Ancestor: b88baa91c21ae184cacca425b020f33bcb89ce43
|   Author: wabz at pidgin.im
|   Date: 2007-03-27T00:46:18
|   Branch: im.pidgin.pidgin
|   
|   Modified files:
|           finch/gntrequest.c finch/libgnt/gntfilesel.c
|           finch/libgnt/gntfilesel.h
|   
|   ChangeLog: 
|   
|   fix file saving
|   
|   ============================================================
|   --- finch/gntrequest.c	7d34a05e7573c17085b8d98091752ba19b21fc9a
|   +++ finch/gntrequest.c	7f00f030f3ccddddb4fdc02ba9829f1d609214dd
|   @@ -582,6 +582,8 @@ finch_request_file(const char *title, co
|    	data->dialog = window;
|    	gnt_box_set_title(GNT_BOX(window), title ? title : (savedialog ? _("Save File...") : _("Open File...")));
|    	gnt_file_sel_set_current_location(sel, purple_home_dir());  /* XXX: */
|   +	if (savedialog)
|   +		gnt_file_sel_set_suggested_filename(sel, filename);
|    	g_signal_connect(G_OBJECT(sel->cancel), "activate",
|    			G_CALLBACK(file_cancel_cb), data);
|    	g_signal_connect(G_OBJECT(sel->select), "activate",
|   ============================================================
|   --- finch/libgnt/gntfilesel.c	c7efb481d2495dfbbf09e74d06bae247dcfd914c
|   +++ finch/libgnt/gntfilesel.c	3933090725b7303f6e5170e96da10aeebec09130
|   @@ -28,6 +28,7 @@ gnt_file_sel_destroy(GntWidget *widget)
|    {
|    	GntFileSel *sel = GNT_FILE_SEL(widget);
|    	g_free(sel->current);
|   +	g_free(sel->suggest);
|    	if (sel->tags) {
|    		g_list_foreach(sel->tags, (GFunc)g_free, NULL);
|    		g_list_free(sel->tags);
|   @@ -70,7 +71,8 @@ update_location(GntFileSel *sel)
|    {
|    	char *old;
|    	const char *tmp;
|   -	tmp = (const char*)gnt_tree_get_selection_data(sel->dirsonly ? GNT_TREE(sel->dirs) : GNT_TREE(sel->files));
|   +	tmp = sel->suggest ? sel->suggest :
|   +		(const char*)gnt_tree_get_selection_data(sel->dirsonly ? GNT_TREE(sel->dirs) : GNT_TREE(sel->files));
|    	old = g_strdup_printf("%s%s%s", sel->current, sel->current[1] ? G_DIR_SEPARATOR_S : "", tmp ? tmp : "");
|    	gnt_entry_set_text(GNT_ENTRY(sel->location), old);
|    	g_free(old);
|   @@ -230,6 +232,8 @@ file_sel_changed(GntWidget *widget, gpoi
|    static void
|    file_sel_changed(GntWidget *widget, gpointer old, gpointer current, GntFileSel *sel)
|    {
|   +	g_free(sel->suggest);
|   +	sel->suggest = NULL;
|    	update_location(sel);
|    }
|    
|   @@ -449,12 +453,19 @@ gboolean gnt_file_sel_get_dirs_only(GntF
|    	return sel->dirsonly;
|    }
|    
|   +void gnt_file_sel_set_suggested_filename(GntFileSel *sel, const char *suggest)
|   +{
|   +	sel->suggest = g_strdup(suggest);
|   +}
|   +
|    char *gnt_file_sel_get_selected_file(GntFileSel *sel)
|    {
|    	char *ret;
|   -	const char *tmp;
|   -	tmp = (const char*)gnt_tree_get_selection_data(sel->dirsonly ? GNT_TREE(sel->dirs) : GNT_TREE(sel->files));
|   -	ret = g_strdup_printf("%s%s%s", sel->current, sel->current[1] ? G_DIR_SEPARATOR_S : "", tmp ? tmp : "");
|   +	if (sel->dirsonly) {
|   +		ret = g_strdup(g_path_get_dirname(gnt_entry_get_text(GNT_ENTRY(sel->location))));
|   +	} else {
|   +		ret = g_strdup(gnt_entry_get_text(GNT_ENTRY(sel->location)));
|   +	}
|    	return ret;
|    }
|    
|   ============================================================
|   --- finch/libgnt/gntfilesel.h	70cd6214d27e11388af7dd3a258fa3293d8b863d
|   +++ finch/libgnt/gntfilesel.h	f8ef0ccc30968d6335477df5db8bb59193adea8a
|   @@ -33,6 +33,7 @@ struct _GntFileSel
|    	GntWidget *cancel;   /* cancel button */
|    
|    	char *current; /* Full path of the current location */
|   +	char *suggest; /* Suggested filename */
|    	/* XXX: someone should make these useful */
|    	gboolean must_exist; /* Make sure the selected file (the name entered in 'location') exists */
|    	gboolean dirsonly;   /* Show only directories */
|   @@ -73,6 +74,8 @@ void gnt_file_sel_set_multi_select(GntFi
|    
|    void gnt_file_sel_set_multi_select(GntFileSel *sel, gboolean set);
|    
|   +void gnt_file_sel_set_suggested_filename(GntFileSel *sel, const char *suggest);
|   +
|    G_END_DECLS
|    
|    #endif /* GNT_FILE_SEL_H */

To get the patch for this revision, please do this:
mtn log --last 1 --diffs --from 3373e976438182796e93bab7ded908eba4db04ed


More information about the Commits mailing list