]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkfilechooserdefault.c
textview: Use GtkSelectionWindow for touch text selection
[~andy/gtk] / gtk / gtkfilechooserdefault.c
index 3f900986f16d5f440bc3f6dcedc3b0ddcd903479..498efd135d717907af781658c4c8758a055ab3ba 100644 (file)
@@ -281,8 +281,6 @@ static void     gtk_file_chooser_default_hierarchy_changed (GtkWidget          *
 static void     gtk_file_chooser_default_style_updated  (GtkWidget             *widget);
 static void     gtk_file_chooser_default_screen_changed (GtkWidget             *widget,
                                                         GdkScreen             *previous_screen);
-static void     gtk_file_chooser_default_size_allocate  (GtkWidget             *widget,
-                                                        GtkAllocation         *allocation);
 
 static gboolean       gtk_file_chooser_default_set_current_folder         (GtkFileChooser    *chooser,
                                                                            GFile             *folder,
@@ -394,7 +392,7 @@ static void remove_bookmark_button_clicked_cb (GtkButton             *button,
 
 static void update_cell_renderer_attributes (GtkFileChooserDefault *impl);
 
-static void load_remove_timer (GtkFileChooserDefault *impl);
+static void load_remove_timer (GtkFileChooserDefault *impl, LoadState new_load_state);
 static void browse_files_center_selected_row (GtkFileChooserDefault *impl);
 
 static void location_button_toggled_cb (GtkToggleButton *toggle,
@@ -505,7 +503,6 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
   widget_class->hierarchy_changed = gtk_file_chooser_default_hierarchy_changed;
   widget_class->style_updated = gtk_file_chooser_default_style_updated;
   widget_class->screen_changed = gtk_file_chooser_default_screen_changed;
-  widget_class->size_allocate = gtk_file_chooser_default_size_allocate;
 
   signals[LOCATION_POPUP] =
     g_signal_new_class_handler (I_("location-popup"),
@@ -5723,18 +5720,6 @@ cancel_all_operations (GtkFileChooserDefault *impl)
 
   pending_select_files_free (impl);
 
-  /* cancel all pending operations */
-  if (impl->pending_cancellables)
-    {
-      for (l = impl->pending_cancellables; l; l = l->next)
-        {
-         GCancellable *cancellable = G_CANCELLABLE (l->data);
-         g_cancellable_cancel (cancellable);
-        }
-      g_slist_free (impl->pending_cancellables);
-      impl->pending_cancellables = NULL;
-    }
-
   if (impl->reload_icon_cancellables)
     {
       for (l = impl->reload_icon_cancellables; l; l = l->next)
@@ -5775,6 +5760,12 @@ cancel_all_operations (GtkFileChooserDefault *impl)
       impl->should_respond_get_info_cancellable = NULL;
     }
 
+  if (impl->file_exists_get_info_cancellable)
+    {
+      g_cancellable_cancel (impl->file_exists_get_info_cancellable);
+      impl->file_exists_get_info_cancellable = NULL;
+    }
+
   if (impl->update_from_entry_cancellable)
     {
       g_cancellable_cancel (impl->update_from_entry_cancellable);
@@ -6003,13 +5994,6 @@ gtk_file_chooser_default_screen_changed (GtkWidget *widget,
   profile_end ("end", NULL);
 }
 
-static void
-gtk_file_chooser_default_size_allocate (GtkWidget     *widget,
-                                        GtkAllocation *allocation)
-{
-  GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->size_allocate (widget, allocation);
-}
-
 static void
 set_sort_column (GtkFileChooserDefault *impl)
 {
@@ -6332,9 +6316,9 @@ load_setup_timer (GtkFileChooserDefault *impl)
   impl->load_state = LOAD_PRELOAD;
 }
 
-/* Removes the load timeout and switches to the LOAD_FINISHED state */
+/* Removes the load timeout; changes the impl->load_state to the specified value. */
 static void
-load_remove_timer (GtkFileChooserDefault *impl)
+load_remove_timer (GtkFileChooserDefault *impl, LoadState new_load_state)
 {
   if (impl->load_timeout_id != 0)
     {
@@ -6342,12 +6326,16 @@ load_remove_timer (GtkFileChooserDefault *impl)
 
       g_source_remove (impl->load_timeout_id);
       impl->load_timeout_id = 0;
-      impl->load_state = LOAD_EMPTY;
     }
   else
     g_assert (impl->load_state == LOAD_EMPTY ||
              impl->load_state == LOAD_LOADING ||
              impl->load_state == LOAD_FINISHED);
+
+  g_assert (new_load_state == LOAD_EMPTY ||
+           new_load_state == LOAD_LOADING ||
+           new_load_state == LOAD_FINISHED);
+  impl->load_state = new_load_state;
 }
 
 /* Selects the first row in the file list */
@@ -6420,9 +6408,14 @@ show_and_select_files (GtkFileChooserDefault *impl,
   gboolean selected_a_file;
   GSList *walk;
 
+  g_assert (impl->load_state == LOAD_FINISHED);
+  g_assert (impl->browse_files_model != NULL);
+
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
   fsmodel = GTK_FILE_SYSTEM_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)));
 
+  g_assert (fsmodel == impl->browse_files_model);
+
   enabled_hidden = impl->show_hidden;
   removed_filters = (impl->current_filter == NULL);
 
@@ -6557,7 +6550,7 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel    *model,
 
   if (impl->load_state == LOAD_PRELOAD)
     {
-      load_remove_timer (impl);
+      load_remove_timer (impl, LOAD_FINISHED);
       load_set_model (impl);
     }
   else if (impl->load_state == LOAD_LOADING)
@@ -6590,7 +6583,7 @@ static void
 stop_loading_and_clear_list_model (GtkFileChooserDefault *impl,
                                    gboolean remove_from_treeview)
 {
-  load_remove_timer (impl); /* This changes the state to LOAD_EMPTY */
+  load_remove_timer (impl, LOAD_EMPTY);
   
   if (impl->browse_files_model)
     {