[gtk/gbsneto/filechooser-column-view: 61/82] filechooserwidget: Remove treeview




commit 6a6a77d8ebc259e90a6f845be5d1b7142b4ca21d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Oct 9 14:16:06 2022 -0300

    filechooserwidget: Remove treeview
    
    Now that most of the treeview usage is gone, remove the remaining
    code that uses it - mostly event handling code, which for now won't
    work, but will be fixed by next commits - and drop the tree view
    entirely.

 gtk/gtkfilechooserwidget.c     | 20 +++++++++---------
 gtk/ui/gtkfilechooserwidget.ui | 46 +++++++++++-------------------------------
 2 files changed, 21 insertions(+), 45 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index f1e7b0538d..2af179c4e6 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -201,7 +201,6 @@ struct _GtkFileChooserWidget
   GtkWidget *browse_header_stack;
   GtkWidget *browse_files_stack;
   GtkWidget *browse_files_swin;
-  GtkWidget *browse_files_tree_view;
   GtkWidget *browse_files_column_view;
   GtkWidget *remote_warning_bar;
 
@@ -1745,8 +1744,8 @@ file_list_show_popover (GtkFileChooserWidget *impl,
   GdkRectangle rect;
   graphene_rect_t bounds;
 
-  if (!gtk_widget_compute_bounds (impl->browse_files_tree_view,
-                                  impl->browse_files_tree_view,
+  if (!gtk_widget_compute_bounds (impl->browse_files_column_view,
+                                  impl->browse_files_column_view,
                                   &bounds))
     return;
 
@@ -1767,8 +1766,8 @@ list_popup_menu_cb (GtkWidget *widget,
   GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (user_data);
   graphene_rect_t bounds;
 
-  if (gtk_widget_compute_bounds (impl->browse_files_tree_view,
-                                 impl->browse_files_tree_view,
+  if (gtk_widget_compute_bounds (impl->browse_files_column_view,
+                                 impl->browse_files_column_view,
                                  &bounds))
     {
       file_list_show_popover (impl, 0.5 * bounds.size.width, 0.5 * bounds.size.height);
@@ -1847,7 +1846,7 @@ click_cb (GtkGesture           *gesture,
 
   pd = g_new (PopoverData, 1);
   pd->impl = impl;
-  gtk_widget_translate_coordinates (impl->browse_files_tree_view,
+  gtk_widget_translate_coordinates (impl->browse_files_column_view,
                                     GTK_WIDGET (impl),
                                     x, y, &x, &y);
   pd->x = x;
@@ -6844,7 +6843,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
   gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, places_sidebar);
   gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, places_view);
   gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_files_column_view);
-  gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_files_tree_view);
   gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_files_swin);
   gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_header_revealer);
   gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_header_stack);
@@ -6976,7 +6974,7 @@ post_process_ui (GtkFileChooserWidget *impl)
   gesture = gtk_gesture_click_new ();
   gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
   g_signal_connect (gesture, "pressed", G_CALLBACK (files_list_clicked), impl);
-  gtk_widget_add_controller (GTK_WIDGET (impl->browse_files_tree_view), GTK_EVENT_CONTROLLER (gesture));
+  gtk_widget_add_controller (GTK_WIDGET (impl->browse_files_column_view), GTK_EVENT_CONTROLLER (gesture));
 
   controller = gtk_shortcut_controller_new ();
   trigger = gtk_alternative_trigger_new (gtk_keyval_trigger_new (GDK_KEY_F10, GDK_SHIFT_MASK),
@@ -6984,7 +6982,7 @@ post_process_ui (GtkFileChooserWidget *impl)
   action = gtk_callback_action_new (list_popup_menu_cb, impl, NULL);
   shortcut = gtk_shortcut_new (trigger, action);
   gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut);
-  gtk_widget_add_controller (GTK_WIDGET (impl->browse_files_tree_view), controller);
+  gtk_widget_add_controller (GTK_WIDGET (impl->browse_files_column_view), controller);
 
   /* Add ability to restrict interaction on file list (click and key_press events),
    * needed to prevent data loss bug #2288 */
@@ -6993,12 +6991,12 @@ post_process_ui (GtkFileChooserWidget *impl)
   gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (gesture), TRUE);
   gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_CAPTURE);
   g_signal_connect (gesture, "pressed", G_CALLBACK (files_list_restrict_clicking), impl);
-  gtk_widget_add_controller (impl->browse_files_tree_view, GTK_EVENT_CONTROLLER (gesture));
+  gtk_widget_add_controller (impl->browse_files_column_view, GTK_EVENT_CONTROLLER (gesture));
 
   controller = gtk_event_controller_key_new ();
   gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
   g_signal_connect (controller, "key-pressed", G_CALLBACK (files_list_restrict_key_presses), impl);
-  gtk_widget_add_controller (impl->browse_files_tree_view, controller);
+  gtk_widget_add_controller (impl->browse_files_column_view, controller);
 }
 
 void
diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui
index b22ad24c81..98cf0c2a49 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -143,6 +143,18 @@
                                           <object class="GtkColumnView" id="browse_files_column_view">
                                             <signal name="activate" handler="column_view_row_activated_cb" 
swapped="no"/>
                                             <signal name="keynav-failed" 
handler="browse_files_column_view_keynav_failed_cb"/>
+                                            <child>
+                                              <object class="GtkGestureLongPress">
+                                                <property name="touch-only">1</property>
+                                                <signal name="pressed" handler="long_press_cb" swapped="no"/>
+                                              </object>
+                                            </child>
+                                            <child>
+                                              <object class="GtkGestureClick">
+                                                <property name="button">3</property>
+                                                <signal name="pressed" handler="click_cb" swapped="no"/>
+                                              </object>
+                                            </child>
 
                                             <child>
                                               <object class="GtkColumnViewColumn" 
id="column_view_name_column">
@@ -361,40 +373,6 @@
                                 </property>
                               </object>
                             </child>
-                            <child>
-                              <object class="GtkStackPage">
-                                <property name="name">list2</property>
-                                <property name="child">
-                                  <object class="GtkBox">
-                                    <property name="orientation">1</property>
-                                    <child>
-                                      <object class="GtkScrolledWindow">
-                                        <property name="hscrollbar-policy">2</property>
-                                        <property name="vexpand">1</property>
-                                        <child>
-                                          <object class="GtkTreeView" id="browse_files_tree_view">
-                                            <property name="has-tooltip">1</property>
-                                            <property name="enable-search">0</property>
-                                            <child>
-                                              <object class="GtkGestureLongPress">
-                                                <property name="touch-only">1</property>
-                                                <signal name="pressed" handler="long_press_cb" swapped="no"/>
-                                              </object>
-                                            </child>
-                                            <child>
-                                              <object class="GtkGestureClick">
-                                                <property name="button">3</property>
-                                                <signal name="pressed" handler="click_cb" swapped="no"/>
-                                              </object>
-                                            </child>
-                                          </object>
-                                        </child>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </property>
-                              </object>
-                            </child>
                             <child>
                               <object class="GtkStackPage">
                                 <property name="name">other_locations</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]