Changeset 092ccc37a6a943df09a8a3b83fa16f22cfed9c63

Show
Ignore:
Timestamp:
08/25/08 00:08:47 (5 years ago)
Author:
Armin Burgmeier <armin@…>
Parents:
3bb736dc8aaca0b06ecd8cd17b594c34c828759e
Children:
e17f0d1480360907f999c68409c415c8022f259f
git-committer:
Armin Burgmeier <armin@arbur.net> / 2008-08-25T00:08:47Z+0200
Message:

Added context menu for browser pane

2008-08-24 Armin Burgmeier <armin@…>

  • inc/core/nodewatch.hpp:
  • src/core/nodewatch.cpp: Added a class that watches a node in a InfcBrowser? and emits a signal when it is removed.
  • inc/dialogs/entrydialog.hpp:
  • src/dialogs/entrydialog.cpp: Added a class that shows a dialog with an entry, to prompt the user for a string to enter.
  • inc/operations/operation-delete.hpp:
  • src/operations/operation-delete.cpp: Added an operation that deletes a node.
  • inc/core/browser.hpp:
  • src/core/browser.cpp: Added get_view().
  • inc/operations/operation-new.hpp:
  • src/operations/operation-new.cpp: Allow this to create a directory, via a boolean parameter.
  • inc/operations/operations.hpp:
  • src/operations/operations.cpp: Added delete_node() and create_directory().
  • src/core/documentinfostorage.cpp (on_node_removed): Don't require the removed node to be in our map.
  • inc/commands/browser-context-commands.hpp:
  • src/commands/browser-context-commands.cpp: Added a class that shows a context menu for the left browser pane, allowing the user to create or remove nodes.
  • inc/core/Makefile.am:
  • inc/dialogs/Makefile.am:
  • inc/operations/Makefile.am:
  • inc/commands/Makefile.am:
  • src/core/Makefile.am:
  • src/dialogs/Makefile.am:
  • src/operations/Makefile.am:
  • src/commands/Makefile.am: Added the new files to the build.
Files:
8 added
22 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r3bb736dc r092ccc3  
     12008-08-24  Armin Burgmeier  <armin@arbur.net> 
     2 
     3        * inc/core/nodewatch.hpp: 
     4        * src/core/nodewatch.cpp: Added a class that watches a node in a 
     5        InfcBrowser and emits a signal when it is removed. 
     6 
     7        * inc/dialogs/entrydialog.hpp: 
     8        * src/dialogs/entrydialog.cpp: Added a class that shows a dialog with 
     9        an entry, to prompt the user for a string to enter. 
     10 
     11        * inc/operations/operation-delete.hpp: 
     12        * src/operations/operation-delete.cpp: Added an operation that deletes 
     13        a node. 
     14 
     15        * inc/core/browser.hpp: 
     16        * src/core/browser.cpp: Added get_view(). 
     17 
     18        * inc/operations/operation-new.hpp: 
     19        * src/operations/operation-new.cpp: Allow this to create a directory, 
     20        via a boolean parameter. 
     21 
     22        * inc/operations/operations.hpp: 
     23        * src/operations/operations.cpp: Added delete_node() and 
     24        create_directory(). 
     25 
     26        * src/core/documentinfostorage.cpp (on_node_removed): Don't require 
     27        the removed node to be in our map. 
     28 
     29        * inc/commands/browser-context-commands.hpp: 
     30        * src/commands/browser-context-commands.cpp: Added a class that shows 
     31        a context menu for the left browser pane, allowing the user to create 
     32        or remove nodes. 
     33 
     34        * inc/window.hpp: 
     35        * src/window.cpp: Instantiate a BrowserContextCommands object. 
     36 
     37        * inc/core/Makefile.am: 
     38        * inc/dialogs/Makefile.am: 
     39        * inc/operations/Makefile.am: 
     40        * inc/commands/Makefile.am: 
     41        * src/core/Makefile.am: 
     42        * src/dialogs/Makefile.am: 
     43        * src/operations/Makefile.am: 
     44        * src/commands/Makefile.am: Added the new files to the build. 
     45 
    1462008-08-24  Armin Burgmeier  <armin@arbur.net> 
    247 
  • TODO

    rcfeaba1 r092ccc3  
    77 - ^W should close the window 
    88 - Remove references to doclist, userlist and chat in the icon manager 
    9  - Implemente single instance, probably using GtkUnique 
     9 - Implement single instance, probably using GtkUnique 
    1010 - Implement self-hosting, this also requires showing and handling directories 
    1111   in InfGtkBrowserModel/Store 
    1212 - Sort BrowserModel in Left pane and DocumentLocationDialog 
    1313 - Add remove and add directory operations to Operations 
    14  - Add context menu to browser in left pane 
    1514 - Add user list to DocWindows. 
    1615 - Add close buttons to browser in left pane, user lists and docwindow infos, 
    1716   and a way to re-show the former two. 
     17 - hue-only color selector 
    1818 
    1919These things need to be implemented in infinote, but again would be nice 
  • inc/commands/Makefile.am

    rcd63729 r092ccc3  
    22noinst_HEADERS = \ 
    33        browser-commands.hpp \ 
     4        browser-context-commands.hpp \ 
    45        edit-commands.hpp \ 
    56        file-commands.hpp \ 
  • inc/core/Makefile.am

    r3bb736dc r092ccc3  
    99        header.hpp \ 
    1010        iconmanager.hpp \ 
     11        nodewatch.hpp \ 
    1112        noteplugin.hpp \ 
    1213        preferences.hpp \ 
  • inc/core/browser.hpp

    rcfeaba1 r092ccc3  
    6666        } 
    6767 
     68        InfGtkBrowserView* get_view() { return m_browser_view; } 
     69 
    6870        bool get_selected(InfcBrowser** browser, InfcBrowserIter* iter); 
    6971        void set_selected(InfcBrowser* browser, InfcBrowserIter* iter); 
  • inc/dialogs/Makefile.am

    rdddf956 r092ccc3  
    11noinst_HEADERS = \ 
    22        documentlocationdialog.hpp \ 
     3        entrydialog.hpp \ 
    34        finddialog.hpp \ 
    45        gotodialog.hpp \ 
  • inc/operations/Makefile.am

    re321deb r092ccc3  
    22noinst_HEADERS = \ 
    33        operations.hpp \ 
     4        operation-delete.hpp \ 
    45        operation-new.hpp \ 
    56        operation-open.hpp \ 
  • inc/operations/operation-new.hpp

    r91aa9b2 r092ccc3  
    2929public: 
    3030        OperationNew(Operations& operations, InfcBrowser* browser, 
    31                      InfcBrowserIter* parent, const Glib::ustring& name); 
     31                     InfcBrowserIter* parent, const Glib::ustring& name, 
     32                     bool directory); 
    3233 
    3334        virtual ~OperationNew(); 
     
    5758protected: 
    5859        Glib::ustring m_name; 
     60        bool m_directory; 
    5961        InfcNodeRequest* m_request; 
    6062        gulong m_finished_id; 
  • inc/operations/operations.hpp

    re321deb r092ccc3  
    6161        ~Operations(); 
    6262 
    63         void create_document(InfcBrowser* browser, 
    64                              InfcBrowserIter* parent, 
    65                              const Glib::ustring name); 
     63        void create_directory(InfcBrowser* browser, 
     64                              InfcBrowserIter* parent, 
     65                              const Glib::ustring& name); 
    6666 
    6767        void create_document(InfcBrowser* browser, 
    6868                             InfcBrowserIter* parent, 
    69                              const Glib::ustring name, 
    70                              Preferences& preferences, 
     69                             const Glib::ustring& name); 
     70 
     71        void create_document(InfcBrowser* browser, 
     72                             InfcBrowserIter* parent, 
     73                             const Glib::ustring& name, 
     74                             const Preferences& preferences, 
    7175                             const Glib::ustring& from_uri, 
    7276                             const char* encoding); 
     
    7781                           const std::string& encoding, 
    7882                           DocumentInfoStorage::EolStyle eol_style); 
     83 
     84        void delete_node(InfcBrowser* browser, 
     85                         InfcBrowserIter* iter); 
    7986 
    8087protected: 
  • inc/window.hpp

    r3bb736dc r092ccc3  
    2424 
    2525#include "commands/browser-commands.hpp" 
     26#include "commands/browser-context-commands.hpp" 
    2627#include "commands/file-commands.hpp" 
    2728#include "commands/edit-commands.hpp" 
     
    9394 
    9495        BrowserCommands m_commands_browser; 
     96        BrowserContextCommands m_commands_browser_context; 
    9597        FileCommands m_commands_file; 
    9698        EditCommands m_commands_edit; 
  • src/commands/Makefile.am

    rcd63729 r092ccc3  
    33libgobby_commands_a_SOURCES = \ 
    44        browser-commands.cpp \ 
     5        browser-context-commands.cpp \ 
    56        edit-commands.cpp \ 
    67        file-commands.cpp \ 
  • src/core/Makefile.am

    r3bb736dc r092ccc3  
    1010        header.cpp \ 
    1111        iconmanager.cpp \ 
     12        nodewatch.cpp \ 
    1213        noteplugin.cpp \ 
    1314        preferences.cpp \ 
  • src/core/browser.cpp

    rcfeaba1 r092ccc3  
    283283                GTK_TREE_MODEL(m_browser_store), &tree_iter, 
    284284                INF_GTK_BROWSER_MODEL_COL_BROWSER, &tmp_browser, 
    285                 INF_GTK_BROWSER_MODEL_COL_NODE, &tmp_iter, -1); 
     285                -1); 
     286 
     287        if(tmp_browser == NULL) 
     288                return false; 
     289 
     290        gtk_tree_model_get( 
     291                GTK_TREE_MODEL(m_browser_store), &tree_iter, 
     292                INF_GTK_BROWSER_MODEL_COL_NODE, &tmp_iter, 
     293                -1); 
    286294 
    287295        *browser = tmp_browser; 
  • src/core/documentinfostorage.cpp

    re321deb r092ccc3  
    319319        std::string key = get_key(browser, iter); 
    320320        InfoMap::iterator map_iter = m_infos.find(key); 
    321         g_assert(map_iter != m_infos.end()); 
    322         m_infos.erase(map_iter); 
    323 } 
    324  
     321 
     322        if(map_iter != m_infos.end()) 
     323                m_infos.erase(map_iter); 
     324} 
     325 
  • src/dialogs/Makefile.am

    rdddf956 r092ccc3  
    33libgobby_dialogs_a_SOURCES = \ 
    44        documentlocationdialog.cpp \ 
     5        entrydialog.cpp \ 
    56        finddialog.cpp \ 
    67        gotodialog.cpp \ 
  • src/dialogs/documentlocationdialog.cpp

    rda28543 r092ccc3  
    3535Gobby::DocumentLocationDialog::DocumentLocationDialog(Gtk::Window& parent, 
    3636                                                      InfGtkBrowserModel* m): 
     37        Gtk::Dialog(_("Select document's target location"), parent), 
    3738        m_table(3, 2), m_name_label(_("Document Name:"), Gtk::ALIGN_RIGHT), 
    3839        m_location_label( 
     
    6263                       Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND); 
    6364        m_table.set_spacings(6); 
    64         m_table.set_border_width(12); 
    6565        m_table.show(); 
    6666 
     
    8686        set_default_response(Gtk::RESPONSE_ACCEPT); 
    8787        set_default_size(-1, 480); 
    88         set_title(_("Select document's target location")); 
     88        set_border_width(12); 
    8989} 
    9090 
  • src/dialogs/finddialog.cpp

    r8d53871 r092ccc3  
    8787        m_box_main.pack_start(m_check_wrap_around, Gtk::PACK_SHRINK); 
    8888        m_box_main.set_spacing(12); 
    89         m_box_main.set_border_width(12); 
    9089        m_box_main.show(); 
    9190 
     
    9796                sigc::mem_fun(*this, &FindDialog::on_replace_text_changed)); 
    9897 
     98        set_border_width(12); 
    9999        set_resizable(false); 
    100100 
  • src/dialogs/gotodialog.cpp

    r8d53871 r092ccc3  
    4343                       Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); 
    4444        m_table.set_spacings(12); 
    45         m_table.set_border_width(12); 
    4645        m_table.show(); 
    4746 
     
    5958 
    6059        set_default_response(Gtk::RESPONSE_ACCEPT); 
     60        set_border_width(12); 
    6161        set_resizable(false); 
    6262 
  • src/operations/Makefile.am

    re321deb r092ccc3  
    33libgobby_operations_a_SOURCES = \ 
    44        operations.cpp \ 
     5        operation-delete.cpp \ 
    56        operation-new.cpp \ 
    67        operation-open.cpp \ 
  • src/operations/operation-new.cpp

    rd685cc7 r092ccc3  
    2525                                  InfcBrowser* browser, 
    2626                                  InfcBrowserIter* parent, 
    27                                   const Glib::ustring& name): 
    28         Operation(operations), m_name(name) 
     27                                  const Glib::ustring& name, 
     28                                  bool directory): 
     29        Operation(operations), m_name(name), m_directory(directory) 
    2930{ 
    30         // TODO: Use TRUE here as soon as BrowserCommands handles it 
    31         m_request = infc_browser_add_note(browser, parent, name.c_str(), 
    32                                           Plugins::TEXT, TRUE); 
     31        if(directory) 
     32        { 
     33                m_request = infc_browser_add_subdirectory(browser, parent, 
     34                                                          name.c_str()); 
     35        } 
     36        else 
     37        { 
     38                m_request = infc_browser_add_note(browser, parent, 
     39                                                  name.c_str(), Plugins::TEXT, 
     40                                                  TRUE); 
     41        } 
     42 
    3343        // Note infc_browser_add_note does not return a 
    3444        // new reference. 
     
    4454        m_message_handle = get_status_bar().add_message( 
    4555                StatusBar::INFO, 
    46                 Glib::ustring::compose(_("Creating document %1
"), name), 0); 
     56                Glib::ustring::compose( 
     57                        directory ? _("Creating directory %1
") 
     58                                  : _("Creating document %1
"), name), 0); 
    4759} 
    4860 
     
    6072        get_status_bar().add_message( 
    6173                StatusBar::ERROR, 
    62                 Glib::ustring::compose(_("Failed to create document %1: %2"), 
    63                                        m_name, error->message), 5); 
     74                Glib::ustring::compose( 
     75                        m_directory ? _("Failed to create directory %1: %2") 
     76                                    : _("Failed to create document %1: %2"), 
     77                        m_name, error->message), 5); 
    6478 
    6579        remove(); 
  • src/operations/operations.cpp

    re321deb r092ccc3  
    2020#include "operations/operation-open.hpp" 
    2121#include "operations/operation-save.hpp" 
     22#include "operations/operation-delete.hpp" 
    2223#include "operations/operations.hpp" 
    2324 
     
    4243} 
    4344 
    44 void Gobby::Operations::create_document(InfcBrowser* browser, 
    45                                         InfcBrowserIter* parent, 
    46                                         const Glib::ustring name) 
     45void Gobby::Operations::create_directory(InfcBrowser* browser, 
     46                                         InfcBrowserIter* parent, 
     47                                         const Glib::ustring& name) 
    4748{ 
    48         m_operations.insert(new OperationNew(*this, browser, parent, name)); 
     49        m_operations.insert(new OperationNew(*this, browser, parent, 
     50                                             name, true)); 
    4951} 
    5052 
    5153void Gobby::Operations::create_document(InfcBrowser* browser, 
    5254                                        InfcBrowserIter* parent, 
    53                                         const Glib::ustring name, 
    54                                         Preferences& preferences, 
     55                                        const Glib::ustring& name) 
     56{ 
     57        m_operations.insert(new OperationNew(*this, browser, parent, 
     58                                             name, false)); 
     59} 
     60 
     61void Gobby::Operations::create_document(InfcBrowser* browser, 
     62                                        InfcBrowserIter* parent, 
     63                                        const Glib::ustring& name, 
     64                                        const Preferences& preferences, 
    5565                                        const Glib::ustring& from_uri, 
    5666                                        const char* encoding) 
     
    7282} 
    7383 
     84void Gobby::Operations::delete_node(InfcBrowser* browser, 
     85                                    InfcBrowserIter* iter) 
     86{ 
     87        m_operations.insert(new OperationDelete(*this, browser, iter)); 
     88} 
     89 
    7490void Gobby::Operations::remove_operation(Operation* operation) 
    7591{ 
  • src/window.cpp

    r3bb736dc r092ccc3  
    3535        m_commands_browser(m_browser, m_folder, m_info_storage, m_statusbar, 
    3636                           m_preferences), 
     37        m_commands_browser_context(*this, m_browser, m_file_chooser, 
     38                                   m_operations, m_preferences), 
    3739        m_commands_file(*this, m_header, m_browser, m_folder, m_file_chooser, 
    3840                        m_operations, m_info_storage, m_preferences),