forked from AuroraMiddleware/gtk
Deprecate widget-specific :focus-on-click properties
The differences between the existing properties and the newly added GtkWidget:focus-on-click property are minimal (different owner_type in GParamSpec), so it is extremely unlikely that dropping the former would break anything. https://bugzilla.gnome.org/show_bug.cgi?id=757269
This commit is contained in:
parent
ebdf5f581d
commit
9a29a2768b
@ -99,7 +99,6 @@ enum {
|
||||
PROP_RELIEF,
|
||||
PROP_USE_UNDERLINE,
|
||||
PROP_USE_STOCK,
|
||||
PROP_FOCUS_ON_CLICK,
|
||||
PROP_XALIGN,
|
||||
PROP_YALIGN,
|
||||
PROP_IMAGE_POSITION,
|
||||
@ -282,13 +281,6 @@ gtk_button_class_init (GtkButtonClass *klass)
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED);
|
||||
|
||||
props[PROP_FOCUS_ON_CLICK] =
|
||||
g_param_spec_boolean ("focus-on-click",
|
||||
P_("Focus on click"),
|
||||
P_("Whether the button grabs focus when it is clicked with the mouse"),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
props[PROP_RELIEF] =
|
||||
g_param_spec_enum ("relief",
|
||||
P_("Border relief"),
|
||||
@ -606,7 +598,7 @@ multipress_pressed_cb (GtkGestureMultiPress *gesture,
|
||||
GtkButton *button = GTK_BUTTON (widget);
|
||||
GtkButtonPrivate *priv = button->priv;
|
||||
|
||||
if (priv->focus_on_click && !gtk_widget_has_focus (widget))
|
||||
if (gtk_widget_get_focus_on_click (widget) && !gtk_widget_has_focus (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
||||
priv->in_button = TRUE;
|
||||
@ -688,7 +680,6 @@ gtk_button_init (GtkButton *button)
|
||||
priv->button_down = FALSE;
|
||||
priv->use_stock = FALSE;
|
||||
priv->use_underline = FALSE;
|
||||
priv->focus_on_click = TRUE;
|
||||
|
||||
priv->xalign = 0.5;
|
||||
priv->yalign = 0.5;
|
||||
@ -852,9 +843,6 @@ gtk_button_set_property (GObject *object,
|
||||
gtk_button_set_use_stock (button, g_value_get_boolean (value));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
break;
|
||||
case PROP_FOCUS_ON_CLICK:
|
||||
gtk_button_set_focus_on_click (button, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_XALIGN:
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_button_set_alignment (button, g_value_get_float (value), priv->yalign);
|
||||
@ -915,9 +903,6 @@ gtk_button_get_property (GObject *object,
|
||||
case PROP_USE_STOCK:
|
||||
g_value_set_boolean (value, priv->use_stock);
|
||||
break;
|
||||
case PROP_FOCUS_ON_CLICK:
|
||||
g_value_set_boolean (value, priv->focus_on_click);
|
||||
break;
|
||||
case PROP_XALIGN:
|
||||
g_value_set_float (value, priv->xalign);
|
||||
break;
|
||||
@ -2390,20 +2375,9 @@ void
|
||||
gtk_button_set_focus_on_click (GtkButton *button,
|
||||
gboolean focus_on_click)
|
||||
{
|
||||
GtkButtonPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_BUTTON (button));
|
||||
|
||||
priv = button->priv;
|
||||
|
||||
focus_on_click = focus_on_click != FALSE;
|
||||
|
||||
if (priv->focus_on_click != focus_on_click)
|
||||
{
|
||||
priv->focus_on_click = focus_on_click;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (button), props[PROP_FOCUS_ON_CLICK]);
|
||||
}
|
||||
gtk_widget_set_focus_on_click (GTK_WIDGET (button), focus_on_click);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2423,7 +2397,7 @@ gtk_button_get_focus_on_click (GtkButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_BUTTON (button), FALSE);
|
||||
|
||||
return button->priv->focus_on_click;
|
||||
return gtk_widget_get_focus_on_click (GTK_WIDGET (button));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,10 +134,10 @@ void gtk_button_set_use_stock (GtkButton *button,
|
||||
gboolean use_stock);
|
||||
GDK_DEPRECATED_IN_3_10
|
||||
gboolean gtk_button_get_use_stock (GtkButton *button);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_set_focus_on_click)
|
||||
void gtk_button_set_focus_on_click (GtkButton *button,
|
||||
gboolean focus_on_click);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_get_focus_on_click)
|
||||
gboolean gtk_button_get_focus_on_click (GtkButton *button);
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
void gtk_button_set_alignment (GtkButton *button,
|
||||
|
@ -53,7 +53,6 @@ struct _GtkButtonPrivate
|
||||
guint align_set : 1;
|
||||
guint button_down : 1;
|
||||
guint constructed : 1;
|
||||
guint focus_on_click : 1;
|
||||
guint image_is_stock : 1;
|
||||
guint in_button : 1;
|
||||
guint use_action_appearance : 1;
|
||||
|
@ -148,7 +148,6 @@ struct _GtkComboBoxPrivate
|
||||
guint is_cell_renderer : 1;
|
||||
guint editing_canceled : 1;
|
||||
guint auto_scroll : 1;
|
||||
guint focus_on_click : 1;
|
||||
guint button_sensitivity : 2;
|
||||
guint has_entry : 1;
|
||||
guint popup_fixed_width : 1;
|
||||
@ -228,7 +227,6 @@ enum {
|
||||
PROP_ADD_TEAROFFS,
|
||||
PROP_TEAROFF_TITLE,
|
||||
PROP_HAS_FRAME,
|
||||
PROP_FOCUS_ON_CLICK,
|
||||
PROP_POPUP_SHOWN,
|
||||
PROP_BUTTON_SENSITIVITY,
|
||||
PROP_EDITING_CANCELED,
|
||||
@ -843,14 +841,6 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_FOCUS_ON_CLICK,
|
||||
g_param_spec_boolean ("focus-on-click",
|
||||
P_("Focus on click"),
|
||||
P_("Whether the combo box grabs focus when it is clicked with the mouse"),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkComboBox:tearoff-title:
|
||||
*
|
||||
@ -1118,7 +1108,6 @@ gtk_combo_box_init (GtkComboBox *combo_box)
|
||||
priv->is_cell_renderer = FALSE;
|
||||
priv->editing_canceled = FALSE;
|
||||
priv->auto_scroll = FALSE;
|
||||
priv->focus_on_click = TRUE;
|
||||
priv->button_sensitivity = GTK_SENSITIVITY_AUTO;
|
||||
priv->has_entry = FALSE;
|
||||
priv->popup_fixed_width = TRUE;
|
||||
@ -1185,11 +1174,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_FOCUS_ON_CLICK:
|
||||
gtk_combo_box_set_focus_on_click (combo_box,
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_TEAROFF_TITLE:
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
gtk_combo_box_set_title (combo_box, g_value_get_string (value));
|
||||
@ -1300,10 +1284,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
g_value_set_boolean (value, combo_box->priv->has_frame);
|
||||
break;
|
||||
|
||||
case PROP_FOCUS_ON_CLICK:
|
||||
g_value_set_boolean (value, combo_box->priv->focus_on_click);
|
||||
break;
|
||||
|
||||
case PROP_TEAROFF_TITLE:
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
g_value_set_string (value, gtk_combo_box_get_title (combo_box));
|
||||
@ -2925,7 +2905,7 @@ gtk_combo_box_menu_button_press (GtkWidget *widget,
|
||||
if (GTK_IS_MENU (priv->popup_widget) &&
|
||||
event->type == GDK_BUTTON_PRESS && event->button == GDK_BUTTON_PRIMARY)
|
||||
{
|
||||
if (priv->focus_on_click &&
|
||||
if (gtk_widget_get_focus_on_click (GTK_WIDGET (combo_box)) &&
|
||||
!gtk_widget_has_focus (priv->button))
|
||||
gtk_widget_grab_focus (priv->button);
|
||||
|
||||
@ -3259,7 +3239,7 @@ gtk_combo_box_list_button_pressed (GtkWidget *widget,
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button)))
|
||||
return FALSE;
|
||||
|
||||
if (priv->focus_on_click &&
|
||||
if (gtk_widget_get_focus_on_click (GTK_WIDGET (combo_box)) &&
|
||||
!gtk_widget_has_focus (priv->button))
|
||||
gtk_widget_grab_focus (priv->button);
|
||||
|
||||
@ -5006,18 +4986,7 @@ gtk_combo_box_set_focus_on_click (GtkComboBox *combo_box,
|
||||
{
|
||||
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
|
||||
|
||||
focus_on_click = focus_on_click != FALSE;
|
||||
|
||||
if (combo_box->priv->focus_on_click != focus_on_click)
|
||||
{
|
||||
combo_box->priv->focus_on_click = focus_on_click;
|
||||
|
||||
if (combo_box->priv->button)
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (combo_box->priv->button),
|
||||
focus_on_click);
|
||||
|
||||
g_object_notify (G_OBJECT (combo_box), "focus-on-click");
|
||||
}
|
||||
gtk_widget_set_focus_on_click (GTK_WIDGET (combo_box), focus_on_click);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5037,7 +5006,7 @@ gtk_combo_box_get_focus_on_click (GtkComboBox *combo_box)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), FALSE);
|
||||
|
||||
return combo_box->priv->focus_on_click;
|
||||
return gtk_widget_get_focus_on_click (GTK_WIDGET (combo_box));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -119,9 +119,9 @@ GDK_DEPRECATED_IN_3_10
|
||||
void gtk_combo_box_set_title (GtkComboBox *combo_box,
|
||||
const gchar *title);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_get_focus_on_click)
|
||||
gboolean gtk_combo_box_get_focus_on_click (GtkComboBox *combo);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_set_focus_on_click)
|
||||
void gtk_combo_box_set_focus_on_click (GtkComboBox *combo,
|
||||
gboolean focus_on_click);
|
||||
|
||||
|
@ -116,7 +116,6 @@ enum
|
||||
PROP_0,
|
||||
|
||||
PROP_DIALOG,
|
||||
PROP_FOCUS_ON_CLICK,
|
||||
PROP_TITLE,
|
||||
PROP_WIDTH_CHARS
|
||||
};
|
||||
@ -205,8 +204,6 @@ struct _GtkFileChooserButtonPrivate
|
||||
/* Used for hiding/showing the dialog when the button is hidden */
|
||||
guint active : 1;
|
||||
|
||||
guint focus_on_click : 1;
|
||||
|
||||
/* Whether the next async callback from GIO should emit the "selection-changed" signal */
|
||||
guint is_changing_selection : 1;
|
||||
};
|
||||
@ -418,22 +415,6 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
|
||||
(GTK_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY)));
|
||||
|
||||
/**
|
||||
* GtkFileChooserButton:focus-on-click:
|
||||
*
|
||||
* Whether the #GtkFileChooserButton button grabs focus when it is clicked
|
||||
* with the mouse.
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_FOCUS_ON_CLICK,
|
||||
g_param_spec_boolean ("focus-on-click",
|
||||
P_("Focus on click"),
|
||||
P_("Whether the button grabs focus when it is clicked with the mouse"),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkFileChooserButton:title:
|
||||
*
|
||||
@ -491,7 +472,6 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
|
||||
priv = button->priv = gtk_file_chooser_button_get_instance_private (button);
|
||||
|
||||
priv->icon_size = FALLBACK_ICON_SIZE;
|
||||
priv->focus_on_click = TRUE;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (button));
|
||||
|
||||
@ -885,9 +865,6 @@ gtk_file_chooser_button_set_property (GObject *object,
|
||||
/* Construct-only */
|
||||
priv->dialog = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_FOCUS_ON_CLICK:
|
||||
gtk_file_chooser_button_set_focus_on_click (button, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_WIDTH_CHARS:
|
||||
gtk_file_chooser_button_set_width_chars (GTK_FILE_CHOOSER_BUTTON (object),
|
||||
g_value_get_int (value));
|
||||
@ -974,10 +951,6 @@ gtk_file_chooser_button_get_property (GObject *object,
|
||||
g_value_set_int (value,
|
||||
gtk_label_get_width_chars (GTK_LABEL (priv->label)));
|
||||
break;
|
||||
case PROP_FOCUS_ON_CLICK:
|
||||
g_value_set_boolean (value,
|
||||
gtk_file_chooser_button_get_focus_on_click (button));
|
||||
break;
|
||||
|
||||
case PROP_TITLE:
|
||||
case GTK_FILE_CHOOSER_PROP_ACTION:
|
||||
@ -3063,18 +3036,7 @@ gtk_file_chooser_button_set_focus_on_click (GtkFileChooserButton *button,
|
||||
|
||||
g_return_if_fail (GTK_IS_FILE_CHOOSER_BUTTON (button));
|
||||
|
||||
priv = button->priv;
|
||||
|
||||
focus_on_click = focus_on_click != FALSE;
|
||||
|
||||
if (priv->focus_on_click != focus_on_click)
|
||||
{
|
||||
priv->focus_on_click = focus_on_click;
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (priv->button), focus_on_click);
|
||||
gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (priv->combo_box), focus_on_click);
|
||||
|
||||
g_object_notify (G_OBJECT (button), "focus-on-click");
|
||||
}
|
||||
gtk_widget_set_focus_on_click (GTK_WIDGET (button), focus_on_click);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3094,5 +3056,5 @@ gtk_file_chooser_button_get_focus_on_click (GtkFileChooserButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_FILE_CHOOSER_BUTTON (button), FALSE);
|
||||
|
||||
return button->priv->focus_on_click;
|
||||
return gtk_widget_get_focus_on_click (GTK_WIDGET (button));
|
||||
}
|
||||
|
@ -87,9 +87,9 @@ gint gtk_file_chooser_button_get_width_chars (GtkFileChooserBu
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_file_chooser_button_set_width_chars (GtkFileChooserButton *button,
|
||||
gint n_chars);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_get_focus_on_click)
|
||||
gboolean gtk_file_chooser_button_get_focus_on_click (GtkFileChooserButton *button);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_set_focus_on_click)
|
||||
void gtk_file_chooser_button_set_focus_on_click (GtkFileChooserButton *button,
|
||||
gboolean focus_on_click);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user