Show
Ignore:
Timestamp:
04/12/06 06:33:09 (3 years ago)
Author:
jordi
Message:

I've forgoten the rotate left and rotate right sensitivity. I've added the two functions to the main view's interface and gtk shell. Also added to the test suite.

Now the gtk shell can change the sensitiveness of the widgets.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/gtk/MainView.cxx

    r35 r36  
    2626 
    2727// Forward delarations. 
     28static void main_window_go_to_first_page_cb (GtkWidget *, gpointer); 
     29static void main_window_go_to_last_page_cb (GtkWidget *, gpointer); 
     30static void main_window_go_to_next_page_cb (GtkWidget *, gpointer); 
     31static void main_window_go_to_previous_page_cb (GtkWidget *, gpointer); 
    2832static void main_window_open_file_cb (GtkWidget *, gpointer); 
    2933static void main_window_quit_cb (GtkWidget *, gpointer); 
     
    6064MainView::~MainView () 
    6165{ 
     66    g_object_unref (G_OBJECT (m_UIManager)); 
    6267} 
    6368 
     
    9297MainView::sensitiveGoToFirstPage (gboolean sensitive) 
    9398{ 
     99    GtkAction *goToFirstPage = gtk_ui_manager_get_action (m_UIManager, 
     100            "/MenuBar/GoMenu/GoToFirstPage"); 
     101    gtk_action_set_sensitive (goToFirstPage, sensitive); 
    94102} 
    95103 
     
    97105MainView::sensitiveGoToLastPage (gboolean sensitive) 
    98106{ 
     107    GtkAction *goToLastPage =  
     108        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/GoMenu/GoToLastPage"); 
     109    gtk_action_set_sensitive (goToLastPage, sensitive); 
    99110} 
    100111 
     
    102113MainView::sensitiveGoToNextPage (gboolean sensitive) 
    103114{ 
     115    GtkAction *goToNextPage =  
     116        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/GoMenu/GoToNextPage"); 
     117    gtk_action_set_sensitive (goToNextPage, sensitive); 
    104118} 
    105119 
     
    112126MainView::sensitiveGoToPreviousPage (gboolean sensitive) 
    113127{ 
     128    GtkAction *goToPreviousPage = gtk_ui_manager_get_action (m_UIManager,  
     129            "/MenuBar/GoMenu/GoToPreviousPage"); 
     130    gtk_action_set_sensitive (goToPreviousPage, sensitive); 
     131} 
     132 
     133void  
     134MainView::sensitiveRotateLeft (gboolean sensitive) 
     135{ 
     136    GtkAction *rotateLeft =  
     137        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/RotateLeft"); 
     138    gtk_action_set_sensitive (rotateLeft, sensitive); 
     139} 
     140 
     141void  
     142MainView::sensitiveRotateRight (gboolean sensitive) 
     143{ 
     144    GtkAction *rotateRight = gtk_ui_manager_get_action (m_UIManager,  
     145            "/MenuBar/ViewMenu/RotateRight"); 
     146    gtk_action_set_sensitive (rotateRight, sensitive); 
    114147} 
    115148 
     
    117150MainView::sensitiveZoomIn (gboolean sensitive) 
    118151{ 
     152    GtkAction *zoomIn =  
     153        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomIn"); 
     154    gtk_action_set_sensitive (zoomIn, sensitive); 
    119155} 
    120156 
     
    122158MainView::sensitiveZoomOut (gboolean sensitive) 
    123159{ 
     160    GtkAction *zoomOut =  
     161        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomOut"); 
     162    gtk_action_set_sensitive (zoomOut, sensitive); 
    124163} 
    125164 
     
    127166MainView::sensitiveZoomFit (gboolean sensitive) 
    128167{ 
     168    GtkAction *zoomFit =  
     169        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomFit"); 
     170    gtk_action_set_sensitive (zoomFit, sensitive); 
    129171} 
    130172 
     
    132174MainView::sensitiveZoomWidth (gboolean sensitive) 
    133175{ 
     176    GtkAction *zoomWidth =  
     177        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomWidth"); 
     178    gtk_action_set_sensitive (zoomWidth, sensitive); 
    134179} 
    135180 
     
    226271        { "RotateRight", GTK_STOCK_REDO, _("Rotate _Right"), NULL, NULL, NULL}, 
    227272        { "RotateLeft", GTK_STOCK_UNDO, _("Rotate Left"), NULL, NULL, NULL}, 
    228         { "GoToFirstPage", GTK_STOCK_GOTO_FIRST, _("_First Page"), "Home", NULL, NULL }, 
    229         { "GoToNextPage", GTK_STOCK_GO_FORWARD, _("_Next Page"), "Page_Down", NULL, NULL }, 
    230         { "GoToPreviousPage", GTK_STOCK_GO_BACK, _("_Previous Page"), "Page_Up", NULL, NULL }, 
    231         { "GoToLastPage", GTK_STOCK_GOTO_LAST, _("_Last Page"), "End", NULL, NULL }, 
     273        { "GoToFirstPage", GTK_STOCK_GOTO_FIRST, _("_First Page"), "Home", NULL, G_CALLBACK (main_window_go_to_first_page_cb) }, 
     274        { "GoToNextPage", GTK_STOCK_GO_FORWARD, _("_Next Page"), "Page_Down", NULL, G_CALLBACK (main_window_go_to_next_page_cb) }, 
     275        { "GoToPreviousPage", GTK_STOCK_GO_BACK, _("_Previous Page"), "Page_Up", NULL, G_CALLBACK (main_window_go_to_previous_page_cb) }, 
     276        { "GoToLastPage", GTK_STOCK_GOTO_LAST, _("_Last Page"), "End", NULL, G_CALLBACK (main_window_go_to_last_page_cb) }, 
    232277        { "About", GTK_STOCK_ABOUT, "_About", NULL, NULL, NULL } 
    233278    }; 
     
    237282        "  <menubar name='MenuBar'>" 
    238283        "    <menu action='FileMenu'>" 
    239         "      <menuitem action='OpenFile'/>" 
     284        "      <menuitem name='OpenFile' action='OpenFile'/>" 
    240285        "      <separator/>" 
    241         "      <menuitem action='Quit'/>" 
     286        "      <menuitem name='Quit' action='Quit'/>" 
    242287        "    </menu>" 
    243288        "    <menu action='ViewMenu'>" 
    244         "      <menuitem action='ZoomIn'/>" 
    245         "      <menuitem action='ZoomOut'/>" 
    246         "      <menuitem action='ZoomFit'/>" 
    247         "      <menuitem action='ZoomWidth'/>" 
     289        "      <menuitem name='ZoomIn' action='ZoomIn'/>" 
     290        "      <menuitem name='ZoomOut' action='ZoomOut'/>" 
     291        "      <menuitem name='ZoomFit' action='ZoomFit'/>" 
     292        "      <menuitem name='ZoomWidth' action='ZoomWidth'/>" 
    248293        "      <separator />" 
    249         "      <menuitem action='RotateRight'/>" 
    250         "      <menuitem action='RotateLeft'/>" 
     294        "      <menuitem name='RotateRight' action='RotateRight'/>" 
     295        "      <menuitem name='RotateLeft' action='RotateLeft'/>" 
    251296        "    </menu>" 
    252297        "    <menu action='GoMenu'>" 
    253         "      <menuitem action='GoToFirstPage'/>" 
    254         "      <menuitem action='GoToPreviousPage'/>" 
    255         "      <menuitem action='GoToNextPage'/>" 
    256         "      <menuitem action='GoToLastPage'/>" 
     298        "      <menuitem name='GoToFirstPage' action='GoToFirstPage'/>" 
     299        "      <menuitem name='GoToPreviousPage' action='GoToPreviousPage'/>" 
     300        "      <menuitem name='GoToNextPage' action='GoToNextPage'/>" 
     301        "      <menuitem name='GoToLastPage' action='GoToLastPage'/>" 
    257302        "    </menu>" 
    258303        "    <menu action='HelpMenu'>" 
    259         "      <menuitem action='About'/>" 
     304        "      <menuitem name='About' action='About'/>" 
    260305        "    </menu>" 
    261306        "  </menubar>" 
    262307        "  <toolbar name='ToolBar'>" 
    263         "    <toolitem action='OpenFile'/>" 
     308        "    <toolitem name='OpenFile' action='OpenFile'/>" 
    264309        "    <separator/>" 
    265         "    <toolitem action='GoToPreviousPage'/>" 
    266         "    <toolitem action='GoToNextPage'/>" 
     310        "    <toolitem name='GoToPreviousPage' action='GoToPreviousPage'/>" 
     311        "    <toolitem name='GoToNextPage' action='GoToNextPage'/>" 
    267312        "    <separator/>" 
    268313        "    <separator/>" 
    269         "    <toolitem action='ZoomIn'/>" 
    270         "    <toolitem action='ZoomOut'/>" 
    271         "    <toolitem action='ZoomFit'/>" 
    272         "    <toolitem action='ZoomWidth'/>" 
     314        "    <toolitem name='ZoomIn' action='ZoomIn'/>" 
     315        "    <toolitem name='ZoomOut' action='ZoomOut'/>" 
     316        "    <toolitem name='ZoomFit' action='ZoomFit'/>" 
     317        "    <toolitem name='ZoomWidth' action='ZoomWidth'/>" 
    273318        "  </toolbar>" 
    274319        "</ui>"; 
     
    305350//////////////////////////////////////////////////////////////// 
    306351 
     352void 
     353main_window_go_to_first_page_cb (GtkWidget *, gpointer) 
     354{ 
     355} 
     356 
     357void 
     358main_window_go_to_last_page_cb (GtkWidget *, gpointer) 
     359{ 
     360} 
     361 
     362void 
     363main_window_go_to_next_page_cb (GtkWidget *, gpointer) 
     364{ 
     365} 
     366 
     367void 
     368main_window_go_to_previous_page_cb (GtkWidget *, gpointer) 
     369{ 
     370} 
     371 
    307372/// 
    308373/// @brief The user tries to open a file.