Changeset 5295


Ignore:
Timestamp:
Mar 18, 2008, 8:41:27 PM (14 years ago)
Author:
charles
Message:

(gtk) have the "open" dialog remember which folder it was in the last time it was used.

Location:
trunk/gtk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/open-dialog.c

    r5290 r5295  
    1313#include <glib/gi18n.h>
    1414#include <gtk/gtk.h>
     15#include "conf.h"
    1516#include "file-list.h"
    1617#include "hig.h"
    1718#include "open-dialog.h"
     19#include "tr-prefs.h"
    1820
    1921struct OpenData
     
    251253onOpenDialogResponse( GtkDialog * dialog, int response, gpointer core )
    252254{
    253     if( response == GTK_RESPONSE_ACCEPT )
    254     {
     255    char * folder = gtk_file_chooser_get_current_folder( GTK_FILE_CHOOSER( dialog ) );
     256    pref_string_set( PREF_KEY_OPEN_DIALOG_FOLDER, folder );
     257    g_free( folder );
     258
     259    if( response == GTK_RESPONSE_ACCEPT ) {
    255260        GSList * l = gtk_file_chooser_get_filenames( GTK_FILE_CHOOSER( dialog ) );
    256261        tr_core_add_list( core, l, FALSE );
     
    266271    GtkWidget * w;
    267272    GtkFileFilter * filter;
    268 
     273    char * folder;
    269274
    270275    w = gtk_file_chooser_dialog_new( _( "Select Torrents" ), parent,
     
    291296    g_signal_connect( w, "response", G_CALLBACK(onOpenDialogResponse), core );
    292297
     298    if(( folder = pref_string_get( PREF_KEY_OPEN_DIALOG_FOLDER ))) {
     299        gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( w ), folder );
     300        g_free( folder );
     301    }
     302   
     303
    293304    gtk_widget_show( w );
    294305    return w;
  • trunk/gtk/tr-prefs.c

    r5290 r5295  
    4141#endif
    4242
     43    pref_string_set_default ( PREF_KEY_OPEN_DIALOG_FOLDER, g_get_home_dir( ) );
     44
    4345    pref_int_set_default    ( PREF_KEY_MAX_PEERS_GLOBAL, 200 );
    4446    pref_int_set_default    ( PREF_KEY_MAX_PEERS_PER_TORRENT, 50 );
  • trunk/gtk/tr-prefs.h

    r5230 r5295  
    2727#define PREF_KEY_OPTIONS_PROMPT         "show-options-window"
    2828#define PREF_KEY_DIR_DEFAULT            "default-download-directory"
     29#define PREF_KEY_OPEN_DIALOG_FOLDER     "open-dialog-folder"
    2930#define PREF_KEY_DIR_WATCH              "watch-folder"
    3031#define PREF_KEY_DIR_WATCH_ENABLED      "watch-folder-enabled"
Note: See TracChangeset for help on using the changeset viewer.