Changeset 534b092abe789eaa49f7f356b43bd77538c62ef9

Show
Ignore:
Timestamp:
10/10/08 23:59:47 (5 years ago)
Author:
Armin Burgmeier <armin@…>
Parents:
cdda99c0276d6c08523acc389ac0c13818ce9e9a
Children:
6cb2a945e0d4db91d47be1384bba73331dc6f8c2
git-committer:
Armin Burgmeier <armin@arbur.net> / 2008-10-10T23:59:47Z+0200
Message:

Use the display name as document title for files opened via the filechooser

2008-10-10 Armin Burgmeier <armin@…>

  • code/core/filechooser.cpp: Allow selecting non-local files in Gobby's filechooser.
  • code/commands/file-commands.cpp:
  • code/commands/browser-context-commands.cpp: Query the display name when opening a file, to use as document title. FileChooser::get_filename() does not work for non-local files.
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rcdda99c r534b092  
     12008-10-10  Armin Burgmeier  <armin@arbur.net> 
     2 
     3        * code/core/filechooser.cpp: Allow selecting non-local files in 
     4        Gobby's filechooser. 
     5 
     6        * code/commands/file-commands.cpp: 
     7        * code/commands/browser-context-commands.cpp: Query the display name 
     8        when opening a file, to use as document title. 
     9        FileChooser::get_filename() does not work for non-local files. 
     10 
    1112008-10-09  Armin Burgmeier  <armin@arbur.net> 
    212 
  • TODO

    r933a996 r534b092  
    99 - Add base preferences class with Preferences::Option definition to util/, 
    1010   inherit in core/, move ClosableFrame to util/ 
     11 - Show in tab and userlist when others are typing, using an icon 
     12 - Typing sounds (libcanberra?) 
    1113 
    1214These things need to be implemented in infinote, but again would be nice 
  • code/commands/browser-context-commands.cpp

    rbd34be3 r534b092  
    2222#include <gtkmm/icontheme.h> 
    2323#include <gtkmm/stock.h> 
     24#include <giomm/file.h> 
    2425 
    2526Gobby::BrowserContextCommands::BrowserContextCommands(Gtk::Window& parent, 
     
    269270        if(response_id == Gtk::RESPONSE_ACCEPT) 
    270271        { 
     272                Glib::RefPtr<Gio::File> file = 
     273                        Gio::File::create_for_uri(m_file_dialog->get_uri()); 
     274 
     275                // TODO: Do this asynchronously: 
     276                Glib::RefPtr<Gio::FileInfo> info = file->query_info( 
     277                        G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME); 
    271278                m_operations.create_document( 
    272                         browser, &iter, Glib::path_get_basename( 
    273                                 m_file_dialog->get_filename()), 
     279                        browser, &iter, info->get_display_name(), 
    274280                        m_preferences, m_file_dialog->get_uri(), NULL); 
    275281        } 
  • code/commands/file-commands.cpp

    rbd34be3 r534b092  
    2121 
    2222#include <gtkmm/stock.h> 
     23#include <giomm/file.h> 
    2324 
    2425namespace 
     
    9495                void on_file_response(int response_id) 
    9596                { 
     97                        const gchar* const ATTR_DISPLAY_NAME = 
     98                                G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME; 
     99 
    96100                        if(response_id == Gtk::RESPONSE_ACCEPT) 
    97101                        { 
     
    107111                                // TODO: Handle multiple selection 
    108112                                m_open_uri = m_file_dialog.get_uri(); 
     113                                // TODO: Query the display name 
     114                                // asynchronously, and use a default as long 
     115                                // as the query is running. 
     116                                Glib::RefPtr<Gio::File> file = 
     117                                        Gio::File::create_for_uri(m_open_uri); 
     118                                Glib::RefPtr<Gio::FileInfo> info = 
     119                                        file->query_info(ATTR_DISPLAY_NAME); 
     120 
    109121                                dialog.set_document_name( 
    110                                         Glib::path_get_basename( 
    111                                                 m_file_dialog. 
    112                                                         get_filename())); 
     122                                        info->get_display_name()); 
    113123 
    114124                                m_file_dialog.hide(); 
  • code/core/filechooser.cpp

    rbd34be3 r534b092  
    4545        } 
    4646 
     47        set_local_only(false); 
    4748        set_current_folder_uri(m_chooser.get_current_folder_uri()); 
    4849}