Update upstream
This commit is contained in:
@ -104,6 +104,8 @@ static void pika_action_proxy_button_activate (GtkButton *button,
|
||||
|
||||
static void pika_action_update_proxy_sensitive (PikaAction *action,
|
||||
GtkWidget *proxy);
|
||||
static void pika_action_update_proxy_visible (PikaAction *action,
|
||||
GtkWidget *proxy);
|
||||
static void pika_action_update_proxy_tooltip (PikaAction *action,
|
||||
GtkWidget *proxy);
|
||||
|
||||
@ -446,9 +448,20 @@ void
|
||||
pika_action_set_visible (PikaAction *action,
|
||||
gboolean visible)
|
||||
{
|
||||
g_object_set (action,
|
||||
"visible", visible,
|
||||
NULL);
|
||||
PikaActionPrivate *priv = GET_PRIVATE (action);
|
||||
|
||||
/* Only notify when the state actually changed. This is important for
|
||||
* handlers such as visibility of menu items in PikaMenuModel which
|
||||
* will assume that the action visibility changed. Otherwise we might
|
||||
* remove items by mistake.
|
||||
*/
|
||||
if (priv->visible != visible)
|
||||
{
|
||||
priv->visible = visible;
|
||||
|
||||
pika_action_update_proxy_visible (action, NULL);
|
||||
g_object_notify (G_OBJECT (action), "visible");
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -929,16 +942,8 @@ pika_action_set_property (GObject *object,
|
||||
NULL);
|
||||
break;
|
||||
case PIKA_ACTION_PROP_VISIBLE:
|
||||
if (priv->visible != g_value_get_boolean (value))
|
||||
{
|
||||
priv->visible = g_value_get_boolean (value);
|
||||
/* Only notify when the state actually changed. This is important for
|
||||
* handlers such as visibility of menu items in PikaMenuModel which
|
||||
* will assume that the action visibility changed. Otherwise we might
|
||||
* remove items by mistake.
|
||||
*/
|
||||
g_object_notify (object, "visible");
|
||||
}
|
||||
pika_action_set_visible (PIKA_ACTION (object),
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PIKA_ACTION_PROP_LABEL:
|
||||
@ -1391,6 +1396,24 @@ pika_action_update_proxy_sensitive (PikaAction *action,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pika_action_update_proxy_visible (PikaAction *action,
|
||||
GtkWidget *proxy)
|
||||
{
|
||||
PikaActionPrivate *priv = GET_PRIVATE (action);
|
||||
gboolean visible = pika_action_is_visible (action);
|
||||
|
||||
if (proxy)
|
||||
{
|
||||
gtk_widget_set_visible (proxy, visible);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (GList *list = priv->proxies; list; list = list->next)
|
||||
gtk_widget_set_visible (list->data, visible);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pika_action_update_proxy_tooltip (PikaAction *action,
|
||||
GtkWidget *proxy)
|
||||
|
@ -102,10 +102,6 @@ static void pika_container_tree_view_set_view_size (PikaContainerVi
|
||||
|
||||
static void pika_container_tree_view_real_edit_name (PikaContainerTreeView *tree_view);
|
||||
|
||||
static void pika_container_tree_view_selection_label_notify (GtkLabel *label,
|
||||
GParamSpec *pspec,
|
||||
PikaItemTreeView *view);
|
||||
|
||||
static gboolean pika_container_tree_view_edit_focus_out (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data);
|
||||
@ -296,12 +292,6 @@ pika_container_tree_view_constructed (GObject *object)
|
||||
gtk_label_set_selectable (GTK_LABEL (tree_view->priv->multi_selection_label), TRUE);
|
||||
gtk_tree_view_column_set_widget (tree_view->main_column,
|
||||
tree_view->priv->multi_selection_label);
|
||||
g_signal_connect (tree_view->priv->multi_selection_label, "notify::label",
|
||||
G_CALLBACK (pika_container_tree_view_selection_label_notify),
|
||||
tree_view);
|
||||
g_signal_connect (tree_view->priv->multi_selection_label, "notify::selection-bound",
|
||||
G_CALLBACK (pika_container_tree_view_selection_label_notify),
|
||||
tree_view);
|
||||
gtk_widget_show (tree_view->priv->multi_selection_label);
|
||||
gtk_tree_view_insert_column (tree_view->view, tree_view->main_column, 0);
|
||||
|
||||
@ -1204,20 +1194,6 @@ pika_container_tree_view_real_edit_name (PikaContainerTreeView *tree_view)
|
||||
|
||||
/* callbacks */
|
||||
|
||||
static void
|
||||
pika_container_tree_view_selection_label_notify (GtkLabel *label,
|
||||
GParamSpec *pspec,
|
||||
PikaItemTreeView *view)
|
||||
{
|
||||
/* This is a weird trick to make the label follow the color scheme of
|
||||
* selected items in whatever theme is selected. It seems we cannot
|
||||
* link to the color of another widget whose theme we don't control.
|
||||
* Faking selection is the only way I found, though it is quite ugly
|
||||
* semantically.
|
||||
*/
|
||||
gtk_label_select_region (label, 0, -1);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pika_container_tree_view_edit_focus_out (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
@ -1354,10 +1330,12 @@ pika_container_tree_view_button (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
PikaContainerTreeView *tree_view)
|
||||
{
|
||||
PikaContainerView *container_view = PIKA_CONTAINER_VIEW (tree_view);
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreePath *path;
|
||||
gboolean handled = TRUE;
|
||||
PikaContainerView *container_view = PIKA_CONTAINER_VIEW (tree_view);
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreePath *path;
|
||||
gboolean handled = TRUE;
|
||||
GtkCellRenderer *toggled_cell = NULL;
|
||||
PikaCellRendererViewable *clicked_cell = NULL;
|
||||
|
||||
tree_view->priv->dnd_renderer = NULL;
|
||||
|
||||
@ -1366,8 +1344,6 @@ pika_container_tree_view_button (GtkWidget *widget,
|
||||
&path, &column, NULL, NULL))
|
||||
{
|
||||
PikaViewRenderer *renderer;
|
||||
GtkCellRenderer *toggled_cell = NULL;
|
||||
PikaCellRendererViewable *clicked_cell = NULL;
|
||||
GtkCellRenderer *edit_cell = NULL;
|
||||
GdkRectangle column_area;
|
||||
GtkTreeIter iter;
|
||||
@ -1389,15 +1365,21 @@ pika_container_tree_view_button (GtkWidget *widget,
|
||||
multisel_mode = FALSE;
|
||||
}
|
||||
|
||||
/* We need to grab focus after a button click, in order to make keyboard
|
||||
* navigation possible. For multi-selection though, actual selection will
|
||||
* happen in pika_container_tree_view_selection_changed() but the widget
|
||||
* must already be focused or the handler won't run.
|
||||
* Whereas for single selection, grab must happen after we changed the
|
||||
* selection (which will happen in this function) otherwise we end up
|
||||
* first scrolling to the current selection. So we have a separate
|
||||
* gtk_widget_grab_focus() at the end of the function.
|
||||
* See also commit 3e101922 and MR !1128.
|
||||
/* We need to grab focus at button click, in order to make keyboard
|
||||
* navigation possible; yet the timing matters:
|
||||
* 1. For multi-selection, actual selection will happen in
|
||||
* pika_container_tree_view_selection_changed() but the widget
|
||||
* must already be focused or the handler won't run. So we grab first.
|
||||
* 2. For toggled and clicked cells, we must also grab first (see code
|
||||
* below), and absolutely not in the end, because some toggle cells may
|
||||
* trigger a popup (and the grab on the source widget would close the
|
||||
* popup).
|
||||
* 3. Finally for single selection, grab must happen after we changed
|
||||
* the selection (which will happen in this function) otherwise we
|
||||
* end up first scrolling to the current selection.
|
||||
* This is why we have a few separate calls to gtk_widget_grab_focus()
|
||||
* in this function.
|
||||
* See also commit 3e101922, MR !1128 and #10281.
|
||||
*/
|
||||
if (multisel_mode && bevent->type == GDK_BUTTON_PRESS && ! gtk_widget_has_focus (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
@ -1524,6 +1506,10 @@ pika_container_tree_view_button (GtkWidget *widget,
|
||||
column, &column_area,
|
||||
bevent->x, bevent->y);
|
||||
|
||||
if ((toggled_cell || clicked_cell) &&
|
||||
bevent->type == GDK_BUTTON_PRESS && ! gtk_widget_has_focus (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
||||
if (! toggled_cell && ! clicked_cell)
|
||||
{
|
||||
edit_cell =
|
||||
@ -1720,7 +1706,8 @@ pika_container_tree_view_button (GtkWidget *widget,
|
||||
handled = TRUE;
|
||||
}
|
||||
|
||||
if (handled && bevent->type == GDK_BUTTON_PRESS && ! gtk_widget_has_focus (widget))
|
||||
if (handled && bevent->type == GDK_BUTTON_PRESS && ! gtk_widget_has_focus (widget) &&
|
||||
! toggled_cell && ! clicked_cell)
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
||||
return handled;
|
||||
|
@ -46,6 +46,9 @@ static void pika_image_editor_real_set_image (PikaImageEditor *editor,
|
||||
static void pika_image_editor_image_flush (PikaImage *image,
|
||||
gboolean invalidate_preview,
|
||||
PikaImageEditor *editor);
|
||||
static gboolean
|
||||
pika_image_editor_image_flush_idle
|
||||
(gpointer user_data);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (PikaImageEditor, pika_image_editor, PIKA_TYPE_EDITOR,
|
||||
@ -177,7 +180,19 @@ pika_image_editor_image_flush (PikaImage *image,
|
||||
gboolean invalidate_preview,
|
||||
PikaImageEditor *editor)
|
||||
{
|
||||
g_idle_add_full (G_PRIORITY_LOW,
|
||||
(GSourceFunc) pika_image_editor_image_flush_idle,
|
||||
g_object_ref (editor), g_object_unref);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pika_image_editor_image_flush_idle (gpointer user_data)
|
||||
{
|
||||
PikaImageEditor *editor = user_data;
|
||||
|
||||
if (pika_editor_get_ui_manager (PIKA_EDITOR (editor)))
|
||||
pika_ui_manager_update (pika_editor_get_ui_manager (PIKA_EDITOR (editor)),
|
||||
pika_editor_get_popup_data (PIKA_EDITOR (editor)));
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
@ -1224,6 +1224,8 @@ pika_layer_tree_view_floating_selection_changed (PikaImage *image,
|
||||
g_list_free (all_layers);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (layer_view->priv->link_button, ! floating_sel);
|
||||
|
||||
pika_layer_tree_view_update_highlight (layer_view);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user