diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/caja-bookmarks-sidebar.c | 12 | ||||
| -rw-r--r-- | src/caja-desktop-window.c | 2 | ||||
| -rw-r--r-- | src/caja-history-sidebar.c | 1 | ||||
| -rw-r--r-- | src/caja-information-panel.c | 1 | ||||
| -rw-r--r-- | src/caja-navigation-window-pane.c | 163 | ||||
| -rw-r--r-- | src/caja-navigation-window.c | 5 | ||||
| -rw-r--r-- | src/caja-notebook.c | 2 | ||||
| -rw-r--r-- | src/caja-query-editor.c | 2 | ||||
| -rw-r--r-- | src/caja-window-manage-views.c | 8 | ||||
| -rw-r--r-- | src/caja-window-slot.c | 1 | ||||
| -rw-r--r-- | src/file-manager/fm-directory-view.c | 3 |
11 files changed, 193 insertions, 7 deletions
diff --git a/src/caja-bookmarks-sidebar.c b/src/caja-bookmarks-sidebar.c index 57aa563d..33d56eaf 100644 --- a/src/caja-bookmarks-sidebar.c +++ b/src/caja-bookmarks-sidebar.c @@ -143,8 +143,6 @@ update_bookmarks (CajaBookmarksSidebar *sidebar) continue; } - bookmark_uri = caja_bookmark_get_uri (bookmark); - root = caja_bookmark_get_location (bookmark); file = caja_file_get (root); @@ -167,6 +165,7 @@ update_bookmarks (CajaBookmarksSidebar *sidebar) -1); /* Select the bookmark if we're in the directory the bookmark points to. */ + bookmark_uri = caja_bookmark_get_uri (bookmark); if (g_strcmp0 (bookmark_uri, sidebar->current_uri) == 0) gtk_tree_selection_select_iter (selection, &iter); @@ -231,6 +230,7 @@ open_selected_item (CajaBookmarksSidebar *sidebar, flags, NULL); g_object_unref (location); + g_object_unref (bookmark); } static void @@ -333,11 +333,14 @@ loading_uri_callback (CajaWindowInfo *window, if (strcmp (uri, location) == 0) { g_free (uri); + g_object_unref (bookmark); gtk_tree_selection_select_iter (selection, &iter); break; } g_free (uri); } + if (bookmark) + g_object_unref (bookmark); valid = gtk_tree_model_iter_next (model, &iter); } } @@ -368,8 +371,9 @@ is_row_selectable (GtkTreeSelection *selection, if (bookmark == NULL) return FALSE; - else - return TRUE; + + g_object_unref (bookmark); + return TRUE; } static void diff --git a/src/caja-desktop-window.c b/src/caja-desktop-window.c index 72a2bcab..8193c650 100644 --- a/src/caja-desktop-window.c +++ b/src/caja-desktop-window.c @@ -116,7 +116,6 @@ caja_desktop_window_init (CajaDesktopWindow *window) gtk_widget_hide (CAJA_WINDOW (window)->details->statusbar); gtk_widget_hide (CAJA_WINDOW (window)->details->menubar); - gtk_window_set_decorated (GTK_WINDOW (window), FALSE); /* Don't allow close action on desktop */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS; @@ -220,6 +219,7 @@ caja_desktop_window_new (CajaApplication *application, "width_request", width_request, "height_request", height_request, "screen", screen, + "decorated", FALSE, NULL)); /* Stop wrong desktop window size in GTK 3.20*/ /* We don't want to set a default size, which the parent does, since this */ diff --git a/src/caja-history-sidebar.c b/src/caja-history-sidebar.c index cc3b9202..94281aff 100644 --- a/src/caja-history-sidebar.c +++ b/src/caja-history-sidebar.c @@ -162,6 +162,7 @@ open_selected_item (CajaHistorySidebar *sidebar, location, CAJA_WINDOW_OPEN_ACCORDING_TO_MODE, flags, NULL); g_object_unref (location); + g_object_unref (bookmark); } static void diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c index 41a2c493..e2939813 100644 --- a/src/caja-information-panel.c +++ b/src/caja-information-panel.c @@ -998,7 +998,6 @@ selection_changed_callback (CajaWindowInfo *window, GFile *selected; CajaFile *file; - selection = caja_window_info_get_selection (window); selected = selection->data; /* this should never fail here, as we're displaying the file */ diff --git a/src/caja-navigation-window-pane.c b/src/caja-navigation-window-pane.c index 5e870d45..41fbbcb7 100644 --- a/src/caja-navigation-window-pane.c +++ b/src/caja-navigation-window-pane.c @@ -33,6 +33,7 @@ #include "caja-navigation-window-pane.h" #include "caja-window-private.h" #include "caja-window-manage-views.h" +#include "caja-application.h" #include "caja-pathbar.h" #include "caja-location-bar.h" #include "caja-notebook.h" @@ -496,6 +497,144 @@ notebook_popup_menu_cb (GtkWidget *widget, return TRUE; } +static void +notebook_page_removed_cb (GtkNotebook *notebook, + GtkWidget *page, + guint page_num, + CajaNavigationWindowPane *pane) +{ + CajaWindowPane *wpane = CAJA_WINDOW_PANE (pane); + CajaWindowSlot *slot; + + /* This callback is only reached via DnD (blocked during normal removal). + * Look up the slot that owns this content_box. */ + slot = g_object_get_data (G_OBJECT (page), "caja-slot"); + if (slot == NULL || slot->pane != wpane) + { + return; + } + + /* If this was the active slot, activate another one */ + if (wpane->active_slot == slot) + { + CajaWindowSlot *next_slot = NULL; + GList *l; + + for (l = wpane->slots; l != NULL; l = l->next) + { + if (l->data != slot) + { + next_slot = l->data; + break; + } + } + if (next_slot != NULL) + { + caja_window_set_active_slot (wpane->window, next_slot); + } + else + { + wpane->active_slot = NULL; + } + } + + /* Remove slot from source pane bookkeeping without destroying it */ + wpane->slots = g_list_remove (wpane->slots, slot); + wpane->active_slots = g_list_remove (wpane->active_slots, slot); + + /* If the source window is now empty, close it */ + if (wpane->slots == NULL) + { + caja_window_close (wpane->window); + } +} + +static void +notebook_page_added_cb (GtkNotebook *notebook, + GtkWidget *page, + guint page_num, + CajaNavigationWindowPane *pane) +{ + CajaWindowPane *wpane = CAJA_WINDOW_PANE (pane); + CajaWindowSlot *slot; + CajaWindowSlot *dummy_slot; + gboolean from_new_window; + + /* This callback is only reached via DnD (blocked during normal addition). + * Look up the slot that owns this content_box. */ + slot = g_object_get_data (G_OBJECT (page), "caja-slot"); + if (slot == NULL || slot->pane == wpane) + { + return; + } + + /* "caja-dnd-slot" is set only for the create-new-window case */ + from_new_window = (g_object_get_data (G_OBJECT (page), "caja-dnd-slot") != NULL); + g_object_set_data (G_OBJECT (page), "caja-dnd-slot", NULL); + + /* For new-window drops: close the dummy slot the constructor created. + * Grab it before we append the DnD slot so we can distinguish them. */ + dummy_slot = NULL; + if (from_new_window) + dummy_slot = g_list_nth_data (wpane->slots, 0); + + /* Adopt the slot into this pane */ + slot->pane = wpane; + wpane->slots = g_list_append (wpane->slots, slot); + + caja_window_set_active_slot (wpane->window, slot); + + if (dummy_slot != NULL) + { + caja_window_close_slot (dummy_slot); + } + + gtk_notebook_set_show_tabs (notebook, + gtk_notebook_get_n_pages (notebook) > 1); + + gtk_widget_show (GTK_WIDGET (wpane->window)); + + if (from_new_window) + { + /* Release the extra ref taken in notebook_create_window_cb */ + g_object_unref (slot); + } +} + +static GtkNotebook * +notebook_create_window_cb (GtkNotebook *notebook, + GtkWidget *page, + gint x, + gint y, + CajaNavigationWindowPane *pane) +{ + CajaApplication *app; + CajaNavigationWindow *new_window; + CajaWindowPane *new_pane; + CajaWindowSlot *slot; + + /* Find which slot owns this content_box */ + slot = caja_window_pane_get_slot_for_content_box (CAJA_WINDOW_PANE (pane), page); + if (slot == NULL) + { + return NULL; + } + + /* Tag the content_box so page-removed/added callbacks can identify it */ + g_object_ref (slot); + g_object_set_data (G_OBJECT (page), "caja-dnd-slot", slot); + + app = CAJA_APPLICATION (g_application_get_default ()); + new_window = CAJA_NAVIGATION_WINDOW ( + caja_application_create_navigation_window (app, + gtk_widget_get_screen (GTK_WIDGET (notebook)))); + + new_pane = CAJA_WINDOW_PANE ( + g_list_first (CAJA_WINDOW (new_window)->details->panes)->data); + + return GTK_NOTEBOOK (CAJA_NAVIGATION_WINDOW_PANE (new_pane)->notebook); +} + static gboolean notebook_switch_page_cb (GtkNotebook *notebook, GtkWidget *page, @@ -528,8 +667,14 @@ caja_navigation_window_pane_remove_page (CajaNavigationWindowPane *pane, int pag g_signal_handlers_block_by_func (notebook, G_CALLBACK (notebook_switch_page_cb), pane); + g_signal_handlers_block_by_func (notebook, + G_CALLBACK (notebook_page_removed_cb), + pane); gtk_notebook_remove_page (notebook, page_num); g_signal_handlers_unblock_by_func (notebook, + G_CALLBACK (notebook_page_removed_cb), + pane); + g_signal_handlers_unblock_by_func (notebook, G_CALLBACK (notebook_switch_page_cb), pane); } @@ -543,6 +688,9 @@ caja_navigation_window_pane_add_slot_in_tab (CajaNavigationWindowPane *pane, Caj g_signal_handlers_block_by_func (notebook, G_CALLBACK (notebook_switch_page_cb), pane); + g_signal_handlers_block_by_func (notebook, + G_CALLBACK (notebook_page_added_cb), + pane); caja_notebook_add_tab (notebook, slot, (flags & CAJA_WINDOW_OPEN_SLOT_APPEND) != 0 ? @@ -550,6 +698,9 @@ caja_navigation_window_pane_add_slot_in_tab (CajaNavigationWindowPane *pane, Caj gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)) + 1, FALSE); g_signal_handlers_unblock_by_func (notebook, + G_CALLBACK (notebook_page_added_cb), + pane); + g_signal_handlers_unblock_by_func (notebook, G_CALLBACK (notebook_switch_page_cb), pane); } @@ -754,6 +905,18 @@ caja_navigation_window_pane_setup (CajaNavigationWindowPane *pane) "switch-page", G_CALLBACK (notebook_switch_page_cb), pane); + g_signal_connect (pane->notebook, + "create-window", + G_CALLBACK (notebook_create_window_cb), + pane); + g_signal_connect (pane->notebook, + "page-added", + G_CALLBACK (notebook_page_added_cb), + pane); + g_signal_connect (pane->notebook, + "page-removed", + G_CALLBACK (notebook_page_removed_cb), + pane); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (pane->notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (pane->notebook), FALSE); diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c index 0cdbb1dd..606c0422 100644 --- a/src/caja-navigation-window.c +++ b/src/caja-navigation-window.c @@ -634,6 +634,11 @@ caja_navigation_window_destroy (GtkWidget *object) caja_navigation_window_unset_focus_widget (window); + if (window->details->header_size_group != NULL) + { + g_object_unref (window->details->header_size_group); + window->details->header_size_group = NULL; + } window->sidebar = NULL; g_list_foreach (window->sidebar_panels, (GFunc)g_object_unref, NULL); g_list_free (window->sidebar_panels); diff --git a/src/caja-notebook.c b/src/caja-notebook.c index ded19ead..0d9cd73f 100644 --- a/src/caja-notebook.c +++ b/src/caja-notebook.c @@ -183,6 +183,7 @@ caja_notebook_init (CajaNotebook *notebook) gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE); gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); + gtk_notebook_set_group_name (GTK_NOTEBOOK (notebook), "CajaNotebook"); g_signal_connect (notebook, "button-press-event", (GCallback)button_press_cb, NULL); @@ -373,6 +374,7 @@ caja_notebook_insert_page (GtkNotebook *gnotebook, gtk_notebook_set_show_tabs (gnotebook, gtk_notebook_get_n_pages (gnotebook) > 1); gtk_notebook_set_tab_reorderable (gnotebook, tab_widget, TRUE); + gtk_notebook_set_tab_detachable (gnotebook, tab_widget, TRUE); return position; } diff --git a/src/caja-query-editor.c b/src/caja-query-editor.c index b4f96179..fb49a95f 100644 --- a/src/caja-query-editor.c +++ b/src/caja-query-editor.c @@ -818,6 +818,8 @@ type_combo_changed (GtkComboBox *combo_box, CajaQueryEditorRow *row) -1); type_add_custom_type (row, mimetype, description, &iter); + g_free (description); + g_free (mimetype); gtk_combo_box_set_active_iter (GTK_COMBO_BOX (row->type_widget), &iter); } diff --git a/src/caja-window-manage-views.c b/src/caja-window-manage-views.c index 1ba1a533..f0eb8792 100644 --- a/src/caja-window-manage-views.c +++ b/src/caja-window-manage-views.c @@ -908,6 +908,7 @@ begin_location_change (CajaWindowSlot *slot, CajaDirectory *directory; gboolean force_reload; GFile *parent; + gboolean is_need_free_selection = FALSE; g_assert (slot != NULL); g_assert (location != NULL); @@ -930,6 +931,7 @@ begin_location_change (CajaWindowSlot *slot, parent = g_file_get_parent (from_folder); } if (parent != NULL) { + is_need_free_selection = TRUE; new_selection = g_list_prepend (NULL, g_object_ref(from_folder)); } g_object_unref (from_folder); @@ -1016,6 +1018,12 @@ begin_location_change (CajaWindowSlot *slot, got_file_info_for_view_selection_callback, slot); + // If the externally passed 'new_selection' is NULL, the caller will not unref the content of 'new_selection'. + // In this case, it is necessary to manually unref. + if (is_need_free_selection) + { + g_list_free_full (new_selection, g_object_unref); + } g_object_unref (window); } diff --git a/src/caja-window-slot.c b/src/caja-window-slot.c index dab7c449..2f8050a0 100644 --- a/src/caja-window-slot.c +++ b/src/caja-window-slot.c @@ -183,6 +183,7 @@ caja_window_slot_init (CajaWindowSlot *slot) content_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); slot->content_box = content_box; gtk_widget_show (content_box); + g_object_set_data (G_OBJECT (content_box), "caja-slot", slot); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index c76eefba..11979f89 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -2896,7 +2896,7 @@ process_new_files (FMDirectoryView *view) new_changed_files = g_list_delete_link (new_changed_files, node); old_added_files = g_list_prepend (old_added_files, pending); } - } else if (fm_directory_view_should_show_file (view, pending->file)) { + } else { new_changed_files = g_list_delete_link (new_changed_files, node); old_changed_files = g_list_prepend (old_changed_files, pending); } @@ -5100,6 +5100,7 @@ add_extension_menu_items (FMDirectoryView *view, caja_menu_item_list_free (children); g_free (subdir); + g_object_unref (menu); } } } |
