mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
Merge branch 'wip/baedert/filechooser2' into 'master'
Assorted filechooser improvements See merge request GNOME/gtk!783
This commit is contained in:
commit
34974a8a66
@ -153,16 +153,6 @@ gtk_color_button_measure (GtkWidget *widget,
|
||||
minimum_baseline, natural_baseline);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_button_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkColorButton *button = GTK_COLOR_BUTTON (widget);
|
||||
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
|
||||
|
||||
gtk_widget_snapshot_child (widget, priv->button, snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_button_size_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
@ -193,7 +183,6 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
|
||||
gobject_class->set_property = gtk_color_button_set_property;
|
||||
gobject_class->finalize = gtk_color_button_finalize;
|
||||
|
||||
widget_class->snapshot = gtk_color_button_snapshot;
|
||||
widget_class->measure = gtk_color_button_measure;
|
||||
widget_class->size_allocate = gtk_color_button_size_allocate;
|
||||
klass->color_set = NULL;
|
||||
|
@ -556,8 +556,6 @@ static void list_row_activated (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
GtkFileChooserWidget *impl);
|
||||
static void list_cursor_changed (GtkTreeView *treeview,
|
||||
GtkFileChooserWidget *impl);
|
||||
|
||||
static void path_bar_clicked (GtkPathBar *path_bar,
|
||||
GFile *file,
|
||||
@ -1260,13 +1258,10 @@ places_sidebar_show_error_message_cb (GtkPlacesSidebar *sidebar,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
key_is_left_or_right (const GdkEvent *event)
|
||||
key_is_left_or_right (guint keyval,
|
||||
guint state)
|
||||
{
|
||||
guint modifiers, keyval, state;
|
||||
|
||||
if (!gdk_event_get_keyval (event, &keyval) ||
|
||||
!gdk_event_get_state (event, &state))
|
||||
return FALSE;
|
||||
guint modifiers;
|
||||
|
||||
modifiers = gtk_accelerator_get_default_mod_mask ();
|
||||
|
||||
@ -1327,11 +1322,8 @@ key_press_cb (GtkEventControllerKey *controller,
|
||||
{
|
||||
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) data;
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
const GdkEvent *event;
|
||||
const char *string;
|
||||
|
||||
event = gtk_get_current_event ();
|
||||
|
||||
if (should_trigger_location_entry (impl, keyval, state, &string) &&
|
||||
(priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER))
|
||||
@ -1340,7 +1332,7 @@ key_press_cb (GtkEventControllerKey *controller,
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
|
||||
if (key_is_left_or_right (event))
|
||||
if (key_is_left_or_right (keyval, state))
|
||||
{
|
||||
if (gtk_widget_child_focus (priv->places_sidebar, GTK_DIR_LEFT))
|
||||
return GDK_EVENT_STOP;
|
||||
@ -1396,11 +1388,8 @@ widget_key_press_cb (GtkEventControllerKey *controller,
|
||||
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) data;
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
gboolean handled = FALSE;
|
||||
GdkEvent *event;
|
||||
const char *string;
|
||||
|
||||
event = gtk_get_current_event ();
|
||||
|
||||
if (should_trigger_location_entry (impl, keyval, state, &string))
|
||||
{
|
||||
if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
|
||||
@ -1423,8 +1412,6 @@ widget_key_press_cb (GtkEventControllerKey *controller,
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (event);
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
@ -7005,10 +6992,6 @@ search_engine_hits_added_cb (GtkSearchEngine *engine,
|
||||
{
|
||||
GList *l, *files, *files_with_info, *infos;
|
||||
GFile *file;
|
||||
gboolean select = FALSE;
|
||||
|
||||
if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (impl->priv->search_model), NULL) == 0)
|
||||
select = TRUE;
|
||||
|
||||
files = NULL;
|
||||
files_with_info = NULL;
|
||||
@ -7036,8 +7019,6 @@ search_engine_hits_added_cb (GtkSearchEngine *engine,
|
||||
g_list_free_full (infos, g_object_unref);
|
||||
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (impl->priv->browse_files_stack), "list");
|
||||
if (select)
|
||||
gtk_widget_grab_focus (impl->priv->browse_files_tree_view);
|
||||
}
|
||||
|
||||
/* Callback used from GtkSearchEngine when the query is done running */
|
||||
@ -7697,6 +7678,24 @@ list_cursor_changed (GtkTreeView *list,
|
||||
check_preview_change (impl);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
browse_files_tree_view_keynav_failed_cb (GtkWidget *widget,
|
||||
GtkDirectionType direction,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFileChooserWidget *self = user_data;
|
||||
GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (self);
|
||||
|
||||
if (direction == GTK_DIR_UP && priv->operation_mode == OPERATION_MODE_SEARCH)
|
||||
{
|
||||
gtk_widget_grab_focus (priv->search_entry);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Callback used when a row in the file list is activated */
|
||||
static void
|
||||
list_row_activated (GtkTreeView *tree_view,
|
||||
@ -8424,6 +8423,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
gtk_widget_class_bind_template_callback (widget_class, file_list_drag_end_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, list_selection_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, list_cursor_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, browse_files_tree_view_keynav_failed_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, filter_combo_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, path_bar_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, places_sidebar_open_location_cb);
|
||||
|
@ -9394,16 +9394,12 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
|
||||
GtkTreeRBTree *new_cursor_tree = NULL;
|
||||
GtkTreeRBNode *new_cursor_node = NULL;
|
||||
GtkTreePath *cursor_path = NULL;
|
||||
gboolean grab_focus = TRUE;
|
||||
gboolean selectable;
|
||||
GtkDirectionType direction;
|
||||
GtkCellArea *cell_area = NULL;
|
||||
GtkCellRenderer *last_focus_cell = NULL;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (! gtk_widget_has_focus (GTK_WIDGET (tree_view)))
|
||||
return;
|
||||
|
||||
if (tree_view->priv->cursor_node == NULL)
|
||||
return;
|
||||
|
||||
@ -9529,8 +9525,6 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
|
||||
count < 0 ?
|
||||
GTK_DIR_TAB_BACKWARD :
|
||||
GTK_DIR_TAB_FORWARD);
|
||||
|
||||
grab_focus = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -9541,9 +9535,6 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
|
||||
if (cell_area)
|
||||
gtk_cell_area_set_focus_cell (cell_area, last_focus_cell);
|
||||
}
|
||||
|
||||
if (grab_focus)
|
||||
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -6524,6 +6524,9 @@ gtk_window_set_focus (GtkWindow *window,
|
||||
if (focus && !gtk_widget_is_sensitive (focus))
|
||||
return;
|
||||
|
||||
if (focus == priv->focus_widget)
|
||||
return;
|
||||
|
||||
if (priv->focus_widget)
|
||||
old_focus = g_object_ref (priv->focus_widget);
|
||||
g_set_object (&priv->focus_widget, NULL);
|
||||
|
@ -3875,6 +3875,10 @@ filechooser {
|
||||
#pathbarbox { border-bottom: 1px solid $bg_color; }
|
||||
}
|
||||
|
||||
|
||||
filechooserbutton>button>box {
|
||||
border-spacing: 6px;
|
||||
}
|
||||
filechooserbutton:drop(active) {
|
||||
box-shadow: none;
|
||||
border-color: transparent;
|
||||
|
@ -1695,6 +1695,8 @@ filechooser .dialog-action-box:backdrop { border-top-color: #202020; }
|
||||
|
||||
filechooser #pathbarbox { border-bottom: 1px solid #353535; }
|
||||
|
||||
filechooserbutton > button > box { border-spacing: 6px; }
|
||||
|
||||
filechooserbutton:drop(active) { box-shadow: none; border-color: transparent; }
|
||||
|
||||
/*********** Sidebar * */
|
||||
|
@ -1711,6 +1711,8 @@ filechooser .dialog-action-box:backdrop { border-top-color: #d5d0cc; }
|
||||
|
||||
filechooser #pathbarbox { border-bottom: 1px solid #f6f5f4; }
|
||||
|
||||
filechooserbutton > button > box { border-spacing: 6px; }
|
||||
|
||||
filechooserbutton:drop(active) { box-shadow: none; border-color: transparent; }
|
||||
|
||||
/*********** Sidebar * */
|
||||
|
@ -85,10 +85,9 @@
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">search</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox" id="search_entry_box">
|
||||
<property name="spacing">6</property>
|
||||
<object class="GtkCenterBox" id="search_entry_box">
|
||||
<property name="margin">6</property>
|
||||
<child>
|
||||
<child type="center">
|
||||
<object class="GtkSearchEntry" id="search_entry">
|
||||
<property name="width-chars">45</property>
|
||||
<property name="hexpand">1</property>
|
||||
@ -97,7 +96,7 @@
|
||||
<signal name="stop-search" handler="search_entry_stop_cb" swapped="yes"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkSpinner" id="search_spinner">
|
||||
<property name="visible">0</property>
|
||||
</object>
|
||||
@ -168,6 +167,7 @@
|
||||
<signal name="query-tooltip" handler="file_list_query_tooltip_cb" swapped="no"/>
|
||||
<signal name="row-activated" handler="list_row_activated" swapped="no"/>
|
||||
<signal name="cursor-changed" handler="list_cursor_changed" swapped="no"/>
|
||||
<signal name="keynav-failed" handler="browse_files_tree_view_keynav_failed_cb" />
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection2">
|
||||
<signal name="changed" handler="list_selection_changed" swapped="no"/>
|
||||
|
Loading…
Reference in New Issue
Block a user