~ubuntu-branches/ubuntu/raring/nautilus/raring

« back to all changes in this revision

Viewing changes to src/nautilus-window-menus.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Jeremy Bicha
  • Date: 2012-01-31 13:45:01 UTC
  • mfrom: (1.17.25)
  • Revision ID: package-import@ubuntu.com-20120131134501-yn7mqny7fgzx9fao
Tags: 1:3.3.4-0ubuntu1
* New upstream version which fixes:
  - "Opening Popupmenu in Context of Folder with List-View impossible?"
    (lp: #126540)
  - "'Create folder in here' context menu option for nautilus" (lp: #61786)
  - the file count and the size count change in opposite direction.
    (lp: #503330)
  - the mounts in the place menu should have a properties entry.
    (lp: #846289)
  - add command line option to select file (lp: #575719)
  - Media in 'Places' side bar should have same context menu as in 
    'Computer' (lp: #230098)
* debian/nautilus-data.install:
  - updated, ui and icons have been moved into gresources
* debian/patches/05_desktop_menu_export.patch:
   - updated to correctly include the gresources desktop definition

[ Jeremy Bicha ]
* New upstream release.
* debian/control.in:
  - Bump minimum GTK and glib
* Refreshed patches
* Dropped upstream patches:
  - 17_dont_allow_new_tab_on_desktop.patch
  - 18_fix_crash_in_get_current_uri.patch
  - 19_lazily_initialize_notification_service.patch
  - git_sideplace_sorting.patch
  - git_next_row.patch
  - git_dont_document_browser_option.patch
  - git_browser_compat.patch
  - git_bookmarks_reordering.patch
  - git_listview_context_menus.patch
  - git_use_gtk_grid.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
        window = NAUTILUS_WINDOW (callback_data);
278
278
 
279
279
        if (window->details->show_hidden_files_mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
280
 
                action = gtk_action_group_get_action (window->details->main_action_group, NAUTILUS_ACTION_SHOW_HIDDEN_FILES);
281
 
                g_assert (GTK_IS_ACTION (action));
 
280
                action = gtk_action_group_get_action (nautilus_window_get_main_action_group (window),
 
281
                                                      NAUTILUS_ACTION_SHOW_HIDDEN_FILES);
282
282
 
283
283
                /* update button */
284
284
                g_signal_handlers_block_by_func (action, action_show_hidden_files_callback, window);
515
515
        GtkAction *action;
516
516
        GIcon *gicon;
517
517
 
518
 
        action_group = window->details->main_action_group;
 
518
        action_group = nautilus_window_get_main_action_group (window);
519
519
        action = gtk_action_group_get_action (action_group, "Go to Trash");
520
520
 
521
521
        gicon = nautilus_trash_monitor_get_icon ();
592
592
        }
593
593
        location = nautilus_window_slot_get_location (next_pane->active_slot);
594
594
        if (location) {
595
 
                nautilus_window_slot_go_to (window->details->active_pane->active_slot, location, FALSE);
 
595
                nautilus_window_slot_go_to (nautilus_window_get_active_slot (window), location, FALSE);
596
596
                g_object_unref (location);
597
597
        }
598
598
}
623
623
 
624
624
        is_active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
625
625
        if (is_active != nautilus_window_split_view_showing (window)) {
626
 
                NautilusWindow *nautilus_window;
 
626
                NautilusWindowSlot *slot;
627
627
 
628
628
                if (is_active) {
629
629
                        nautilus_window_split_view_on (window);
630
630
                } else {
631
631
                        nautilus_window_split_view_off (window);
632
632
                }
633
 
                nautilus_window = NAUTILUS_WINDOW (window);
634
 
                if (nautilus_window->details->active_pane && nautilus_window->details->active_pane->active_slot) {
635
 
                        nautilus_view_update_menus (nautilus_window->details->active_pane->active_slot->content_view);
 
633
 
 
634
                slot = nautilus_window_get_active_slot (window);
 
635
                if (slot != NULL) {
 
636
                        nautilus_view_update_menus (slot->content_view);
636
637
                }
637
638
        }
638
639
}
653
654
void
654
655
nautilus_window_update_show_hide_menu_items (NautilusWindow *window) 
655
656
{
 
657
        GtkActionGroup *action_group;
656
658
        GtkAction *action;
657
659
        guint current_value;
658
660
 
659
 
        g_assert (NAUTILUS_IS_WINDOW (window));
 
661
        action_group = nautilus_window_get_main_action_group (window);
660
662
 
661
 
        action = gtk_action_group_get_action (window->details->main_action_group,
 
663
        action = gtk_action_group_get_action (action_group,
662
664
                                              NAUTILUS_ACTION_SHOW_HIDE_EXTRA_PANE);
663
665
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
664
666
                                      nautilus_window_split_view_showing (window));
665
667
 
666
 
        action = gtk_action_group_get_action (window->details->main_action_group,
 
668
        action = gtk_action_group_get_action (action_group,
667
669
                                              "Sidebar Places");
668
670
        current_value = sidebar_id_to_value (window->details->sidebar_id);
669
671
        gtk_radio_action_set_current_value (GTK_RADIO_ACTION (action), current_value);
727
729
        GtkWidget *menuitem;
728
730
        int i;
729
731
 
730
 
        g_assert (NAUTILUS_IS_WINDOW (window));
731
 
 
732
732
        ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
733
733
 
734
734
        for (i = 0; i < G_N_ELEMENTS (icon_entries); i++) {
744
744
void
745
745
nautilus_window_update_split_view_actions_sensitivity (NautilusWindow *window)
746
746
{
747
 
        NautilusWindow *win;
748
747
        GtkActionGroup *action_group;
749
748
        GtkAction *action;
750
749
        gboolean have_multiple_panes;
752
751
        GFile *active_pane_location;
753
752
        GFile *next_pane_location;
754
753
        NautilusWindowPane *next_pane;
755
 
 
756
 
        g_assert (NAUTILUS_IS_WINDOW (window));
757
 
 
758
 
        action_group = window->details->main_action_group;
759
 
        win = NAUTILUS_WINDOW (window);
 
754
        NautilusWindowSlot *active_slot;
 
755
 
 
756
        active_slot = nautilus_window_get_active_slot (window);
 
757
        action_group = nautilus_window_get_main_action_group (window);
760
758
 
761
759
        /* collect information */
762
 
        have_multiple_panes = (win->details->panes && win->details->panes->next);
763
 
        if (win->details->active_pane->active_slot) {
764
 
                active_pane_location = nautilus_window_slot_get_location (win->details->active_pane->active_slot);
765
 
        }
766
 
        else {
 
760
        have_multiple_panes = nautilus_window_split_view_showing (window);
 
761
        if (active_slot != NULL) {
 
762
                active_pane_location = nautilus_window_slot_get_location (active_slot);
 
763
        } else {
767
764
                active_pane_location = NULL;
768
765
        }
769
 
        next_pane = nautilus_window_get_next_pane (win);
 
766
 
 
767
        next_pane = nautilus_window_get_next_pane (window);
770
768
        if (next_pane && next_pane->active_slot) {
771
769
                next_pane_location = nautilus_window_slot_get_location (next_pane->active_slot);
772
770
                next_pane_is_in_same_location = (active_pane_location && next_pane_location &&
773
771
                                                 g_file_equal (active_pane_location, next_pane_location));
774
 
        }
775
 
        else {
 
772
        } else {
776
773
                next_pane_location = NULL;
777
774
                next_pane_is_in_same_location = FALSE;
778
775
        }
786
783
        gtk_action_set_sensitive (action, have_multiple_panes && !next_pane_is_in_same_location);
787
784
 
788
785
        /* clean up */
789
 
        if (active_pane_location) {
790
 
                g_object_unref (active_pane_location);
791
 
        }
792
 
        if (next_pane_location) {
793
 
                g_object_unref (next_pane_location);
794
 
        }
 
786
        g_clear_object (&active_pane_location);
 
787
        g_clear_object (&next_pane_location);
795
788
}
796
789
 
797
790
static void
824
817
action_go_to_location_callback (GtkAction *action,
825
818
                                gpointer user_data)
826
819
{
827
 
        NautilusWindow *window;
828
 
 
829
 
        window = NAUTILUS_WINDOW (user_data);
830
 
 
831
 
        nautilus_window_prompt_for_location (window, NULL);
 
820
        NautilusWindow *window = user_data;
 
821
        NautilusWindowPane *pane;
 
822
 
 
823
        pane = nautilus_window_get_active_pane (window);
 
824
        nautilus_window_pane_ensure_location_bar (pane);
832
825
}
833
826
 
834
827
static void
836
829
                               gpointer user_data)
837
830
{
838
831
        NautilusWindowPane *pane;
 
832
        NautilusWindow *window = user_data;
839
833
 
840
 
        pane = NAUTILUS_WINDOW (user_data)->details->active_pane;
 
834
        pane = nautilus_window_get_active_pane (window);
841
835
        nautilus_notebook_set_current_page_relative (NAUTILUS_NOTEBOOK (pane->notebook), -1);
842
836
}
843
837
 
846
840
                           gpointer user_data)
847
841
{
848
842
        NautilusWindowPane *pane;
 
843
        NautilusWindow *window = user_data;
849
844
 
850
 
        pane = NAUTILUS_WINDOW (user_data)->details->active_pane;
 
845
        pane = nautilus_window_get_active_pane (window);
851
846
        nautilus_notebook_set_current_page_relative (NAUTILUS_NOTEBOOK (pane->notebook), 1);
852
847
}
853
848
 
856
851
                                gpointer user_data)
857
852
{
858
853
        NautilusWindowPane *pane;
 
854
        NautilusWindow *window = user_data;
859
855
 
860
 
        pane = NAUTILUS_WINDOW (user_data)->details->active_pane;
 
856
        pane = nautilus_window_get_active_pane (window);
861
857
        nautilus_notebook_reorder_current_child_relative (NAUTILUS_NOTEBOOK (pane->notebook), -1);
862
858
}
863
859
 
866
862
                                 gpointer user_data)
867
863
{
868
864
        NautilusWindowPane *pane;
 
865
        NautilusWindow *window = user_data;
869
866
 
870
 
        pane = NAUTILUS_WINDOW (user_data)->details->active_pane;
 
867
        pane = nautilus_window_get_active_pane (window);
871
868
        nautilus_notebook_reorder_current_child_relative (NAUTILUS_NOTEBOOK (pane->notebook), 1);
872
869
}
873
870
 
874
871
static void
875
 
action_tab_change_action_activate_callback (GtkAction *action, gpointer user_data)
 
872
action_tab_change_action_activate_callback (GtkAction *action, 
 
873
                                            gpointer user_data)
876
874
{
877
 
        NautilusWindow *window;
878
 
 
879
 
        window = NAUTILUS_WINDOW (user_data);
880
 
        if (window && window->details->active_pane) {
881
 
                GtkNotebook *notebook;
882
 
                notebook = GTK_NOTEBOOK (window->details->active_pane->notebook);
883
 
                if (notebook) {
884
 
                        int num;
885
 
                        num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (action), "num"));
886
 
                        if (num < gtk_notebook_get_n_pages (notebook)) {
887
 
                                gtk_notebook_set_current_page (notebook, num);
888
 
                        }
889
 
                }
 
875
        NautilusWindowPane *pane;
 
876
        NautilusWindow *window = user_data;
 
877
        GtkNotebook *notebook;
 
878
        int num;
 
879
 
 
880
        pane = nautilus_window_get_active_pane (window);
 
881
        notebook = GTK_NOTEBOOK (pane->notebook);
 
882
 
 
883
        num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (action), "num"));
 
884
        if (num < gtk_notebook_get_n_pages (notebook)) {
 
885
                gtk_notebook_set_current_page (notebook, num);
890
886
        }
891
887
}
892
888
 
1105
1101
GtkActionGroup *
1106
1102
nautilus_window_create_toolbar_action_group (NautilusWindow *window)
1107
1103
{
 
1104
        NautilusNavigationState *navigation_state;
1108
1105
        GtkActionGroup *action_group;
1109
1106
        GtkAction *action;
1110
1107
 
1152
1149
 
1153
1150
        g_object_unref (action);
1154
1151
 
1155
 
        nautilus_navigation_state_add_group (window->details->nav_state,
1156
 
                                             action_group);
 
1152
        navigation_state = nautilus_window_get_navigation_state (window);
 
1153
        nautilus_navigation_state_add_group (navigation_state, action_group);
1157
1154
 
1158
1155
        return action_group;
1159
1156
}
1161
1158
static void
1162
1159
window_menus_set_bindings (NautilusWindow *window)
1163
1160
{
 
1161
        GtkActionGroup *action_group;
1164
1162
        GtkAction *action;
1165
1163
 
1166
 
        action = gtk_action_group_get_action (window->details->main_action_group,
 
1164
        action_group = nautilus_window_get_main_action_group (window);
 
1165
 
 
1166
        action = gtk_action_group_get_action (action_group,
1167
1167
                                              NAUTILUS_ACTION_SHOW_HIDE_TOOLBAR);
1168
1168
 
1169
1169
        g_settings_bind (nautilus_window_state,
1172
1172
                         "active",
1173
1173
                         G_SETTINGS_BIND_DEFAULT);
1174
1174
 
1175
 
        action = gtk_action_group_get_action (window->details->main_action_group,
 
1175
        action = gtk_action_group_get_action (action_group,
1176
1176
                                              NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR);
1177
1177
 
1178
1178
        g_settings_bind (nautilus_window_state,
1181
1181
                         "active",
1182
1182
                         G_SETTINGS_BIND_DEFAULT);
1183
1183
 
1184
 
        action = gtk_action_group_get_action (window->details->main_action_group,
 
1184
        action = gtk_action_group_get_action (action_group,
1185
1185
                                              NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR);       
1186
1186
 
1187
1187
        g_settings_bind (nautilus_window_state,
1200
1200
                NAUTILUS_ACTION_SEARCH, NULL
1201
1201
        };
1202
1202
 
1203
 
        action_group = window->details->main_action_group;
 
1203
        action_group = nautilus_window_get_main_action_group (window);
1204
1204
        window->details->nav_state = nautilus_navigation_state_new (action_group,
1205
1205
                                                                    nav_state_actions);
1206
1206
 
1224
1224
        GtkActionGroup *action_group;
1225
1225
        GtkUIManager *ui_manager;
1226
1226
        GtkAction *action;
1227
 
        const char *ui;
1228
1227
        gint i;
1229
1228
 
1230
1229
        window->details->ui_manager = gtk_ui_manager_new ();
1297
1296
                          G_CALLBACK (disconnect_proxy_cb), window);
1298
1297
 
1299
1298
        /* add the UI */
1300
 
        ui = nautilus_ui_string_get ("nautilus-shell-ui.xml");
1301
 
        gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
1302
 
 
1303
 
        launchpad_integration_add_ui (ui_manager,
1304
 
                                      "/MenuBar/Help/LaunchpadItems");
 
1299
        gtk_ui_manager_add_ui_from_resource (ui_manager, "/org/gnome/nautilus/nautilus-shell-ui.xml", NULL);
 
1300
 
 
1301
        launchpad_integration_add_ui (ui_manager, "/MenuBar/Help/LaunchpadItems");
1305
1302
 
1306
1303
        nautilus_window_initialize_trash_icon_monitor (window);
1307
1304
        nautilus_window_initialize_go_menu (window);