diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index a8983ea434..9d17aab5bc 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -251,31 +251,13 @@
* the #GtkLabel::activate-link signal and the gtk_label_get_current_uri() function.
*/
-typedef struct _GtkLabelPrivate GtkLabelPrivate;
typedef struct _GtkLabelClass GtkLabelClass;
typedef struct _GtkLabelSelectionInfo GtkLabelSelectionInfo;
struct _GtkLabel
{
GtkWidget parent_instance;
-};
-struct _GtkLabelClass
-{
- GtkWidgetClass parent_class;
-
- void (* move_cursor) (GtkLabel *label,
- GtkMovementStep step,
- gint count,
- gboolean extend_selection);
- void (* copy_clipboard) (GtkLabel *label);
-
- gboolean (*activate_link) (GtkLabel *label,
- const gchar *uri);
-};
-
-struct _GtkLabelPrivate
-{
GtkLabelSelectionInfo *select_info;
GtkWidget *mnemonic_widget;
GtkEventController *mnemonic_controller;
@@ -311,6 +293,20 @@ struct _GtkLabelPrivate
gint lines;
};
+struct _GtkLabelClass
+{
+ GtkWidgetClass parent_class;
+
+ void (* move_cursor) (GtkLabel *self,
+ GtkMovementStep step,
+ gint count,
+ gboolean extend_selection);
+ void (* copy_clipboard) (GtkLabel *self);
+
+ gboolean (*activate_link) (GtkLabel *self,
+ const gchar *uri);
+};
+
/* Notes about the handling of links:
*
* Links share the GtkLabelSelectionInfo struct with selectable labels.
@@ -456,33 +452,33 @@ static gboolean gtk_label_query_tooltip (GtkWidget *widget,
gboolean keyboard_tip,
GtkTooltip *tooltip);
-static void gtk_label_set_text_internal (GtkLabel *label,
+static void gtk_label_set_text_internal (GtkLabel *self,
gchar *str);
-static void gtk_label_set_label_internal (GtkLabel *label,
+static void gtk_label_set_label_internal (GtkLabel *self,
gchar *str);
-static gboolean gtk_label_set_use_markup_internal (GtkLabel *label,
+static gboolean gtk_label_set_use_markup_internal (GtkLabel *self,
gboolean val);
-static gboolean gtk_label_set_use_underline_internal (GtkLabel *label,
+static gboolean gtk_label_set_use_underline_internal (GtkLabel *self,
gboolean val);
-static void gtk_label_set_markup_internal (GtkLabel *label,
+static void gtk_label_set_markup_internal (GtkLabel *self,
const gchar *str,
gboolean with_uline);
-static void gtk_label_recalculate (GtkLabel *label);
+static void gtk_label_recalculate (GtkLabel *self);
static void gtk_label_root (GtkWidget *widget);
static void gtk_label_unroot (GtkWidget *widget);
static void gtk_label_popup_menu (GtkWidget *widget,
const char *action_name,
GVariant *parameters);
-static void gtk_label_do_popup (GtkLabel *label,
+static void gtk_label_do_popup (GtkLabel *self,
double x,
double y);
-static void gtk_label_ensure_select_info (GtkLabel *label);
-static void gtk_label_clear_select_info (GtkLabel *label);
-static void gtk_label_update_cursor (GtkLabel *label);
-static void gtk_label_clear_layout (GtkLabel *label);
-static void gtk_label_ensure_layout (GtkLabel *label);
-static void gtk_label_select_region_index (GtkLabel *label,
+static void gtk_label_ensure_select_info (GtkLabel *self);
+static void gtk_label_clear_select_info (GtkLabel *self);
+static void gtk_label_update_cursor (GtkLabel *self);
+static void gtk_label_clear_layout (GtkLabel *self);
+static void gtk_label_ensure_layout (GtkLabel *self);
+static void gtk_label_select_region_index (GtkLabel *self,
gint anchor_index,
gint end_index);
@@ -492,7 +488,7 @@ static void gtk_label_update_active_link (GtkWidget *widget,
static gboolean gtk_label_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
-static void gtk_label_setup_mnemonic (GtkLabel *label);
+static void gtk_label_setup_mnemonic (GtkLabel *self);
static void gtk_label_buildable_interface_init (GtkBuildableIface *iface);
static gboolean gtk_label_buildable_custom_tag_start (GtkBuildable *buildable,
@@ -509,24 +505,24 @@ static void gtk_label_buildable_custom_finished (GtkBuildable *builda
gpointer user_data);
/* For selectable labels: */
-static void gtk_label_move_cursor (GtkLabel *label,
+static void gtk_label_move_cursor (GtkLabel *self,
GtkMovementStep step,
gint count,
gboolean extend_selection);
-static void gtk_label_copy_clipboard (GtkLabel *label);
-static void gtk_label_select_all (GtkLabel *label);
-static gint gtk_label_move_forward_word (GtkLabel *label,
+static void gtk_label_copy_clipboard (GtkLabel *self);
+static void gtk_label_select_all (GtkLabel *self);
+static gint gtk_label_move_forward_word (GtkLabel *self,
gint start);
-static gint gtk_label_move_backward_word (GtkLabel *label,
+static gint gtk_label_move_backward_word (GtkLabel *self,
gint start);
/* For links: */
-static void gtk_label_clear_links (GtkLabel *label);
-static gboolean gtk_label_activate_link (GtkLabel *label,
+static void gtk_label_clear_links (GtkLabel *self);
+static gboolean gtk_label_activate_link (GtkLabel *self,
const gchar *uri);
-static void gtk_label_activate_current_link (GtkLabel *label);
-static GtkLabelLink *gtk_label_get_current_link (GtkLabel *label);
-static void emit_activate_link (GtkLabel *label,
+static void gtk_label_activate_current_link (GtkLabel *self);
+static GtkLabelLink *gtk_label_get_current_link (GtkLabel *self);
+static void emit_activate_link (GtkLabel *self,
GtkLabelLink *link);
/* Event controller callbacks */
@@ -534,40 +530,40 @@ static void gtk_label_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
- GtkLabel *label);
+ GtkLabel *self);
static void gtk_label_click_gesture_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
- GtkLabel *label);
+ GtkLabel *self);
static void gtk_label_drag_gesture_begin (GtkGestureDrag *gesture,
gdouble start_x,
gdouble start_y,
- GtkLabel *label);
+ GtkLabel *self);
static void gtk_label_drag_gesture_update (GtkGestureDrag *gesture,
gdouble offset_x,
gdouble offset_y,
- GtkLabel *label);
+ GtkLabel *self);
/* Actions */
-static void gtk_label_activate_clipboard_copy (GtkWidget *label,
+static void gtk_label_activate_clipboard_copy (GtkWidget *self,
const char *name,
GVariant *parameter);
-static void gtk_label_activate_selection_select_all (GtkWidget *label,
+static void gtk_label_activate_selection_select_all (GtkWidget *self,
const char *name,
GVariant *parameter);
-static void gtk_label_activate_link_open (GtkWidget *label,
+static void gtk_label_activate_link_open (GtkWidget *self,
const char *name,
GVariant *parameter);
-static void gtk_label_activate_link_copy (GtkWidget *label,
+static void gtk_label_activate_link_copy (GtkWidget *self,
const char *name,
GVariant *parameter);
-static void gtk_label_nop (GtkWidget *label,
+static void gtk_label_nop (GtkWidget *self,
const char *name,
GVariant *parameter);
-static void gtk_label_update_actions (GtkLabel *label);
+static void gtk_label_update_actions (GtkLabel *self);
static GtkSizeRequestMode gtk_label_get_request_mode (GtkWidget *widget);
static void gtk_label_measure (GtkWidget *widget,
@@ -583,7 +579,6 @@ static void gtk_label_measure (GtkWidget *widget,
static GtkBuildableIface *buildable_parent_iface = NULL;
G_DEFINE_TYPE_WITH_CODE (GtkLabel, gtk_label, GTK_TYPE_WIDGET,
- G_ADD_PRIVATE (GtkLabel)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_label_buildable_interface_init))
@@ -1118,60 +1113,60 @@ gtk_label_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GtkLabel *label = GTK_LABEL (object);
+ GtkLabel *self = GTK_LABEL (object);
switch (prop_id)
{
case PROP_LABEL:
- gtk_label_set_label (label, g_value_get_string (value));
+ gtk_label_set_label (self, g_value_get_string (value));
break;
case PROP_ATTRIBUTES:
- gtk_label_set_attributes (label, g_value_get_boxed (value));
+ gtk_label_set_attributes (self, g_value_get_boxed (value));
break;
case PROP_USE_MARKUP:
- gtk_label_set_use_markup (label, g_value_get_boolean (value));
+ gtk_label_set_use_markup (self, g_value_get_boolean (value));
break;
case PROP_USE_UNDERLINE:
- gtk_label_set_use_underline (label, g_value_get_boolean (value));
+ gtk_label_set_use_underline (self, g_value_get_boolean (value));
break;
case PROP_JUSTIFY:
- gtk_label_set_justify (label, g_value_get_enum (value));
+ gtk_label_set_justify (self, g_value_get_enum (value));
break;
case PROP_WRAP:
- gtk_label_set_wrap (label, g_value_get_boolean (value));
- break;
+ gtk_label_set_wrap (self, g_value_get_boolean (value));
+ break;
case PROP_WRAP_MODE:
- gtk_label_set_wrap_mode (label, g_value_get_enum (value));
- break;
+ gtk_label_set_wrap_mode (self, g_value_get_enum (value));
+ break;
case PROP_SELECTABLE:
- gtk_label_set_selectable (label, g_value_get_boolean (value));
- break;
+ gtk_label_set_selectable (self, g_value_get_boolean (value));
+ break;
case PROP_MNEMONIC_WIDGET:
- gtk_label_set_mnemonic_widget (label, (GtkWidget*) g_value_get_object (value));
+ gtk_label_set_mnemonic_widget (self, (GtkWidget*) g_value_get_object (value));
break;
case PROP_ELLIPSIZE:
- gtk_label_set_ellipsize (label, g_value_get_enum (value));
+ gtk_label_set_ellipsize (self, g_value_get_enum (value));
break;
case PROP_WIDTH_CHARS:
- gtk_label_set_width_chars (label, g_value_get_int (value));
+ gtk_label_set_width_chars (self, g_value_get_int (value));
break;
case PROP_SINGLE_LINE_MODE:
- gtk_label_set_single_line_mode (label, g_value_get_boolean (value));
- break;
+ gtk_label_set_single_line_mode (self, g_value_get_boolean (value));
+ break;
case PROP_MAX_WIDTH_CHARS:
- gtk_label_set_max_width_chars (label, g_value_get_int (value));
+ gtk_label_set_max_width_chars (self, g_value_get_int (value));
break;
case PROP_LINES:
- gtk_label_set_lines (label, g_value_get_int (value));
+ gtk_label_set_lines (self, g_value_get_int (value));
break;
case PROP_XALIGN:
- gtk_label_set_xalign (label, g_value_get_float (value));
+ gtk_label_set_xalign (self, g_value_get_float (value));
break;
case PROP_YALIGN:
- gtk_label_set_yalign (label, g_value_get_float (value));
+ gtk_label_set_yalign (self, g_value_get_float (value));
break;
case PROP_EXTRA_MENU:
- gtk_label_set_extra_menu (label, g_value_get_object (value));
+ gtk_label_set_extra_menu (self, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1185,64 +1180,63 @@ gtk_label_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GtkLabel *label = GTK_LABEL (object);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (object);
switch (prop_id)
{
case PROP_LABEL:
- g_value_set_string (value, priv->label);
+ g_value_set_string (value, self->label);
break;
case PROP_ATTRIBUTES:
- g_value_set_boxed (value, priv->attrs);
+ g_value_set_boxed (value, self->attrs);
break;
case PROP_USE_MARKUP:
- g_value_set_boolean (value, priv->use_markup);
+ g_value_set_boolean (value, self->use_markup);
break;
case PROP_USE_UNDERLINE:
- g_value_set_boolean (value, priv->use_underline);
+ g_value_set_boolean (value, self->use_underline);
break;
case PROP_JUSTIFY:
- g_value_set_enum (value, priv->jtype);
+ g_value_set_enum (value, self->jtype);
break;
case PROP_WRAP:
- g_value_set_boolean (value, priv->wrap);
+ g_value_set_boolean (value, self->wrap);
break;
case PROP_WRAP_MODE:
- g_value_set_enum (value, priv->wrap_mode);
+ g_value_set_enum (value, self->wrap_mode);
break;
case PROP_SELECTABLE:
- g_value_set_boolean (value, gtk_label_get_selectable (label));
+ g_value_set_boolean (value, gtk_label_get_selectable (self));
break;
case PROP_MNEMONIC_KEYVAL:
- g_value_set_uint (value, priv->mnemonic_keyval);
+ g_value_set_uint (value, self->mnemonic_keyval);
break;
case PROP_MNEMONIC_WIDGET:
- g_value_set_object (value, (GObject*) priv->mnemonic_widget);
+ g_value_set_object (value, (GObject*) self->mnemonic_widget);
break;
case PROP_ELLIPSIZE:
- g_value_set_enum (value, priv->ellipsize);
+ g_value_set_enum (value, self->ellipsize);
break;
case PROP_WIDTH_CHARS:
- g_value_set_int (value, gtk_label_get_width_chars (label));
+ g_value_set_int (value, gtk_label_get_width_chars (self));
break;
case PROP_SINGLE_LINE_MODE:
- g_value_set_boolean (value, gtk_label_get_single_line_mode (label));
+ g_value_set_boolean (value, gtk_label_get_single_line_mode (self));
break;
case PROP_MAX_WIDTH_CHARS:
- g_value_set_int (value, gtk_label_get_max_width_chars (label));
+ g_value_set_int (value, gtk_label_get_max_width_chars (self));
break;
case PROP_LINES:
- g_value_set_int (value, gtk_label_get_lines (label));
+ g_value_set_int (value, gtk_label_get_lines (self));
break;
case PROP_XALIGN:
- g_value_set_float (value, gtk_label_get_xalign (label));
+ g_value_set_float (value, gtk_label_get_xalign (self));
break;
case PROP_YALIGN:
- g_value_set_float (value, gtk_label_get_yalign (label));
+ g_value_set_float (value, gtk_label_get_yalign (self));
break;
case PROP_EXTRA_MENU:
- g_value_set_object (value, gtk_label_get_extra_menu (label));
+ g_value_set_object (value, gtk_label_get_extra_menu (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1251,34 +1245,32 @@ gtk_label_get_property (GObject *object,
}
static void
-gtk_label_init (GtkLabel *label)
+gtk_label_init (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ self->width_chars = -1;
+ self->max_width_chars = -1;
+ self->label = g_strdup ("");
+ self->lines = -1;
- priv->width_chars = -1;
- priv->max_width_chars = -1;
- priv->label = g_strdup ("");
- priv->lines = -1;
+ self->xalign = 0.5;
+ self->yalign = 0.5;
- priv->xalign = 0.5;
- priv->yalign = 0.5;
+ self->jtype = GTK_JUSTIFY_LEFT;
+ self->wrap = FALSE;
+ self->wrap_mode = PANGO_WRAP_WORD;
+ self->ellipsize = PANGO_ELLIPSIZE_NONE;
- priv->jtype = GTK_JUSTIFY_LEFT;
- priv->wrap = FALSE;
- priv->wrap_mode = PANGO_WRAP_WORD;
- priv->ellipsize = PANGO_ELLIPSIZE_NONE;
+ self->use_underline = FALSE;
+ self->use_markup = FALSE;
- priv->use_underline = FALSE;
- priv->use_markup = FALSE;
+ self->mnemonic_keyval = GDK_KEY_VoidSymbol;
+ self->layout = NULL;
+ self->text = g_strdup ("");
+ self->attrs = NULL;
- priv->mnemonic_keyval = GDK_KEY_VoidSymbol;
- priv->layout = NULL;
- priv->text = g_strdup ("");
- priv->attrs = NULL;
+ self->mnemonic_widget = NULL;
- priv->mnemonic_widget = NULL;
-
- priv->mnemonics_visible = FALSE;
+ self->mnemonics_visible = FALSE;
}
@@ -1361,14 +1353,14 @@ gtk_label_buildable_custom_finished (GtkBuildable *buildable,
GtkWidget*
gtk_label_new (const gchar *str)
{
- GtkLabel *label;
-
- label = g_object_new (GTK_TYPE_LABEL, NULL);
+ GtkLabel *self;
+
+ self = g_object_new (GTK_TYPE_LABEL, NULL);
if (str && *str)
- gtk_label_set_text (label, str);
-
- return GTK_WIDGET (label);
+ gtk_label_set_text (self, str);
+
+ return GTK_WIDGET (self);
}
/**
@@ -1396,26 +1388,25 @@ gtk_label_new (const gchar *str)
GtkWidget*
gtk_label_new_with_mnemonic (const gchar *str)
{
- GtkLabel *label;
-
- label = g_object_new (GTK_TYPE_LABEL, NULL);
+ GtkLabel *self;
+
+ self = g_object_new (GTK_TYPE_LABEL, NULL);
if (str && *str)
- gtk_label_set_text_with_mnemonic (label, str);
-
- return GTK_WIDGET (label);
+ gtk_label_set_text_with_mnemonic (self, str);
+
+ return GTK_WIDGET (self);
}
static gboolean
gtk_label_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (widget);
GtkWidget *parent;
- if (priv->mnemonic_widget)
- return gtk_widget_mnemonic_activate (priv->mnemonic_widget, group_cycling);
+ if (self->mnemonic_widget)
+ return gtk_widget_mnemonic_activate (self->mnemonic_widget, group_cycling);
/* Try to find the widget to activate by traversing the
* widget's ancestry.
@@ -1453,50 +1444,49 @@ label_mnemonics_visible_changed (GtkWidget *widget,
}
static void
-gtk_label_setup_mnemonic (GtkLabel *label)
+gtk_label_setup_mnemonic (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkWidget *widget = GTK_WIDGET (label);
+ GtkWidget *widget = GTK_WIDGET (self);
GtkShortcut *shortcut;
GtkNative *native;
gboolean connected;
gboolean mnemonics_visible;
- if (priv->mnemonic_keyval == GDK_KEY_VoidSymbol)
+ if (self->mnemonic_keyval == GDK_KEY_VoidSymbol)
{
- if (priv->mnemonic_controller)
+ if (self->mnemonic_controller)
{
- gtk_widget_remove_controller (widget, priv->mnemonic_controller);
- priv->mnemonic_controller = NULL;
+ gtk_widget_remove_controller (widget, self->mnemonic_controller);
+ self->mnemonic_controller = NULL;
}
return;
}
- if (priv->mnemonic_controller == NULL)
+ if (self->mnemonic_controller == NULL)
{
- priv->mnemonic_controller = gtk_shortcut_controller_new ();
- gtk_event_controller_set_propagation_phase (priv->mnemonic_controller, GTK_PHASE_CAPTURE);
- gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (priv->mnemonic_controller), GTK_SHORTCUT_SCOPE_MANAGED);
- shortcut = gtk_shortcut_new (gtk_mnemonic_trigger_new (priv->mnemonic_keyval),
+ self->mnemonic_controller = gtk_shortcut_controller_new ();
+ gtk_event_controller_set_propagation_phase (self->mnemonic_controller, GTK_PHASE_CAPTURE);
+ gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (self->mnemonic_controller), GTK_SHORTCUT_SCOPE_MANAGED);
+ shortcut = gtk_shortcut_new (gtk_mnemonic_trigger_new (self->mnemonic_keyval),
g_object_ref (gtk_mnemonic_action_get ()));
- gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (priv->mnemonic_controller), shortcut);
- gtk_widget_add_controller (GTK_WIDGET (label), priv->mnemonic_controller);
+ gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (self->mnemonic_controller), shortcut);
+ gtk_widget_add_controller (GTK_WIDGET (self), self->mnemonic_controller);
}
else
{
- shortcut = g_list_model_get_item (G_LIST_MODEL (priv->mnemonic_controller), 0);
- gtk_shortcut_set_trigger (shortcut, gtk_mnemonic_trigger_new (priv->mnemonic_keyval));
+ shortcut = g_list_model_get_item (G_LIST_MODEL (self->mnemonic_controller), 0);
+ gtk_shortcut_set_trigger (shortcut, gtk_mnemonic_trigger_new (self->mnemonic_keyval));
g_object_unref (shortcut);
}
/* Connect to notify::mnemonics-visible of the root */
- native = gtk_widget_get_native (GTK_WIDGET (label));
+ native = gtk_widget_get_native (GTK_WIDGET (self));
if (!GTK_IS_WINDOW (native) && !GTK_IS_POPOVER (native))
return;
/* always set up this widgets initial value */
g_object_get (native, "mnemonics-visible", &mnemonics_visible, NULL);
- priv->mnemonics_visible = mnemonics_visible;
+ self->mnemonics_visible = mnemonics_visible;
connected =
GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (native), quark_mnemonics_visible_connected));
@@ -1506,7 +1496,7 @@ gtk_label_setup_mnemonic (GtkLabel *label)
g_signal_connect (native,
"notify::mnemonics-visible",
G_CALLBACK (label_mnemonics_visible_changed),
- label);
+ self);
g_object_set_qdata (G_OBJECT (native),
quark_mnemonics_visible_connected,
GINT_TO_POINTER (1));
@@ -1516,11 +1506,11 @@ gtk_label_setup_mnemonic (GtkLabel *label)
static void
gtk_label_root (GtkWidget *widget)
{
- GtkLabel *label = GTK_LABEL (widget);
+ GtkLabel *self = GTK_LABEL (widget);
GTK_WIDGET_CLASS (gtk_label_parent_class)->root (widget);
- gtk_label_setup_mnemonic (label);
+ gtk_label_setup_mnemonic (self);
/* The PangoContext is replaced when the display changes, so clear the layouts */
gtk_label_clear_layout (GTK_LABEL (widget));
@@ -1529,9 +1519,9 @@ gtk_label_root (GtkWidget *widget)
static void
gtk_label_unroot (GtkWidget *widget)
{
- GtkLabel *label = GTK_LABEL (widget);
+ GtkLabel *self = GTK_LABEL (widget);
- gtk_label_setup_mnemonic (label);
+ gtk_label_setup_mnemonic (self);
GTK_WIDGET_CLASS (gtk_label_parent_class)->unroot (widget);
}
@@ -1542,13 +1532,12 @@ _gtk_label_mnemonics_visible_apply_recursively (GtkWidget *widget,
{
if (GTK_IS_LABEL (widget))
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (widget);
- if (priv->mnemonics_visible != visible)
+ if (self->mnemonics_visible != visible)
{
- priv->mnemonics_visible = visible;
- gtk_label_recalculate (label);
+ self->mnemonics_visible = visible;
+ gtk_label_recalculate (self);
}
}
else
@@ -1570,11 +1559,10 @@ static void
label_mnemonic_widget_weak_notify (gpointer data,
GObject *where_the_object_was)
{
- GtkLabel *label = data;
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = data;
- priv->mnemonic_widget = NULL;
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_MNEMONIC_WIDGET]);
+ self->mnemonic_widget = NULL;
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_MNEMONIC_WIDGET]);
}
/**
@@ -1598,33 +1586,31 @@ label_mnemonic_widget_weak_notify (gpointer data,
* and toggle focus between the colliding widgets otherwise.
**/
void
-gtk_label_set_mnemonic_widget (GtkLabel *label,
+gtk_label_set_mnemonic_widget (GtkLabel *self,
GtkWidget *widget)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
if (widget)
g_return_if_fail (GTK_IS_WIDGET (widget));
- if (priv->mnemonic_widget)
+ if (self->mnemonic_widget)
{
- gtk_widget_remove_mnemonic_label (priv->mnemonic_widget, GTK_WIDGET (label));
- g_object_weak_unref (G_OBJECT (priv->mnemonic_widget),
- label_mnemonic_widget_weak_notify,
- label);
+ gtk_widget_remove_mnemonic_label (self->mnemonic_widget, GTK_WIDGET (self));
+ g_object_weak_unref (G_OBJECT (self->mnemonic_widget),
+ label_mnemonic_widget_weak_notify,
+ self);
}
- priv->mnemonic_widget = widget;
- if (priv->mnemonic_widget)
+ self->mnemonic_widget = widget;
+ if (self->mnemonic_widget)
{
- g_object_weak_ref (G_OBJECT (priv->mnemonic_widget),
- label_mnemonic_widget_weak_notify,
- label);
- gtk_widget_add_mnemonic_label (priv->mnemonic_widget, GTK_WIDGET (label));
+ g_object_weak_ref (G_OBJECT (self->mnemonic_widget),
+ label_mnemonic_widget_weak_notify,
+ self);
+ gtk_widget_add_mnemonic_label (self->mnemonic_widget, GTK_WIDGET (self));
}
-
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_MNEMONIC_WIDGET]);
+
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_MNEMONIC_WIDGET]);
}
/**
@@ -1638,13 +1624,11 @@ gtk_label_set_mnemonic_widget (GtkLabel *label,
* or %NULL if none has been set and the default algorithm will be used.
**/
GtkWidget *
-gtk_label_get_mnemonic_widget (GtkLabel *label)
+gtk_label_get_mnemonic_widget (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), NULL);
- g_return_val_if_fail (GTK_IS_LABEL (label), NULL);
-
- return priv->mnemonic_widget;
+ return self->mnemonic_widget;
}
/**
@@ -1658,60 +1642,52 @@ gtk_label_get_mnemonic_widget (GtkLabel *label)
* Returns: GDK keyval usable for accelerators, or #GDK_KEY_VoidSymbol
**/
guint
-gtk_label_get_mnemonic_keyval (GtkLabel *label)
+gtk_label_get_mnemonic_keyval (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), GDK_KEY_VoidSymbol);
- g_return_val_if_fail (GTK_IS_LABEL (label), GDK_KEY_VoidSymbol);
-
- return priv->mnemonic_keyval;
+ return self->mnemonic_keyval;
}
static void
-gtk_label_set_text_internal (GtkLabel *label,
+gtk_label_set_text_internal (GtkLabel *self,
gchar *str)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (g_strcmp0 (priv->text, str) == 0)
+ if (g_strcmp0 (self->text, str) == 0)
{
g_free (str);
return;
}
- _gtk_label_accessible_text_deleted (label);
- g_free (priv->text);
- priv->text = str;
+ _gtk_label_accessible_text_deleted (self);
+ g_free (self->text);
+ self->text = str;
- _gtk_label_accessible_text_inserted (label);
+ _gtk_label_accessible_text_inserted (self);
- gtk_label_select_region_index (label, 0, 0);
+ gtk_label_select_region_index (self, 0, 0);
}
static void
-gtk_label_set_label_internal (GtkLabel *label,
+gtk_label_set_label_internal (GtkLabel *self,
gchar *str)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_free (self->label);
- g_free (priv->label);
+ self->label = str;
- priv->label = str;
-
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_LABEL]);
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_LABEL]);
}
static gboolean
-gtk_label_set_use_markup_internal (GtkLabel *label,
+gtk_label_set_use_markup_internal (GtkLabel *self,
gboolean val)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->use_markup != val)
+ if (self->use_markup != val)
{
- priv->use_markup = val;
+ self->use_markup = val;
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_USE_MARKUP]);
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_USE_MARKUP]);
return TRUE;
}
@@ -1720,16 +1696,14 @@ gtk_label_set_use_markup_internal (GtkLabel *label,
}
static gboolean
-gtk_label_set_use_underline_internal (GtkLabel *label,
+gtk_label_set_use_underline_internal (GtkLabel *self,
gboolean val)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->use_underline != val)
+ if (self->use_underline != val)
{
- priv->use_underline = val;
+ self->use_underline = val;
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_USE_UNDERLINE]);
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_USE_UNDERLINE]);
return TRUE;
}
@@ -1741,34 +1715,33 @@ gtk_label_set_use_underline_internal (GtkLabel *label,
* label, use_underline and use_markup
*/
static void
-gtk_label_recalculate (GtkLabel *label)
+gtk_label_recalculate (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- guint keyval = priv->mnemonic_keyval;
+ guint keyval = self->mnemonic_keyval;
- gtk_label_clear_links (label);
- gtk_label_clear_layout (label);
- gtk_label_clear_select_info (label);
+ gtk_label_clear_links (self);
+ gtk_label_clear_layout (self);
+ gtk_label_clear_select_info (self);
- if (priv->use_markup || priv->use_underline)
- gtk_label_set_markup_internal (label, priv->label, priv->use_underline);
+ if (self->use_markup || self->use_underline)
+ gtk_label_set_markup_internal (self, self->label, self->use_underline);
else
{
- g_clear_pointer (&priv->markup_attrs, pango_attr_list_unref);
+ g_clear_pointer (&self->markup_attrs, pango_attr_list_unref);
- gtk_label_set_text_internal (label, g_strdup (priv->label));
+ gtk_label_set_text_internal (self, g_strdup (self->label));
}
- if (!priv->use_underline)
- priv->mnemonic_keyval = GDK_KEY_VoidSymbol;
+ if (!self->use_underline)
+ self->mnemonic_keyval = GDK_KEY_VoidSymbol;
- if (keyval != priv->mnemonic_keyval)
+ if (keyval != self->mnemonic_keyval)
{
- gtk_label_setup_mnemonic (label);
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_MNEMONIC_KEYVAL]);
+ gtk_label_setup_mnemonic (self);
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_MNEMONIC_KEYVAL]);
}
- gtk_widget_queue_resize (GTK_WIDGET (label));
+ gtk_widget_queue_resize (GTK_WIDGET (self));
}
/**
@@ -1788,20 +1761,20 @@ gtk_label_recalculate (GtkLabel *label)
* See also: gtk_label_set_markup()
**/
void
-gtk_label_set_text (GtkLabel *label,
+gtk_label_set_text (GtkLabel *self,
const gchar *str)
{
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_object_freeze_notify (G_OBJECT (label));
+ g_object_freeze_notify (G_OBJECT (self));
- gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
- gtk_label_set_use_markup_internal (label, FALSE);
- gtk_label_set_use_underline_internal (label, FALSE);
+ gtk_label_set_label_internal (self, g_strdup (str ? str : ""));
+ gtk_label_set_use_markup_internal (self, FALSE);
+ gtk_label_set_use_underline_internal (self, FALSE);
- gtk_label_recalculate (label);
+ gtk_label_recalculate (self);
- g_object_thaw_notify (G_OBJECT (label));
+ g_object_thaw_notify (G_OBJECT (self));
}
/**
@@ -1820,24 +1793,22 @@ gtk_label_set_text (GtkLabel *label,
* to the label after the markup string is parsed.
**/
void
-gtk_label_set_attributes (GtkLabel *label,
+gtk_label_set_attributes (GtkLabel *self,
PangoAttrList *attrs)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
if (attrs)
pango_attr_list_ref (attrs);
- if (priv->attrs)
- pango_attr_list_unref (priv->attrs);
- priv->attrs = attrs;
+ if (self->attrs)
+ pango_attr_list_unref (self->attrs);
+ self->attrs = attrs;
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_ATTRIBUTES]);
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_ATTRIBUTES]);
- gtk_label_clear_layout (label);
- gtk_widget_queue_resize (GTK_WIDGET (label));
+ gtk_label_clear_layout (self);
+ gtk_widget_queue_resize (GTK_WIDGET (self));
}
/**
@@ -1849,19 +1820,17 @@ gtk_label_set_attributes (GtkLabel *label,
* not reflect attributes that come from the labels markup
* (see gtk_label_set_markup()). If you want to get the
* effective attributes for the label, use
- * pango_layout_get_attribute (gtk_label_get_layout (label)).
+ * pango_layout_get_attribute (gtk_label_get_layout (self)).
*
* Returns: (nullable) (transfer none): the attribute list, or %NULL
* if none was set.
**/
PangoAttrList *
-gtk_label_get_attributes (GtkLabel *label)
+gtk_label_get_attributes (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), NULL);
- g_return_val_if_fail (GTK_IS_LABEL (label), NULL);
-
- return priv->attrs;
+ return self->attrs;
}
/**
@@ -1875,17 +1844,17 @@ gtk_label_get_attributes (GtkLabel *label)
* #GtkLabel:use-markup properties.
**/
void
-gtk_label_set_label (GtkLabel *label,
+gtk_label_set_label (GtkLabel *self,
const gchar *str)
{
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_object_freeze_notify (G_OBJECT (label));
+ g_object_freeze_notify (G_OBJECT (self));
- gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
- gtk_label_recalculate (label);
+ gtk_label_set_label_internal (self, g_strdup (str ? str : ""));
+ gtk_label_recalculate (self);
- g_object_thaw_notify (G_OBJECT (label));
+ g_object_thaw_notify (G_OBJECT (self));
}
/**
@@ -1900,13 +1869,11 @@ gtk_label_set_label (GtkLabel *label,
* owned by the widget and must not be modified or freed.
**/
const gchar *
-gtk_label_get_label (GtkLabel *label)
+gtk_label_get_label (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), NULL);
- g_return_val_if_fail (GTK_IS_LABEL (label), NULL);
-
- return priv->label;
+ return self->label;
}
typedef struct
@@ -1926,7 +1893,7 @@ start_element_handler (GMarkupParseContext *context,
GError **error)
{
UriParserData *pdata = user_data;
- GtkLabelPrivate *priv = gtk_label_get_instance_private (pdata->label);
+ GtkLabel *self = pdata->label;
if (strcmp (element_name, "a") == 0)
{
@@ -1977,11 +1944,11 @@ start_element_handler (GMarkupParseContext *context,
}
visited = FALSE;
- if (priv->select_info)
+ if (self->select_info)
{
- for (i = 0; i < priv->select_info->n_links; i++)
+ for (i = 0; i < self->select_info->n_links; i++)
{
- const GtkLabelLink *l = &priv->select_info->links[i];
+ const GtkLabelLink *l = &self->select_info->links[i];
if (strcmp (uri, l->uri) == 0)
{
@@ -2104,7 +2071,7 @@ link_free (GtkLabelLink *link)
}
static gboolean
-parse_uri_markup (GtkLabel *label,
+parse_uri_markup (GtkLabel *self,
const gchar *str,
gchar **new_str,
GtkLabelLink **links,
@@ -2120,7 +2087,7 @@ parse_uri_markup (GtkLabel *label,
p = str;
end = str + length;
- pdata.label = label;
+ pdata.label = self;
pdata.links = NULL;
pdata.new_str = g_string_sized_new (length);
pdata.text_len = 0;
@@ -2177,15 +2144,14 @@ failed:
}
static void
-gtk_label_ensure_has_tooltip (GtkLabel *label)
+gtk_label_ensure_has_tooltip (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
guint i;
gboolean has_tooltip = FALSE;
- for (i = 0; i < priv->select_info->n_links; i++)
+ for (i = 0; i < self->select_info->n_links; i++)
{
- const GtkLabelLink *link = &priv->select_info->links[i];
+ const GtkLabelLink *link = &self->select_info->links[i];
if (link->title)
{
@@ -2194,7 +2160,7 @@ gtk_label_ensure_has_tooltip (GtkLabel *label)
}
}
- gtk_widget_set_has_tooltip (GTK_WIDGET (label), has_tooltip);
+ gtk_widget_set_has_tooltip (GTK_WIDGET (self), has_tooltip);
}
/* Reads @text and extracts the accel key, if any.
@@ -2271,11 +2237,10 @@ extract_mnemonic_keyval (const char *text,
}
static void
-gtk_label_set_markup_internal (GtkLabel *label,
+gtk_label_set_markup_internal (GtkLabel *self,
const gchar *str,
gboolean with_uline)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
gchar *text = NULL;
GError *error = NULL;
PangoAttrList *attrs = NULL;
@@ -2284,17 +2249,17 @@ gtk_label_set_markup_internal (GtkLabel *label,
guint n_links = 0;
PangoAttribute *mnemonic_attr = NULL;
- if (!parse_uri_markup (label, str, &str_for_display, &links, &n_links, &error))
+ if (!parse_uri_markup (self, str, &str_for_display, &links, &n_links, &error))
goto error_set;
if (links)
{
- gtk_label_ensure_select_info (label);
- priv->select_info->links = g_steal_pointer (&links);
- priv->select_info->n_links = n_links;
- _gtk_label_accessible_update_links (label);
- gtk_label_ensure_has_tooltip (label);
- gtk_widget_add_css_class (GTK_WIDGET (label), "link");
+ gtk_label_ensure_select_info (self);
+ self->select_info->links = g_steal_pointer (&links);
+ self->select_info->n_links = n_links;
+ _gtk_label_accessible_update_links (self);
+ gtk_label_ensure_has_tooltip (self);
+ gtk_widget_add_css_class (GTK_WIDGET (self), "link");
}
if (!with_uline)
@@ -2309,9 +2274,9 @@ no_uline:
char *new_text = NULL;
guint accel_keyval;
gboolean auto_mnemonics = TRUE;
- gboolean do_mnemonics = priv->mnemonics_visible &&
- (!auto_mnemonics || gtk_widget_is_sensitive (GTK_WIDGET (label))) &&
- (!priv->mnemonic_widget || gtk_widget_is_sensitive (priv->mnemonic_widget));
+ gboolean do_mnemonics = self->mnemonics_visible &&
+ (!auto_mnemonics || gtk_widget_is_sensitive (GTK_WIDGET (self))) &&
+ (!self->mnemonic_widget || gtk_widget_is_sensitive (self->mnemonic_widget));
/* Remove the mnemonic underline */
extract_mnemonic_keyval (str_for_display,
@@ -2321,7 +2286,7 @@ no_uline:
if (!new_text) /* No underline found anyway */
goto no_uline;
- priv->mnemonic_keyval = accel_keyval;
+ self->mnemonic_keyval = accel_keyval;
/* Extract the text to display */
if (!pango_parse_markup (new_text, -1, '_', &attrs, &text, NULL, &error))
@@ -2350,15 +2315,15 @@ no_uline:
g_free (str_for_display);
if (text)
- gtk_label_set_text_internal (label, text);
+ gtk_label_set_text_internal (self, text);
if (attrs)
{
- g_clear_pointer (&priv->markup_attrs, pango_attr_list_unref);
- priv->markup_attrs = attrs;
+ g_clear_pointer (&self->markup_attrs, pango_attr_list_unref);
+ self->markup_attrs = attrs;
if (mnemonic_attr)
- pango_attr_list_insert_before (priv->markup_attrs, mnemonic_attr);
+ pango_attr_list_insert_before (self->markup_attrs, mnemonic_attr);
}
return;
@@ -2383,13 +2348,13 @@ error_set:
* g_markup_escape_text() or g_markup_printf_escaped():
*
* |[
- * GtkWidget *label = gtk_label_new (NULL);
+ * GtkWidget *self = gtk_label_new (NULL);
* const char *str = "...";
* const char *format = "\%s";
* char *markup;
*
* markup = g_markup_printf_escaped (format, str);
- * gtk_label_set_markup (GTK_LABEL (label), markup);
+ * gtk_label_set_markup (GTK_LABEL (self), markup);
* g_free (markup);
* ]|
*
@@ -2403,20 +2368,20 @@ error_set:
* See also: gtk_label_set_text()
**/
void
-gtk_label_set_markup (GtkLabel *label,
+gtk_label_set_markup (GtkLabel *self,
const gchar *str)
{
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_object_freeze_notify (G_OBJECT (label));
+ g_object_freeze_notify (G_OBJECT (self));
- gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
- gtk_label_set_use_markup_internal (label, TRUE);
- gtk_label_set_use_underline_internal (label, FALSE);
+ gtk_label_set_label_internal (self, g_strdup (str ? str : ""));
+ gtk_label_set_use_markup_internal (self, TRUE);
+ gtk_label_set_use_underline_internal (self, FALSE);
- gtk_label_recalculate (label);
+ gtk_label_recalculate (self);
- g_object_thaw_notify (G_OBJECT (label));
+ g_object_thaw_notify (G_OBJECT (self));
}
/**
@@ -2435,20 +2400,20 @@ gtk_label_set_markup (GtkLabel *label,
* automatically, or explicitly using gtk_label_set_mnemonic_widget().
*/
void
-gtk_label_set_markup_with_mnemonic (GtkLabel *label,
+gtk_label_set_markup_with_mnemonic (GtkLabel *self,
const gchar *str)
{
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_object_freeze_notify (G_OBJECT (label));
+ g_object_freeze_notify (G_OBJECT (self));
- gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
- gtk_label_set_use_markup_internal (label, TRUE);
- gtk_label_set_use_underline_internal (label, TRUE);
+ gtk_label_set_label_internal (self, g_strdup (str ? str : ""));
+ gtk_label_set_use_markup_internal (self, TRUE);
+ gtk_label_set_use_underline_internal (self, TRUE);
- gtk_label_recalculate (label);
+ gtk_label_recalculate (self);
- g_object_thaw_notify (G_OBJECT (label));
+ g_object_thaw_notify (G_OBJECT (self));
}
/**
@@ -2463,13 +2428,11 @@ gtk_label_set_markup_with_mnemonic (GtkLabel *label,
* string used by the label, and must not be modified.
**/
const gchar *
-gtk_label_get_text (GtkLabel *label)
+gtk_label_get_text (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), NULL);
- g_return_val_if_fail (GTK_IS_LABEL (label), NULL);
-
- return priv->text;
+ return self->text;
}
/**
@@ -2485,23 +2448,21 @@ gtk_label_get_text (GtkLabel *label)
* single line.
*/
void
-gtk_label_set_justify (GtkLabel *label,
+gtk_label_set_justify (GtkLabel *self,
GtkJustification jtype)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
g_return_if_fail (jtype >= GTK_JUSTIFY_LEFT && jtype <= GTK_JUSTIFY_FILL);
- if ((GtkJustification) priv->jtype != jtype)
+ if ((GtkJustification) self->jtype != jtype)
{
- priv->jtype = jtype;
+ self->jtype = jtype;
/* No real need to be this drastic, but easier than duplicating the code */
- gtk_label_clear_layout (label);
+ gtk_label_clear_layout (self);
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_JUSTIFY]);
- gtk_widget_queue_resize (GTK_WIDGET (label));
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_JUSTIFY]);
+ gtk_widget_queue_resize (GTK_WIDGET (self));
}
}
@@ -2514,13 +2475,11 @@ gtk_label_set_justify (GtkLabel *label,
* Returns: #GtkJustification
**/
GtkJustification
-gtk_label_get_justify (GtkLabel *label)
+gtk_label_get_justify (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), 0);
- g_return_val_if_fail (GTK_IS_LABEL (label), 0);
-
- return priv->jtype;
+ return self->jtype;
}
/**
@@ -2532,23 +2491,21 @@ gtk_label_get_justify (GtkLabel *label)
* if there is not enough space to render the entire string.
**/
void
-gtk_label_set_ellipsize (GtkLabel *label,
+gtk_label_set_ellipsize (GtkLabel *self,
PangoEllipsizeMode mode)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
g_return_if_fail (mode >= PANGO_ELLIPSIZE_NONE && mode <= PANGO_ELLIPSIZE_END);
- if ((PangoEllipsizeMode) priv->ellipsize != mode)
+ if ((PangoEllipsizeMode) self->ellipsize != mode)
{
- priv->ellipsize = mode;
+ self->ellipsize = mode;
/* No real need to be this drastic, but easier than duplicating the code */
- gtk_label_clear_layout (label);
+ gtk_label_clear_layout (self);
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_ELLIPSIZE]);
- gtk_widget_queue_resize (GTK_WIDGET (label));
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_ELLIPSIZE]);
+ gtk_widget_queue_resize (GTK_WIDGET (self));
}
}
@@ -2561,13 +2518,11 @@ gtk_label_set_ellipsize (GtkLabel *label,
* Returns: #PangoEllipsizeMode
**/
PangoEllipsizeMode
-gtk_label_get_ellipsize (GtkLabel *label)
+gtk_label_get_ellipsize (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), PANGO_ELLIPSIZE_NONE);
- g_return_val_if_fail (GTK_IS_LABEL (label), PANGO_ELLIPSIZE_NONE);
-
- return priv->ellipsize;
+ return self->ellipsize;
}
/**
@@ -2578,18 +2533,16 @@ gtk_label_get_ellipsize (GtkLabel *label)
* Sets the desired width in characters of @label to @n_chars.
**/
void
-gtk_label_set_width_chars (GtkLabel *label,
+gtk_label_set_width_chars (GtkLabel *self,
gint n_chars)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_return_if_fail (GTK_IS_LABEL (label));
-
- if (priv->width_chars != n_chars)
+ if (self->width_chars != n_chars)
{
- priv->width_chars = n_chars;
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_WIDTH_CHARS]);
- gtk_widget_queue_resize (GTK_WIDGET (label));
+ self->width_chars = n_chars;
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_WIDTH_CHARS]);
+ gtk_widget_queue_resize (GTK_WIDGET (self));
}
}
@@ -2603,13 +2556,11 @@ gtk_label_set_width_chars (GtkLabel *label,
* Returns: the width of the label in characters.
**/
gint
-gtk_label_get_width_chars (GtkLabel *label)
+gtk_label_get_width_chars (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), -1);
- g_return_val_if_fail (GTK_IS_LABEL (label), -1);
-
- return priv->width_chars;
+ return self->width_chars;
}
/**
@@ -2620,19 +2571,17 @@ gtk_label_get_width_chars (GtkLabel *label)
* Sets the desired maximum width in characters of @label to @n_chars.
**/
void
-gtk_label_set_max_width_chars (GtkLabel *label,
+gtk_label_set_max_width_chars (GtkLabel *self,
gint n_chars)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_return_if_fail (GTK_IS_LABEL (label));
-
- if (priv->max_width_chars != n_chars)
+ if (self->max_width_chars != n_chars)
{
- priv->max_width_chars = n_chars;
+ self->max_width_chars = n_chars;
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_MAX_WIDTH_CHARS]);
- gtk_widget_queue_resize (GTK_WIDGET (label));
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_MAX_WIDTH_CHARS]);
+ gtk_widget_queue_resize (GTK_WIDGET (self));
}
}
@@ -2646,13 +2595,11 @@ gtk_label_set_max_width_chars (GtkLabel *label,
* Returns: the maximum width of the label in characters.
**/
gint
-gtk_label_get_max_width_chars (GtkLabel *label)
+gtk_label_get_max_width_chars (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), -1);
- g_return_val_if_fail (GTK_IS_LABEL (label), -1);
-
- return priv->max_width_chars;
+ return self->max_width_chars;
}
/**
@@ -2671,22 +2618,20 @@ gtk_label_get_max_width_chars (GtkLabel *label)
* set the label’s width using gtk_widget_set_size_request().
**/
void
-gtk_label_set_wrap (GtkLabel *label,
+gtk_label_set_wrap (GtkLabel *self,
gboolean wrap)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
wrap = wrap != FALSE;
- if (priv->wrap != wrap)
+ if (self->wrap != wrap)
{
- priv->wrap = wrap;
+ self->wrap = wrap;
- gtk_label_clear_layout (label);
- gtk_widget_queue_resize (GTK_WIDGET (label));
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_WRAP]);
+ gtk_label_clear_layout (self);
+ gtk_widget_queue_resize (GTK_WIDGET (self));
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_WRAP]);
}
}
@@ -2700,13 +2645,11 @@ gtk_label_set_wrap (GtkLabel *label,
* Returns: %TRUE if the lines of the label are automatically wrapped.
*/
gboolean
-gtk_label_get_wrap (GtkLabel *label)
+gtk_label_get_wrap (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), FALSE);
- g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
-
- return priv->wrap;
+ return self->wrap;
}
/**
@@ -2719,19 +2662,17 @@ gtk_label_get_wrap (GtkLabel *label)
* wrap on word boundaries.
**/
void
-gtk_label_set_wrap_mode (GtkLabel *label,
+gtk_label_set_wrap_mode (GtkLabel *self,
PangoWrapMode wrap_mode)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_return_if_fail (GTK_IS_LABEL (label));
-
- if (priv->wrap_mode != wrap_mode)
+ if (self->wrap_mode != wrap_mode)
{
- priv->wrap_mode = wrap_mode;
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_WRAP_MODE]);
+ self->wrap_mode = wrap_mode;
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_WRAP_MODE]);
- gtk_widget_queue_resize (GTK_WIDGET (label));
+ gtk_widget_queue_resize (GTK_WIDGET (self));
}
}
@@ -2744,21 +2685,19 @@ gtk_label_set_wrap_mode (GtkLabel *label,
* Returns: %TRUE if the lines of the label are automatically wrapped.
*/
PangoWrapMode
-gtk_label_get_wrap_mode (GtkLabel *label)
+gtk_label_get_wrap_mode (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), FALSE);
- g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
-
- return priv->wrap_mode;
+ return self->wrap_mode;
}
static void
gtk_label_destroy (GtkWidget *widget)
{
- GtkLabel *label = GTK_LABEL (widget);
+ GtkLabel *self = GTK_LABEL (widget);
- gtk_label_set_mnemonic_widget (label, NULL);
+ gtk_label_set_mnemonic_widget (self, NULL);
GTK_WIDGET_CLASS (gtk_label_parent_class)->destroy (widget);
}
@@ -2766,34 +2705,31 @@ gtk_label_destroy (GtkWidget *widget)
static void
gtk_label_finalize (GObject *object)
{
- GtkLabel *label = GTK_LABEL (object);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (object);
- g_free (priv->label);
- g_free (priv->text);
+ g_free (self->label);
+ g_free (self->text);
- g_clear_object (&priv->layout);
- g_clear_pointer (&priv->attrs, pango_attr_list_unref);
- g_clear_pointer (&priv->markup_attrs, pango_attr_list_unref);
+ g_clear_object (&self->layout);
+ g_clear_pointer (&self->attrs, pango_attr_list_unref);
+ g_clear_pointer (&self->markup_attrs, pango_attr_list_unref);
- if (priv->select_info)
- g_object_unref (priv->select_info->provider);
+ if (self->select_info)
+ g_object_unref (self->select_info->provider);
- gtk_label_clear_links (label);
- g_free (priv->select_info);
+ gtk_label_clear_links (self);
+ g_free (self->select_info);
- g_clear_pointer (&priv->popup_menu, gtk_widget_unparent);
- g_clear_object (&priv->extra_menu);
+ g_clear_pointer (&self->popup_menu, gtk_widget_unparent);
+ g_clear_object (&self->extra_menu);
G_OBJECT_CLASS (gtk_label_parent_class)->finalize (object);
}
static void
-gtk_label_clear_layout (GtkLabel *label)
+gtk_label_clear_layout (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- g_clear_object (&priv->layout);
+ g_clear_object (&self->layout);
}
/**
@@ -2810,17 +2746,16 @@ gtk_label_clear_layout (GtkLabel *label)
* Returns: a new reference to a pango layout
**/
static PangoLayout *
-gtk_label_get_measuring_layout (GtkLabel * label,
+gtk_label_get_measuring_layout (GtkLabel *self,
PangoLayout *existing_layout,
int width)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
PangoRectangle rect;
PangoLayout *copy;
if (existing_layout != NULL)
{
- if (existing_layout != priv->layout)
+ if (existing_layout != self->layout)
{
pango_layout_set_width (existing_layout, width);
return existing_layout;
@@ -2829,23 +2764,23 @@ gtk_label_get_measuring_layout (GtkLabel * label,
g_object_unref (existing_layout);
}
- gtk_label_ensure_layout (label);
+ gtk_label_ensure_layout (self);
- if (pango_layout_get_width (priv->layout) == width)
+ if (pango_layout_get_width (self->layout) == width)
{
- g_object_ref (priv->layout);
- return priv->layout;
+ g_object_ref (self->layout);
+ return self->layout;
}
/* We can use the label's own layout if we're not allocated a size yet,
* because we don't need it to be properly setup at that point.
* This way we can make use of caching upon the label's creation.
*/
- if (gtk_widget_get_width (GTK_WIDGET (label)) <= 1)
+ if (gtk_widget_get_width (GTK_WIDGET (self)) <= 1)
{
- g_object_ref (priv->layout);
- pango_layout_set_width (priv->layout, width);
- return priv->layout;
+ g_object_ref (self->layout);
+ pango_layout_set_width (self->layout, width);
+ return self->layout;
}
/* oftentimes we want to measure a width that is far wider than the current width,
@@ -2853,41 +2788,40 @@ gtk_label_get_measuring_layout (GtkLabel * label,
* can just return the current layout, because for measuring purposes, it will be
* identical.
*/
- pango_layout_get_extents (priv->layout, NULL, &rect);
+ pango_layout_get_extents (self->layout, NULL, &rect);
if ((width == -1 || rect.width <= width) &&
- !pango_layout_is_wrapped (priv->layout) &&
- !pango_layout_is_ellipsized (priv->layout))
+ !pango_layout_is_wrapped (self->layout) &&
+ !pango_layout_is_ellipsized (self->layout))
{
- g_object_ref (priv->layout);
- return priv->layout;
+ g_object_ref (self->layout);
+ return self->layout;
}
- copy = pango_layout_copy (priv->layout);
+ copy = pango_layout_copy (self->layout);
pango_layout_set_width (copy, width);
return copy;
}
static void
-gtk_label_update_layout_attributes (GtkLabel *label)
+gtk_label_update_layout_attributes (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkWidget *widget = GTK_WIDGET (label);
+ GtkWidget *widget = GTK_WIDGET (self);
GtkCssStyle *style;
PangoAttrList *attrs;
PangoAttrList *style_attrs;
- if (priv->layout == NULL)
+ if (self->layout == NULL)
return;
- if (priv->select_info && priv->select_info->links)
+ if (self->select_info && self->select_info->links)
{
guint i;
attrs = pango_attr_list_new ();
- for (i = 0; i < priv->select_info->n_links; i++)
+ for (i = 0; i < self->select_info->n_links; i++)
{
- const GtkLabelLink *link = &priv->select_info->links[i];
+ const GtkLabelLink *link = &self->select_info->links[i];
const GdkRGBA *link_color;
PangoAttrList *link_attrs;
PangoAttribute *attr;
@@ -2920,7 +2854,7 @@ gtk_label_update_layout_attributes (GtkLabel *label)
pango_attr_list_unref (link_attrs);
}
}
- else if (priv->markup_attrs && priv->attrs)
+ else if (self->markup_attrs && self->attrs)
attrs = pango_attr_list_new ();
else
attrs = NULL;
@@ -2933,32 +2867,31 @@ gtk_label_update_layout_attributes (GtkLabel *label)
pango_attr_list_unref (style_attrs);
}
- attrs = _gtk_pango_attr_list_merge (attrs, priv->markup_attrs);
- attrs = _gtk_pango_attr_list_merge (attrs, priv->attrs);
+ attrs = _gtk_pango_attr_list_merge (attrs, self->markup_attrs);
+ attrs = _gtk_pango_attr_list_merge (attrs, self->attrs);
- pango_layout_set_attributes (priv->layout, attrs);
+ pango_layout_set_attributes (self->layout, attrs);
if (attrs)
pango_attr_list_unref (attrs);
}
static void
-gtk_label_ensure_layout (GtkLabel *label)
+gtk_label_ensure_layout (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
PangoAlignment align;
gboolean rtl;
- if (priv->layout)
+ if (self->layout)
return;
align = PANGO_ALIGN_LEFT; /* Quiet gcc */
- rtl = _gtk_widget_get_direction (GTK_WIDGET (label)) == GTK_TEXT_DIR_RTL;
- priv->layout = gtk_widget_create_pango_layout (GTK_WIDGET (label), priv->text);
+ rtl = _gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL;
+ self->layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), self->text);
- gtk_label_update_layout_attributes (label);
+ gtk_label_update_layout_attributes (self);
- switch (priv->jtype)
+ switch (self->jtype)
{
case GTK_JUSTIFY_LEFT:
align = rtl ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT;
@@ -2971,30 +2904,29 @@ gtk_label_ensure_layout (GtkLabel *label)
break;
case GTK_JUSTIFY_FILL:
align = rtl ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT;
- pango_layout_set_justify (priv->layout, TRUE);
+ pango_layout_set_justify (self->layout, TRUE);
break;
default:
g_assert_not_reached();
}
- pango_layout_set_alignment (priv->layout, align);
- pango_layout_set_ellipsize (priv->layout, priv->ellipsize);
- pango_layout_set_wrap (priv->layout, priv->wrap_mode);
- pango_layout_set_single_paragraph_mode (priv->layout, priv->single_line_mode);
- if (priv->lines > 0)
- pango_layout_set_height (priv->layout, - priv->lines);
+ pango_layout_set_alignment (self->layout, align);
+ pango_layout_set_ellipsize (self->layout, self->ellipsize);
+ pango_layout_set_wrap (self->layout, self->wrap_mode);
+ pango_layout_set_single_paragraph_mode (self->layout, self->single_line_mode);
+ if (self->lines > 0)
+ pango_layout_set_height (self->layout, - self->lines);
- if (priv->ellipsize || priv->wrap)
- pango_layout_set_width (priv->layout, gtk_widget_get_width (GTK_WIDGET (label)) * PANGO_SCALE);
+ if (self->ellipsize || self->wrap)
+ pango_layout_set_width (self->layout, gtk_widget_get_width (GTK_WIDGET (self)) * PANGO_SCALE);
}
static GtkSizeRequestMode
gtk_label_get_request_mode (GtkWidget *widget)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (widget);
- if (priv->wrap)
+ if (self->wrap)
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
@@ -3002,7 +2934,7 @@ gtk_label_get_request_mode (GtkWidget *widget)
static void
-get_height_for_width (GtkLabel *label,
+get_height_for_width (GtkLabel *self,
gint width,
gint *minimum_height,
gint *natural_height,
@@ -3012,7 +2944,7 @@ get_height_for_width (GtkLabel *label,
PangoLayout *layout;
gint text_height, baseline;
- layout = gtk_label_get_measuring_layout (label, NULL, width * PANGO_SCALE);
+ layout = gtk_label_get_measuring_layout (self, NULL, width * PANGO_SCALE);
pango_layout_get_pixel_size (layout, NULL, &text_height);
@@ -3027,7 +2959,7 @@ get_height_for_width (GtkLabel *label,
}
static gint
-get_char_pixels (GtkWidget *label,
+get_char_pixels (GtkWidget *self,
PangoLayout *layout)
{
PangoContext *context;
@@ -3046,23 +2978,22 @@ get_char_pixels (GtkWidget *label,
}
static void
-gtk_label_get_preferred_layout_size (GtkLabel *label,
+gtk_label_get_preferred_layout_size (GtkLabel *self,
PangoRectangle *smallest,
PangoRectangle *widest,
int *smallest_baseline,
int *widest_baseline)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
PangoLayout *layout;
gint char_pixels;
/* "width-chars" Hard-coded minimum width:
* - minimum size should be MAX (width-chars, strlen ("..."));
- * - natural size should be MAX (width-chars, strlen (priv->text));
+ * - natural size should be MAX (width-chars, strlen (self->text));
*
* "max-width-chars" User specified maximum size requisition
* - minimum size should be MAX (width-chars, 0)
- * - natural size should be MIN (max-width-chars, strlen (priv->text))
+ * - natural size should be MIN (max-width-chars, strlen (self->text))
*
* For ellipsizing labels; if max-width-chars is specified: either it is used as
* a minimum size or the label text as a minimum size (natural size still overflows).
@@ -3073,39 +3004,39 @@ gtk_label_get_preferred_layout_size (GtkLabel *label,
*/
/* Start off with the pixel extents of an as-wide-as-possible layout */
- layout = gtk_label_get_measuring_layout (label, NULL, -1);
+ layout = gtk_label_get_measuring_layout (self, NULL, -1);
- if (priv->width_chars > -1 || priv->max_width_chars > -1)
- char_pixels = get_char_pixels (GTK_WIDGET (label), layout);
+ if (self->width_chars > -1 || self->max_width_chars > -1)
+ char_pixels = get_char_pixels (GTK_WIDGET (self), layout);
else
char_pixels = 0;
pango_layout_get_extents (layout, NULL, widest);
- widest->width = MAX (widest->width, char_pixels * priv->width_chars);
+ widest->width = MAX (widest->width, char_pixels * self->width_chars);
widest->x = widest->y = 0;
*widest_baseline = pango_layout_get_baseline (layout) / PANGO_SCALE;
- if (priv->ellipsize || priv->wrap)
+ if (self->ellipsize || self->wrap)
{
/* a layout with width 0 will be as small as humanly possible */
- layout = gtk_label_get_measuring_layout (label,
+ layout = gtk_label_get_measuring_layout (self,
layout,
- priv->width_chars > -1 ? char_pixels * priv->width_chars
+ self->width_chars > -1 ? char_pixels * self->width_chars
: 0);
pango_layout_get_extents (layout, NULL, smallest);
- smallest->width = MAX (smallest->width, char_pixels * priv->width_chars);
+ smallest->width = MAX (smallest->width, char_pixels * self->width_chars);
smallest->x = smallest->y = 0;
*smallest_baseline = pango_layout_get_baseline (layout) / PANGO_SCALE;
- if (priv->max_width_chars > -1 && widest->width > char_pixels * priv->max_width_chars)
+ if (self->max_width_chars > -1 && widest->width > char_pixels * self->max_width_chars)
{
- layout = gtk_label_get_measuring_layout (label,
+ layout = gtk_label_get_measuring_layout (self,
layout,
- MAX (smallest->width, char_pixels * priv->max_width_chars));
+ MAX (smallest->width, char_pixels * self->max_width_chars));
pango_layout_get_extents (layout, NULL, widest);
- widest->width = MAX (widest->width, char_pixels * priv->width_chars);
+ widest->width = MAX (widest->width, char_pixels * self->width_chars);
widest->x = widest->y = 0;
*widest_baseline = pango_layout_get_baseline (layout) / PANGO_SCALE;
@@ -3134,13 +3065,13 @@ gtk_label_get_preferred_size (GtkWidget *widget,
gint *minimum_baseline,
gint *natural_baseline)
{
- GtkLabel *label = GTK_LABEL (widget);
+ GtkLabel *self = GTK_LABEL (widget);
PangoRectangle widest_rect;
PangoRectangle smallest_rect;
int smallest_baseline;
int widest_baseline;
- gtk_label_get_preferred_layout_size (label,
+ gtk_label_get_preferred_layout_size (self,
&smallest_rect, &widest_rect,
&smallest_baseline, &widest_baseline);
@@ -3194,26 +3125,24 @@ gtk_label_measure (GtkWidget *widget,
int *minimum_baseline,
int *natural_baseline)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (widget);
- if (orientation == GTK_ORIENTATION_VERTICAL && for_size != -1 && priv->wrap)
+ if (orientation == GTK_ORIENTATION_VERTICAL && for_size != -1 && self->wrap)
{
- gtk_label_clear_layout (label);
+ gtk_label_clear_layout (self);
- get_height_for_width (label, for_size, minimum, natural, minimum_baseline, natural_baseline);
+ get_height_for_width (self, for_size, minimum, natural, minimum_baseline, natural_baseline);
}
else
gtk_label_get_preferred_size (widget, orientation, minimum, natural, minimum_baseline, natural_baseline);
}
static void
-get_layout_location (GtkLabel *label,
+get_layout_location (GtkLabel *self,
gint *xp,
gint *yp)
{
- GtkWidget *widget = GTK_WIDGET (label);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkWidget *widget = GTK_WIDGET (self);
gint req_width, x, y;
gint req_height;
gfloat xalign, yalign;
@@ -3221,13 +3150,13 @@ get_layout_location (GtkLabel *label,
gint baseline, layout_baseline, baseline_offset;
int label_width, label_height;
- xalign = priv->xalign;
- yalign = priv->yalign;
+ xalign = self->xalign;
+ yalign = self->yalign;
if (_gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
xalign = 1.0 - xalign;
- pango_layout_get_extents (priv->layout, NULL, &logical);
+ pango_layout_get_extents (self->layout, NULL, &logical);
pango_extents_to_pixels (&logical, NULL);
@@ -3244,7 +3173,7 @@ get_layout_location (GtkLabel *label,
baseline_offset = 0;
if (baseline != -1)
{
- layout_baseline = pango_layout_get_baseline (priv->layout) / PANGO_SCALE;
+ layout_baseline = pango_layout_get_baseline (self->layout) / PANGO_SCALE;
baseline_offset = baseline - layout_baseline;
yalign = 0.0; /* Can't support yalign while baseline aligning */
}
@@ -3262,7 +3191,7 @@ get_layout_location (GtkLabel *label,
* - Multi-line labels should not be clipped to showing "something in the
* middle". You want to read the first line, at least, to get some context.
*/
- if (pango_layout_get_line_count (priv->layout) == 1)
+ if (pango_layout_get_line_count (self->layout) == 1)
y = floor ((label_height - req_height) * yalign) + baseline_offset;
else
y = floor (MAX ((label_height - req_height) * yalign, 0)) + baseline_offset;
@@ -3280,35 +3209,33 @@ gtk_label_size_allocate (GtkWidget *widget,
int height,
int baseline)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (widget);
- if (priv->layout)
+ if (self->layout)
{
- if (priv->ellipsize || priv->wrap)
- pango_layout_set_width (priv->layout, width * PANGO_SCALE);
+ if (self->ellipsize || self->wrap)
+ pango_layout_set_width (self->layout, width * PANGO_SCALE);
else
- pango_layout_set_width (priv->layout, -1);
+ pango_layout_set_width (self->layout, -1);
}
- if (priv->popup_menu)
- gtk_native_check_resize (GTK_NATIVE (priv->popup_menu));
+ if (self->popup_menu)
+ gtk_native_check_resize (GTK_NATIVE (self->popup_menu));
}
static void
-gtk_label_update_cursor (GtkLabel *label)
+gtk_label_update_cursor (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkWidget *widget = GTK_WIDGET (label);
+ GtkWidget *widget = GTK_WIDGET (self);
- if (!priv->select_info)
+ if (!self->select_info)
return;
if (gtk_widget_is_sensitive (widget))
{
- if (priv->select_info->active_link)
+ if (self->select_info->active_link)
gtk_widget_set_cursor_from_name (widget, "pointer");
- else if (priv->select_info->selectable)
+ else if (self->select_info->selectable)
gtk_widget_set_cursor_from_name (widget, "text");
else
gtk_widget_set_cursor (widget, NULL);
@@ -3318,27 +3245,26 @@ gtk_label_update_cursor (GtkLabel *label)
}
static void
-update_link_state (GtkLabel *label)
+update_link_state (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
GtkStateFlags state;
guint i;
- if (!priv->select_info)
+ if (!self->select_info)
return;
- for (i = 0; i < priv->select_info->n_links; i++)
+ for (i = 0; i < self->select_info->n_links; i++)
{
- const GtkLabelLink *link = &priv->select_info->links[i];
+ const GtkLabelLink *link = &self->select_info->links[i];
- state = gtk_widget_get_state_flags (GTK_WIDGET (label));
+ state = gtk_widget_get_state_flags (GTK_WIDGET (self));
if (link->visited)
state |= GTK_STATE_FLAG_VISITED;
else
state |= GTK_STATE_FLAG_LINK;
- if (link == priv->select_info->active_link)
+ if (link == self->select_info->active_link)
{
- if (priv->select_info->link_clicked)
+ if (self->select_info->link_clicked)
state |= GTK_STATE_FLAG_ACTIVE;
else
state |= GTK_STATE_FLAG_PRELIGHT;
@@ -3351,16 +3277,15 @@ static void
gtk_label_state_flags_changed (GtkWidget *widget,
GtkStateFlags prev_state)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (widget);
- if (priv->select_info)
+ if (self->select_info)
{
if (!gtk_widget_is_sensitive (widget))
- gtk_label_select_region (label, 0, 0);
+ gtk_label_select_region (self, 0, 0);
- gtk_label_update_cursor (label);
- update_link_state (label);
+ gtk_label_update_cursor (self);
+ update_link_state (self);
}
if (GTK_WIDGET_CLASS (gtk_label_parent_class)->state_flags_changed)
@@ -3371,38 +3296,36 @@ static void
gtk_label_css_changed (GtkWidget *widget,
GtkCssStyleChange *change)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (widget);
GTK_WIDGET_CLASS (gtk_label_parent_class)->css_changed (widget, change);
if (change == NULL || gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_ATTRS) ||
- (priv->select_info && priv->select_info->links))
- gtk_label_update_layout_attributes (label);
+ (self->select_info && self->select_info->links))
+ gtk_label_update_layout_attributes (self);
}
static PangoDirection
-get_cursor_direction (GtkLabel *label)
+get_cursor_direction (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
GSList *l;
- g_assert (priv->select_info);
+ g_assert (self->select_info);
- gtk_label_ensure_layout (label);
+ gtk_label_ensure_layout (self);
- for (l = pango_layout_get_lines_readonly (priv->layout); l; l = l->next)
+ for (l = pango_layout_get_lines_readonly (self->layout); l; l = l->next)
{
PangoLayoutLine *line = l->data;
- /* If priv->select_info->selection_end is at the very end of
+ /* If self->select_info->selection_end is at the very end of
* the line, we don't know if the cursor is on this line or
* the next without looking ahead at the next line. (End
* of paragraph is different from line break.) But it's
* definitely in this paragraph, which is good enough
* to figure out the resolved direction.
*/
- if (line->start_index + line->length >= priv->select_info->selection_end)
+ if (line->start_index + line->length >= self->select_info->selection_end)
return line->resolved_dir;
}
@@ -3410,18 +3333,17 @@ get_cursor_direction (GtkLabel *label)
}
static GtkLabelLink *
-gtk_label_get_focus_link (GtkLabel *label,
+gtk_label_get_focus_link (GtkLabel *self,
int *out_index)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelSelectionInfo *info = priv->select_info;
+ GtkLabelSelectionInfo *info = self->select_info;
int link_index;
if (!info ||
info->selection_anchor != info->selection_end)
goto nope;
- link_index = _gtk_label_get_link_at (label, info->selection_anchor);
+ link_index = _gtk_label_get_link_at (self, info->selection_anchor);
if (link_index != -1)
{
@@ -3443,16 +3365,15 @@ static void
gtk_label_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (widget);
GtkLabelSelectionInfo *info;
GtkStyleContext *context;
gint lx, ly;
int width, height, x;
- info = priv->select_info;
+ info = self->select_info;
- gtk_label_ensure_layout (label);
+ gtk_label_ensure_layout (self);
context = _gtk_widget_get_style_context (widget);
@@ -3460,11 +3381,11 @@ gtk_label_snapshot (GtkWidget *widget,
height = gtk_widget_get_height (widget);
x = 0;
- if (priv->text && (*priv->text != '\0'))
+ if (self->text && (*self->text != '\0'))
{
- get_layout_location (label, &lx, &ly);
+ get_layout_location (self, &lx, &ly);
- gtk_snapshot_render_layout (snapshot, context, lx, ly, priv->layout);
+ gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
if (info && (info->selection_anchor != info->selection_end))
{
@@ -3485,14 +3406,14 @@ gtk_label_snapshot (GtkWidget *widget,
gtk_style_context_save_to_node (context, info->selection_node);
- range_clip = gdk_pango_layout_get_clip_region (priv->layout, lx, ly, range, 1);
+ range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
for (i = 0; i < cairo_region_num_rectangles (range_clip); i++)
{
cairo_region_get_rectangle (range_clip, i, &clip_rect);
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect));
gtk_snapshot_render_background (snapshot, context, x, 0, width, height);
- gtk_snapshot_render_layout (snapshot, context, lx, ly, priv->layout);
+ gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
gtk_snapshot_pop (snapshot);
}
@@ -3516,14 +3437,14 @@ gtk_label_snapshot (GtkWidget *widget,
{
PangoDirection cursor_direction;
- cursor_direction = get_cursor_direction (label);
+ cursor_direction = get_cursor_direction (self);
gtk_snapshot_render_insertion_cursor (snapshot, context,
lx, ly,
- priv->layout, priv->select_info->selection_end,
+ self->layout, self->select_info->selection_end,
cursor_direction);
}
- focus_link = gtk_label_get_focus_link (label, NULL);
+ focus_link = gtk_label_get_focus_link (self, NULL);
active_link = info->active_link;
if (active_link)
@@ -3533,14 +3454,14 @@ gtk_label_snapshot (GtkWidget *widget,
gtk_style_context_save_to_node (context, active_link->cssnode);
- range_clip = gdk_pango_layout_get_clip_region (priv->layout, lx, ly, range, 1);
+ range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
for (i = 0; i < cairo_region_num_rectangles (range_clip); i++)
{
cairo_region_get_rectangle (range_clip, i, &clip_rect);
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect));
gtk_snapshot_render_background (snapshot, context, x, 0, width, height);
- gtk_snapshot_render_layout (snapshot, context, lx, ly, priv->layout);
+ gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
gtk_snapshot_pop (snapshot);
}
@@ -3556,7 +3477,7 @@ gtk_label_snapshot (GtkWidget *widget,
gtk_style_context_save_to_node (context, focus_link->cssnode);
- range_clip = gdk_pango_layout_get_clip_region (priv->layout, lx, ly, range, 1);
+ range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
cairo_region_get_extents (range_clip, &rect);
gtk_snapshot_render_focus (snapshot, context, rect.x, rect.y, rect.width, rect.height);
@@ -3581,45 +3502,43 @@ gtk_label_snapshot (GtkWidget *widget,
* automatically, or explicitly using gtk_label_set_mnemonic_widget().
**/
void
-gtk_label_set_text_with_mnemonic (GtkLabel *label,
+gtk_label_set_text_with_mnemonic (GtkLabel *self,
const gchar *str)
{
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
g_return_if_fail (str != NULL);
- g_object_freeze_notify (G_OBJECT (label));
+ g_object_freeze_notify (G_OBJECT (self));
- gtk_label_set_label_internal (label, g_strdup (str));
- gtk_label_set_use_markup_internal (label, FALSE);
- gtk_label_set_use_underline_internal (label, TRUE);
+ gtk_label_set_label_internal (self, g_strdup (str));
+ gtk_label_set_use_markup_internal (self, FALSE);
+ gtk_label_set_use_underline_internal (self, TRUE);
- gtk_label_recalculate (label);
+ gtk_label_recalculate (self);
- g_object_thaw_notify (G_OBJECT (label));
+ g_object_thaw_notify (G_OBJECT (self));
}
static void
gtk_label_unrealize (GtkWidget *widget)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (widget);
GdkClipboard *clipboard;
clipboard = gtk_widget_get_primary_clipboard (widget);
- if (priv->select_info &&
- gdk_clipboard_get_content (clipboard) == priv->select_info->provider)
+ if (self->select_info &&
+ gdk_clipboard_get_content (clipboard) == self->select_info->provider)
gdk_clipboard_set_content (clipboard, NULL);
GTK_WIDGET_CLASS (gtk_label_parent_class)->unrealize (widget);
}
static gboolean
-get_layout_index (GtkLabel *label,
+get_layout_index (GtkLabel *self,
gint x,
gint y,
gint *index)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
gint trailing = 0;
const gchar *cluster;
const gchar *cluster_end;
@@ -3628,8 +3547,8 @@ get_layout_index (GtkLabel *label,
*index = 0;
- gtk_label_ensure_layout (label);
- get_layout_location (label, &lx, &ly);
+ gtk_label_ensure_layout (self);
+ get_layout_location (self, &lx, &ly);
/* Translate x/y to layout position */
x -= lx;
@@ -3638,11 +3557,11 @@ get_layout_index (GtkLabel *label,
x *= PANGO_SCALE;
y *= PANGO_SCALE;
- inside = pango_layout_xy_to_index (priv->layout,
+ inside = pango_layout_xy_to_index (self->layout,
x, y,
index, &trailing);
- cluster = priv->text + *index;
+ cluster = self->text + *index;
cluster_end = cluster;
while (trailing)
{
@@ -3656,25 +3575,24 @@ get_layout_index (GtkLabel *label,
}
static gboolean
-range_is_in_ellipsis_full (GtkLabel *label,
+range_is_in_ellipsis_full (GtkLabel *self,
gint range_start,
gint range_end,
gint *ellipsis_start,
gint *ellipsis_end)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
PangoLayoutIter *iter;
gboolean in_ellipsis;
- if (!priv->ellipsize)
+ if (!self->ellipsize)
return FALSE;
- gtk_label_ensure_layout (label);
+ gtk_label_ensure_layout (self);
- if (!pango_layout_is_ellipsized (priv->layout))
+ if (!pango_layout_is_ellipsized (self->layout))
return FALSE;
- iter = pango_layout_get_iter (priv->layout);
+ iter = pango_layout_get_iter (self->layout);
in_ellipsis = FALSE;
@@ -3711,71 +3629,69 @@ range_is_in_ellipsis_full (GtkLabel *label,
}
static gboolean
-range_is_in_ellipsis (GtkLabel *label,
+range_is_in_ellipsis (GtkLabel *self,
gint range_start,
gint range_end)
{
- return range_is_in_ellipsis_full (label, range_start, range_end, NULL, NULL);
+ return range_is_in_ellipsis_full (self, range_start, range_end, NULL, NULL);
}
static void
-gtk_label_select_word (GtkLabel *label)
+gtk_label_select_word (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
gint min, max;
- gint start_index = gtk_label_move_backward_word (label, priv->select_info->selection_end);
- gint end_index = gtk_label_move_forward_word (label, priv->select_info->selection_end);
+ gint start_index = gtk_label_move_backward_word (self, self->select_info->selection_end);
+ gint end_index = gtk_label_move_forward_word (self, self->select_info->selection_end);
- min = MIN (priv->select_info->selection_anchor,
- priv->select_info->selection_end);
- max = MAX (priv->select_info->selection_anchor,
- priv->select_info->selection_end);
+ min = MIN (self->select_info->selection_anchor,
+ self->select_info->selection_end);
+ max = MAX (self->select_info->selection_anchor,
+ self->select_info->selection_end);
min = MIN (min, start_index);
max = MAX (max, end_index);
- gtk_label_select_region_index (label, min, max);
+ gtk_label_select_region_index (self, min, max);
}
static gboolean
gtk_label_grab_focus (GtkWidget *widget)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (widget);
gboolean select_on_focus;
- if (priv->select_info == NULL)
+ if (self->select_info == NULL)
return FALSE;
if (!GTK_WIDGET_CLASS (gtk_label_parent_class)->grab_focus (widget))
return FALSE;
- if (priv->select_info->selectable)
+ if (self->select_info->selectable)
{
g_object_get (gtk_widget_get_settings (widget),
"gtk-label-select-on-focus",
&select_on_focus,
NULL);
- if (select_on_focus && !priv->in_click)
- gtk_label_select_region (label, 0, -1);
+ if (select_on_focus && !self->in_click)
+ gtk_label_select_region (self, 0, -1);
}
else
{
- if (priv->select_info->links && !priv->in_click)
+ if (self->select_info->links && !self->in_click)
{
guint i;
- for (i = 0; i < priv->select_info->n_links; i++)
+ for (i = 0; i < self->select_info->n_links; i++)
{
- const GtkLabelLink *link = &priv->select_info->links[i];
+ const GtkLabelLink *link = &self->select_info->links[i];
- if (!range_is_in_ellipsis (label, link->start, link->end))
+ if (!range_is_in_ellipsis (self, link->start, link->end))
{
- priv->select_info->selection_anchor = link->start;
- priv->select_info->selection_end = link->start;
- _gtk_label_accessible_focus_link_changed (label);
+ self->select_info->selection_anchor = link->start;
+ self->select_info->selection_end = link->start;
+ _gtk_label_accessible_focus_link_changed (self);
break;
}
}
@@ -3789,9 +3705,8 @@ static gboolean
gtk_label_focus (GtkWidget *widget,
GtkDirectionType direction)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelSelectionInfo *info = priv->select_info;
+ GtkLabel *self = GTK_LABEL (widget);
+ GtkLabelSelectionInfo *info = self->select_info;
GtkLabelLink *focus_link;
if (!gtk_widget_is_focus (widget))
@@ -3799,18 +3714,18 @@ gtk_label_focus (GtkWidget *widget,
gtk_widget_grab_focus (widget);
if (info)
{
- focus_link = gtk_label_get_focus_link (label, NULL);
+ focus_link = gtk_label_get_focus_link (self, NULL);
if (focus_link && direction == GTK_DIR_TAB_BACKWARD)
{
int i;
for (i = info->n_links - 1; i >= 0; i--)
{
focus_link = &info->links[i];
- if (!range_is_in_ellipsis (label, focus_link->start, focus_link->end))
+ if (!range_is_in_ellipsis (self, focus_link->start, focus_link->end))
{
info->selection_anchor = focus_link->start;
info->selection_end = focus_link->start;
- _gtk_label_accessible_focus_link_changed (label);
+ _gtk_label_accessible_focus_link_changed (self);
}
}
}
@@ -3842,10 +3757,10 @@ gtk_label_focus (GtkWidget *widget,
if (link->start > index)
{
- if (!range_is_in_ellipsis (label, link->start, link->end))
+ if (!range_is_in_ellipsis (self, link->start, link->end))
{
- gtk_label_select_region_index (label, link->start, link->start);
- _gtk_label_accessible_focus_link_changed (label);
+ gtk_label_select_region_index (self, link->start, link->start);
+ _gtk_label_accessible_focus_link_changed (self);
return TRUE;
}
}
@@ -3860,10 +3775,10 @@ gtk_label_focus (GtkWidget *widget,
if (link->end < index)
{
- if (!range_is_in_ellipsis (label, link->start, link->end))
+ if (!range_is_in_ellipsis (self, link->start, link->end))
{
- gtk_label_select_region_index (label, link->start, link->start);
- _gtk_label_accessible_focus_link_changed (label);
+ gtk_label_select_region_index (self, link->start, link->start);
+ _gtk_label_accessible_focus_link_changed (self);
return TRUE;
}
}
@@ -3878,7 +3793,7 @@ gtk_label_focus (GtkWidget *widget,
int new_index = -1;
int i;
- focus_link = gtk_label_get_focus_link (label, &focus_link_index);
+ focus_link = gtk_label_get_focus_link (self, &focus_link_index);
switch (direction)
{
@@ -3891,7 +3806,7 @@ gtk_label_focus (GtkWidget *widget,
for (i = new_index; i < info->n_links; i++)
{
const GtkLabelLink *link = &info->links[i];
- if (!range_is_in_ellipsis (label, link->start, link->end))
+ if (!range_is_in_ellipsis (self, link->start, link->end))
break;
}
break;
@@ -3905,7 +3820,7 @@ gtk_label_focus (GtkWidget *widget,
for (i = new_index; i >= 0; i--)
{
const GtkLabelLink *link = &info->links[i];
- if (!range_is_in_ellipsis (label, link->start, link->end))
+ if (!range_is_in_ellipsis (self, link->start, link->end))
break;
}
break;
@@ -3923,7 +3838,7 @@ gtk_label_focus (GtkWidget *widget,
focus_link = &info->links[new_index];
info->selection_anchor = focus_link->start;
info->selection_end = focus_link->start;
- _gtk_label_accessible_focus_link_changed (label);
+ _gtk_label_accessible_focus_link_changed (self);
gtk_widget_queue_draw (widget);
return TRUE;
@@ -3940,11 +3855,10 @@ gtk_label_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble widget_x,
gdouble widget_y,
- GtkLabel *label)
+ GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelSelectionInfo *info = priv->select_info;
- GtkWidget *widget = GTK_WIDGET (label);
+ GtkLabelSelectionInfo *info = self->select_info;
+ GtkWidget *widget = GTK_WIDGET (self);
GdkEventSequence *sequence;
GdkEvent *event;
guint button;
@@ -3961,14 +3875,14 @@ gtk_label_click_gesture_pressed (GtkGestureClick *gesture,
if (gdk_event_triggers_context_menu (event))
{
info->link_clicked = TRUE;
- update_link_state (label);
- gtk_label_do_popup (label, widget_x, widget_y);
+ update_link_state (self);
+ gtk_label_do_popup (self, widget_x, widget_y);
return;
}
else if (button == GDK_BUTTON_PRIMARY)
{
info->link_clicked = TRUE;
- update_link_state (label);
+ update_link_state (self);
gtk_widget_queue_draw (widget);
if (!info->selectable)
return;
@@ -3985,22 +3899,22 @@ gtk_label_click_gesture_pressed (GtkGestureClick *gesture,
info->select_words = FALSE;
if (gdk_event_triggers_context_menu (event))
- gtk_label_do_popup (label, widget_x, widget_y);
+ gtk_label_do_popup (self, widget_x, widget_y);
else if (button == GDK_BUTTON_PRIMARY)
{
if (!gtk_widget_has_focus (widget))
{
- priv->in_click = TRUE;
+ self->in_click = TRUE;
gtk_widget_grab_focus (widget);
- priv->in_click = FALSE;
+ self->in_click = FALSE;
}
if (n_press == 3)
- gtk_label_select_region_index (label, 0, strlen (priv->text));
+ gtk_label_select_region_index (self, 0, strlen (self->text));
else if (n_press == 2)
{
info->select_words = TRUE;
- gtk_label_select_word (label);
+ gtk_label_select_word (self);
}
}
else
@@ -4018,10 +3932,9 @@ gtk_label_click_gesture_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
- GtkLabel *label)
+ GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelSelectionInfo *info = priv->select_info;
+ GtkLabelSelectionInfo *info = self->select_info;
GdkEventSequence *sequence;
gint index;
@@ -4039,36 +3952,34 @@ gtk_label_click_gesture_released (GtkGestureClick *gesture,
if (info->in_drag)
{
info->in_drag = 0;
- get_layout_index (label, x, y, &index);
- gtk_label_select_region_index (label, index, index);
+ get_layout_index (self, x, y, &index);
+ gtk_label_select_region_index (self, index, index);
}
else if (info->active_link &&
info->selection_anchor == info->selection_end &&
info->link_clicked)
{
- emit_activate_link (label, info->active_link);
+ emit_activate_link (self, info->active_link);
info->link_clicked = FALSE;
}
}
static GdkPaintable *
-get_selection_paintable (GtkLabel *label)
+get_selection_paintable (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if ((priv->select_info->selection_anchor !=
- priv->select_info->selection_end) &&
- priv->text)
+ if ((self->select_info->selection_anchor !=
+ self->select_info->selection_end) &&
+ self->text)
{
gint start, end;
gint len;
- start = MIN (priv->select_info->selection_anchor,
- priv->select_info->selection_end);
- end = MAX (priv->select_info->selection_anchor,
- priv->select_info->selection_end);
+ start = MIN (self->select_info->selection_anchor,
+ self->select_info->selection_end);
+ end = MAX (self->select_info->selection_anchor,
+ self->select_info->selection_end);
- len = strlen (priv->text);
+ len = strlen (self->text);
if (end > len)
end = len;
@@ -4076,7 +3987,7 @@ get_selection_paintable (GtkLabel *label)
if (start > len)
start = len;
- return gtk_text_util_create_drag_icon (GTK_WIDGET (label), priv->text + start, end - start);
+ return gtk_text_util_create_drag_icon (GTK_WIDGET (self), self->text + start, end - start);
}
return NULL;
@@ -4086,10 +3997,9 @@ static void
gtk_label_drag_gesture_begin (GtkGestureDrag *gesture,
gdouble start_x,
gdouble start_y,
- GtkLabel *label)
+ GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelSelectionInfo *info = priv->select_info;
+ GtkLabelSelectionInfo *info = self->select_info;
GdkModifierType state_mask;
GdkEventSequence *sequence;
GdkEvent *event;
@@ -4101,7 +4011,7 @@ gtk_label_drag_gesture_begin (GtkGestureDrag *gesture,
return;
}
- get_layout_index (label, start_x, start_y, &index);
+ get_layout_index (self, start_x, start_y, &index);
min = MIN (info->selection_anchor, info->selection_end);
max = MAX (info->selection_anchor, info->selection_end);
@@ -4135,7 +4045,7 @@ gtk_label_drag_gesture_begin (GtkGestureDrag *gesture,
max = tmp;
}
- gtk_label_select_region_index (label, min, max);
+ gtk_label_select_region_index (self, min, max);
}
else
{
@@ -4147,7 +4057,7 @@ gtk_label_drag_gesture_begin (GtkGestureDrag *gesture,
}
else
/* start a replacement */
- gtk_label_select_region_index (label, index, index);
+ gtk_label_select_region_index (self, index, index);
}
}
@@ -4155,11 +4065,10 @@ static void
gtk_label_drag_gesture_update (GtkGestureDrag *gesture,
gdouble offset_x,
gdouble offset_y,
- GtkLabel *label)
+ GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelSelectionInfo *info = priv->select_info;
- GtkWidget *widget = GTK_WIDGET (label);
+ GtkLabelSelectionInfo *info = self->select_info;
+ GtkWidget *widget = GTK_WIDGET (self);
GdkEventSequence *sequence;
gdouble x, y;
gint index;
@@ -4188,7 +4097,7 @@ gtk_label_drag_gesture_update (GtkGestureDrag *gesture,
info->drag_start_x,
info->drag_start_y);
- gtk_drag_icon_set_from_paintable (drag, get_selection_paintable (label), 0, 0);
+ gtk_drag_icon_set_from_paintable (drag, get_selection_paintable (self), 0, 0);
g_object_unref (drag);
@@ -4197,7 +4106,7 @@ gtk_label_drag_gesture_update (GtkGestureDrag *gesture,
}
else
{
- get_layout_index (label, x, y, &index);
+ get_layout_index (self, x, y, &index);
if (index != info->selection_anchor)
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
@@ -4208,8 +4117,8 @@ gtk_label_drag_gesture_update (GtkGestureDrag *gesture,
gint old_min, old_max;
gint anchor, end;
- min = gtk_label_move_backward_word (label, index);
- max = gtk_label_move_forward_word (label, index);
+ min = gtk_label_move_backward_word (self, index);
+ max = gtk_label_move_forward_word (self, index);
anchor = info->selection_anchor;
end = info->selection_end;
@@ -4238,10 +4147,10 @@ gtk_label_drag_gesture_update (GtkGestureDrag *gesture,
anchor = min;
}
- gtk_label_select_region_index (label, anchor, end);
+ gtk_label_select_region_index (self, anchor, end);
}
else
- gtk_label_select_region_index (label, info->selection_anchor, index);
+ gtk_label_select_region_index (self, info->selection_anchor, index);
}
}
@@ -4250,9 +4159,8 @@ gtk_label_update_active_link (GtkWidget *widget,
gdouble x,
gdouble y)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelSelectionInfo *info = priv->select_info;
+ GtkLabel *self = GTK_LABEL (widget);
+ GtkLabelSelectionInfo *info = self->select_info;
gint index;
if (info == NULL)
@@ -4265,15 +4173,15 @@ gtk_label_update_active_link (GtkWidget *widget,
if (info->selection_anchor == info->selection_end)
{
- if (get_layout_index (label, x, y, &index))
+ if (get_layout_index (self, x, y, &index))
{
- const int link_index = _gtk_label_get_link_at (label, index);
+ const int link_index = _gtk_label_get_link_at (self, index);
if (link_index != -1)
{
link = &info->links[link_index];
- if (!range_is_in_ellipsis (label, link->start, link->end))
+ if (!range_is_in_ellipsis (self, link->start, link->end))
found = TRUE;
}
}
@@ -4285,8 +4193,8 @@ gtk_label_update_active_link (GtkWidget *widget,
{
info->link_clicked = FALSE;
info->active_link = link;
- update_link_state (label);
- gtk_label_update_cursor (label);
+ update_link_state (self);
+ gtk_label_update_cursor (self);
gtk_widget_queue_draw (widget);
}
}
@@ -4296,13 +4204,13 @@ gtk_label_update_active_link (GtkWidget *widget,
{
info->link_clicked = FALSE;
info->active_link = NULL;
- update_link_state (label);
- gtk_label_update_cursor (label);
+ update_link_state (self);
+ gtk_label_update_cursor (self);
gtk_widget_queue_draw (widget);
}
}
- gtk_label_update_actions (label);
+ gtk_label_update_actions (self);
}
}
@@ -4320,14 +4228,13 @@ gtk_label_leave (GtkEventControllerMotion *controller,
GdkCrossingMode mode,
gpointer data)
{
- GtkLabel *label = GTK_LABEL (data);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = GTK_LABEL (data);
- if (priv->select_info)
+ if (self->select_info)
{
- priv->select_info->active_link = NULL;
- gtk_label_update_cursor (label);
- gtk_widget_queue_draw (GTK_WIDGET (label));
+ self->select_info->active_link = NULL;
+ gtk_label_update_cursor (self);
+ gtk_widget_queue_draw (GTK_WIDGET (self));
}
}
@@ -4378,23 +4285,23 @@ gtk_label_content_get_value (GdkContentProvider *provider,
if (G_VALUE_HOLDS (value, G_TYPE_STRING) &&
content->label != NULL)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (content->label);
+ GtkLabel *self = content->label;
- if (priv->select_info &&
- (priv->select_info->selection_anchor !=
- priv->select_info->selection_end) &&
- priv->text)
+ if (self->select_info &&
+ (self->select_info->selection_anchor !=
+ self->select_info->selection_end) &&
+ self->text)
{
gint start, end;
gint len;
char *str;
- start = MIN (priv->select_info->selection_anchor,
- priv->select_info->selection_end);
- end = MAX (priv->select_info->selection_anchor,
- priv->select_info->selection_end);
+ start = MIN (self->select_info->selection_anchor,
+ self->select_info->selection_end);
+ end = MAX (self->select_info->selection_anchor,
+ self->select_info->selection_end);
- len = strlen (priv->text);
+ len = strlen (self->text);
if (end > len)
end = len;
@@ -4402,7 +4309,7 @@ gtk_label_content_get_value (GdkContentProvider *provider,
if (start > len)
start = len;
- str = g_strndup (priv->text + start, end - start);
+ str = g_strndup (self->text + start, end - start);
g_value_take_string (value, str);
return TRUE;
}
@@ -4416,15 +4323,14 @@ gtk_label_content_detach (GdkContentProvider *provider,
GdkClipboard *clipboard)
{
GtkLabelContent *content = GTK_LABEL_CONTENT (provider);
- GtkLabel *label = content->label;
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkLabel *self = content->label;
- if (label == NULL || priv->select_info == NULL)
+ if (self == NULL || self->select_info == NULL)
return;
- priv->select_info->selection_anchor = priv->select_info->selection_end;
+ self->select_info->selection_anchor = self->select_info->selection_end;
- gtk_widget_queue_draw (GTK_WIDGET (label));
+ gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
@@ -4443,69 +4349,65 @@ gtk_label_content_init (GtkLabelContent *content)
}
static void
-gtk_label_ensure_select_info (GtkLabel *label)
+gtk_label_ensure_select_info (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->select_info == NULL)
+ if (self->select_info == NULL)
{
- priv->select_info = g_new0 (GtkLabelSelectionInfo, 1);
+ self->select_info = g_new0 (GtkLabelSelectionInfo, 1);
- gtk_widget_set_can_focus (GTK_WIDGET (label), TRUE);
+ gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
- priv->select_info->drag_gesture = gtk_gesture_drag_new ();
- g_signal_connect (priv->select_info->drag_gesture, "drag-begin",
- G_CALLBACK (gtk_label_drag_gesture_begin), label);
- g_signal_connect (priv->select_info->drag_gesture, "drag-update",
- G_CALLBACK (gtk_label_drag_gesture_update), label);
- gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->select_info->drag_gesture), TRUE);
- gtk_widget_add_controller (GTK_WIDGET (label), GTK_EVENT_CONTROLLER (priv->select_info->drag_gesture));
+ self->select_info->drag_gesture = gtk_gesture_drag_new ();
+ g_signal_connect (self->select_info->drag_gesture, "drag-begin",
+ G_CALLBACK (gtk_label_drag_gesture_begin), self);
+ g_signal_connect (self->select_info->drag_gesture, "drag-update",
+ G_CALLBACK (gtk_label_drag_gesture_update), self);
+ gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (self->select_info->drag_gesture), TRUE);
+ gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (self->select_info->drag_gesture));
- priv->select_info->click_gesture = gtk_gesture_click_new ();
- g_signal_connect (priv->select_info->click_gesture, "pressed",
- G_CALLBACK (gtk_label_click_gesture_pressed), label);
- g_signal_connect (priv->select_info->click_gesture, "released",
- G_CALLBACK (gtk_label_click_gesture_released), label);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->select_info->click_gesture), 0);
- gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->select_info->click_gesture), TRUE);
- gtk_widget_add_controller (GTK_WIDGET (label), GTK_EVENT_CONTROLLER (priv->select_info->click_gesture));
+ self->select_info->click_gesture = gtk_gesture_click_new ();
+ g_signal_connect (self->select_info->click_gesture, "pressed",
+ G_CALLBACK (gtk_label_click_gesture_pressed), self);
+ g_signal_connect (self->select_info->click_gesture, "released",
+ G_CALLBACK (gtk_label_click_gesture_released), self);
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (self->select_info->click_gesture), 0);
+ gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (self->select_info->click_gesture), TRUE);
+ gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (self->select_info->click_gesture));
- priv->select_info->motion_controller = gtk_event_controller_motion_new ();
- g_signal_connect (priv->select_info->motion_controller, "motion",
- G_CALLBACK (gtk_label_motion), label);
- g_signal_connect (priv->select_info->motion_controller, "leave",
- G_CALLBACK (gtk_label_leave), label);
- gtk_widget_add_controller (GTK_WIDGET (label), priv->select_info->motion_controller);
+ self->select_info->motion_controller = gtk_event_controller_motion_new ();
+ g_signal_connect (self->select_info->motion_controller, "motion",
+ G_CALLBACK (gtk_label_motion), self);
+ g_signal_connect (self->select_info->motion_controller, "leave",
+ G_CALLBACK (gtk_label_leave), self);
+ gtk_widget_add_controller (GTK_WIDGET (self), self->select_info->motion_controller);
- priv->select_info->provider = g_object_new (GTK_TYPE_LABEL_CONTENT, NULL);
- GTK_LABEL_CONTENT (priv->select_info->provider)->label = label;
+ self->select_info->provider = g_object_new (GTK_TYPE_LABEL_CONTENT, NULL);
+ GTK_LABEL_CONTENT (self->select_info->provider)->label = self;
- gtk_label_update_cursor (label);
+ gtk_label_update_cursor (self);
}
}
static void
-gtk_label_clear_select_info (GtkLabel *label)
+gtk_label_clear_select_info (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->select_info == NULL)
+ if (self->select_info == NULL)
return;
- if (!priv->select_info->selectable && !priv->select_info->links)
+ if (!self->select_info->selectable && !self->select_info->links)
{
- gtk_widget_remove_controller (GTK_WIDGET (label), GTK_EVENT_CONTROLLER (priv->select_info->drag_gesture));
- gtk_widget_remove_controller (GTK_WIDGET (label), GTK_EVENT_CONTROLLER (priv->select_info->click_gesture));
- gtk_widget_remove_controller (GTK_WIDGET (label), priv->select_info->motion_controller);
- GTK_LABEL_CONTENT (priv->select_info->provider)->label = NULL;
- g_object_unref (priv->select_info->provider);
+ gtk_widget_remove_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (self->select_info->drag_gesture));
+ gtk_widget_remove_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (self->select_info->click_gesture));
+ gtk_widget_remove_controller (GTK_WIDGET (self), self->select_info->motion_controller);
+ GTK_LABEL_CONTENT (self->select_info->provider)->label = NULL;
+ g_object_unref (self->select_info->provider);
- g_free (priv->select_info);
- priv->select_info = NULL;
+ g_free (self->select_info);
+ self->select_info = NULL;
- gtk_widget_set_cursor (GTK_WIDGET (label), NULL);
+ gtk_widget_set_cursor (GTK_WIDGET (self), NULL);
- gtk_widget_set_can_focus (GTK_WIDGET (label), FALSE);
+ gtk_widget_set_can_focus (GTK_WIDGET (self), FALSE);
}
}
@@ -4518,42 +4420,41 @@ gtk_label_clear_select_info (GtkLabel *label)
* copy-and-paste.
**/
void
-gtk_label_set_selectable (GtkLabel *label,
+gtk_label_set_selectable (GtkLabel *self,
gboolean setting)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
gboolean old_setting;
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
setting = setting != FALSE;
- old_setting = priv->select_info && priv->select_info->selectable;
+ old_setting = self->select_info && self->select_info->selectable;
if (setting)
{
- gtk_label_ensure_select_info (label);
- priv->select_info->selectable = TRUE;
- gtk_label_update_cursor (label);
+ gtk_label_ensure_select_info (self);
+ self->select_info->selectable = TRUE;
+ gtk_label_update_cursor (self);
}
else
{
if (old_setting)
{
/* unselect, to give up the selection */
- gtk_label_select_region (label, 0, 0);
+ gtk_label_select_region (self, 0, 0);
- priv->select_info->selectable = FALSE;
- gtk_label_clear_select_info (label);
+ self->select_info->selectable = FALSE;
+ gtk_label_clear_select_info (self);
}
}
if (setting != old_setting)
{
- g_object_freeze_notify (G_OBJECT (label));
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_SELECTABLE]);
- _gtk_label_accessible_selection_bound_changed (label);
- _gtk_label_accessible_cursor_position_changed (label);
- g_object_thaw_notify (G_OBJECT (label));
- gtk_widget_queue_draw (GTK_WIDGET (label));
+ g_object_freeze_notify (G_OBJECT (self));
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_SELECTABLE]);
+ _gtk_label_accessible_selection_bound_changed (self);
+ _gtk_label_accessible_cursor_position_changed (self);
+ g_object_thaw_notify (G_OBJECT (self));
+ gtk_widget_queue_draw (GTK_WIDGET (self));
}
}
@@ -4566,25 +4467,21 @@ gtk_label_set_selectable (GtkLabel *label,
* Returns: %TRUE if the user can copy text from the label
**/
gboolean
-gtk_label_get_selectable (GtkLabel *label)
+gtk_label_get_selectable (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), FALSE);
- g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
-
- return priv->select_info && priv->select_info->selectable;
+ return self->select_info && self->select_info->selectable;
}
static void
-gtk_label_select_region_index (GtkLabel *label,
+gtk_label_select_region_index (GtkLabel *self,
gint anchor_index,
gint end_index)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_return_if_fail (GTK_IS_LABEL (label));
-
- if (priv->select_info && priv->select_info->selectable)
+ if (self->select_info && self->select_info->selectable)
{
GdkClipboard *clipboard;
gint s, e;
@@ -4594,16 +4491,16 @@ gtk_label_select_region_index (GtkLabel *label,
*/
if (anchor_index < end_index)
{
- if (range_is_in_ellipsis_full (label, anchor_index, anchor_index + 1, &s, &e))
+ if (range_is_in_ellipsis_full (self, anchor_index, anchor_index + 1, &s, &e))
{
- if (priv->select_info->selection_anchor == s)
+ if (self->select_info->selection_anchor == s)
anchor_index = e;
else
anchor_index = s;
}
- if (range_is_in_ellipsis_full (label, end_index - 1, end_index, &s, &e))
+ if (range_is_in_ellipsis_full (self, end_index - 1, end_index, &s, &e))
{
- if (priv->select_info->selection_end == e)
+ if (self->select_info->selection_end == e)
end_index = s;
else
end_index = e;
@@ -4611,16 +4508,16 @@ gtk_label_select_region_index (GtkLabel *label,
}
else if (end_index < anchor_index)
{
- if (range_is_in_ellipsis_full (label, end_index, end_index + 1, &s, &e))
+ if (range_is_in_ellipsis_full (self, end_index, end_index + 1, &s, &e))
{
- if (priv->select_info->selection_end == s)
+ if (self->select_info->selection_end == s)
end_index = e;
else
end_index = s;
}
- if (range_is_in_ellipsis_full (label, anchor_index - 1, anchor_index, &s, &e))
+ if (range_is_in_ellipsis_full (self, anchor_index - 1, anchor_index, &s, &e))
{
- if (priv->select_info->selection_anchor == e)
+ if (self->select_info->selection_anchor == e)
anchor_index = s;
else
anchor_index = e;
@@ -4628,11 +4525,11 @@ gtk_label_select_region_index (GtkLabel *label,
}
else
{
- if (range_is_in_ellipsis_full (label, anchor_index, anchor_index, &s, &e))
+ if (range_is_in_ellipsis_full (self, anchor_index, anchor_index, &s, &e))
{
- if (priv->select_info->selection_anchor == s)
+ if (self->select_info->selection_anchor == s)
anchor_index = e;
- else if (priv->select_info->selection_anchor == e)
+ else if (self->select_info->selection_anchor == e)
anchor_index = s;
else if (anchor_index - s < e - anchor_index)
anchor_index = s;
@@ -4642,56 +4539,56 @@ gtk_label_select_region_index (GtkLabel *label,
}
}
- if (priv->select_info->selection_anchor == anchor_index &&
- priv->select_info->selection_end == end_index)
+ if (self->select_info->selection_anchor == anchor_index &&
+ self->select_info->selection_end == end_index)
return;
- g_object_freeze_notify (G_OBJECT (label));
+ g_object_freeze_notify (G_OBJECT (self));
- if (priv->select_info->selection_anchor != anchor_index)
- _gtk_label_accessible_selection_bound_changed (label);
- if (priv->select_info->selection_end != end_index)
- _gtk_label_accessible_cursor_position_changed (label);
+ if (self->select_info->selection_anchor != anchor_index)
+ _gtk_label_accessible_selection_bound_changed (self);
+ if (self->select_info->selection_end != end_index)
+ _gtk_label_accessible_cursor_position_changed (self);
- priv->select_info->selection_anchor = anchor_index;
- priv->select_info->selection_end = end_index;
+ self->select_info->selection_anchor = anchor_index;
+ self->select_info->selection_end = end_index;
- clipboard = gtk_widget_get_primary_clipboard (GTK_WIDGET (label));
+ clipboard = gtk_widget_get_primary_clipboard (GTK_WIDGET (self));
if (anchor_index != end_index)
{
- gdk_content_provider_content_changed (priv->select_info->provider);
- gdk_clipboard_set_content (clipboard, priv->select_info->provider);
+ gdk_content_provider_content_changed (self->select_info->provider);
+ gdk_clipboard_set_content (clipboard, self->select_info->provider);
- if (!priv->select_info->selection_node)
+ if (!self->select_info->selection_node)
{
GtkCssNode *widget_node;
- widget_node = gtk_widget_get_css_node (GTK_WIDGET (label));
- priv->select_info->selection_node = gtk_css_node_new ();
- gtk_css_node_set_name (priv->select_info->selection_node, g_quark_from_static_string ("selection"));
- gtk_css_node_set_parent (priv->select_info->selection_node, widget_node);
- gtk_css_node_set_state (priv->select_info->selection_node, gtk_css_node_get_state (widget_node));
- g_object_unref (priv->select_info->selection_node);
+ widget_node = gtk_widget_get_css_node (GTK_WIDGET (self));
+ self->select_info->selection_node = gtk_css_node_new ();
+ gtk_css_node_set_name (self->select_info->selection_node, g_quark_from_static_string ("selection"));
+ gtk_css_node_set_parent (self->select_info->selection_node, widget_node);
+ gtk_css_node_set_state (self->select_info->selection_node, gtk_css_node_get_state (widget_node));
+ g_object_unref (self->select_info->selection_node);
}
}
else
{
- if (gdk_clipboard_get_content (clipboard) == priv->select_info->provider)
+ if (gdk_clipboard_get_content (clipboard) == self->select_info->provider)
gdk_clipboard_set_content (clipboard, NULL);
- if (priv->select_info->selection_node)
+ if (self->select_info->selection_node)
{
- gtk_css_node_set_parent (priv->select_info->selection_node, NULL);
- priv->select_info->selection_node = NULL;
+ gtk_css_node_set_parent (self->select_info->selection_node, NULL);
+ self->select_info->selection_node = NULL;
}
}
- gtk_label_update_actions (label);
+ gtk_label_update_actions (self);
- gtk_widget_queue_draw (GTK_WIDGET (label));
+ gtk_widget_queue_draw (GTK_WIDGET (self));
- g_object_thaw_notify (G_OBJECT (label));
+ g_object_thaw_notify (G_OBJECT (self));
}
}
@@ -4707,25 +4604,23 @@ gtk_label_select_region_index (GtkLabel *label,
* @end_offset are -1, then the end of the label will be substituted.
**/
void
-gtk_label_select_region (GtkLabel *label,
+gtk_label_select_region (GtkLabel *self,
gint start_offset,
gint end_offset)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_return_if_fail (GTK_IS_LABEL (label));
-
- if (priv->text && priv->select_info)
+ if (self->text && self->select_info)
{
if (start_offset < 0)
- start_offset = g_utf8_strlen (priv->text, -1);
+ start_offset = g_utf8_strlen (self->text, -1);
if (end_offset < 0)
- end_offset = g_utf8_strlen (priv->text, -1);
+ end_offset = g_utf8_strlen (self->text, -1);
- gtk_label_select_region_index (label,
- g_utf8_offset_to_pointer (priv->text, start_offset) - priv->text,
- g_utf8_offset_to_pointer (priv->text, end_offset) - priv->text);
+ gtk_label_select_region_index (self,
+ g_utf8_offset_to_pointer (self->text, start_offset) - self->text,
+ g_utf8_offset_to_pointer (self->text, end_offset) - self->text);
}
}
@@ -4741,15 +4636,13 @@ gtk_label_select_region (GtkLabel *label,
* Returns: %TRUE if selection is non-empty
**/
gboolean
-gtk_label_get_selection_bounds (GtkLabel *label,
+gtk_label_get_selection_bounds (GtkLabel *self,
gint *start,
gint *end)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), FALSE);
- g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
-
- if (priv->select_info == NULL)
+ if (self->select_info == NULL)
{
/* not a selectable label */
if (start)
@@ -4765,12 +4658,12 @@ gtk_label_get_selection_bounds (GtkLabel *label,
gint start_offset, end_offset;
gint len;
- start_index = MIN (priv->select_info->selection_anchor,
- priv->select_info->selection_end);
- end_index = MAX (priv->select_info->selection_anchor,
- priv->select_info->selection_end);
+ start_index = MIN (self->select_info->selection_anchor,
+ self->select_info->selection_end);
+ end_index = MAX (self->select_info->selection_anchor,
+ self->select_info->selection_end);
- len = strlen (priv->text);
+ len = strlen (self->text);
if (end_index > len)
end_index = len;
@@ -4778,8 +4671,8 @@ gtk_label_get_selection_bounds (GtkLabel *label,
if (start_index > len)
start_index = len;
- start_offset = g_utf8_strlen (priv->text, start_index);
- end_offset = g_utf8_strlen (priv->text, end_index);
+ start_offset = g_utf8_strlen (self->text, start_index);
+ end_offset = g_utf8_strlen (self->text, end_index);
if (start_offset > end_offset)
{
@@ -4813,15 +4706,13 @@ gtk_label_get_selection_bounds (GtkLabel *label,
* Returns: (transfer none): the #PangoLayout for this label
**/
PangoLayout*
-gtk_label_get_layout (GtkLabel *label)
+gtk_label_get_layout (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), NULL);
- g_return_val_if_fail (GTK_IS_LABEL (label), NULL);
+ gtk_label_ensure_layout (self);
- gtk_label_ensure_layout (label);
-
- return priv->layout;
+ return self->layout;
}
/**
@@ -4838,15 +4729,15 @@ gtk_label_get_layout (GtkLabel *label)
* and from pixels using PANGO_PIXELS() or #PANGO_SCALE.
**/
void
-gtk_label_get_layout_offsets (GtkLabel *label,
+gtk_label_get_layout_offsets (GtkLabel *self,
gint *x,
gint *y)
{
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
- gtk_label_ensure_layout (label);
+ gtk_label_ensure_layout (self);
- get_layout_location (label, x, y);
+ get_layout_location (self, x, y);
}
/**
@@ -4859,17 +4750,17 @@ gtk_label_get_layout_offsets (GtkLabel *label,
* See gtk_label_set_markup().
**/
void
-gtk_label_set_use_markup (GtkLabel *label,
+gtk_label_set_use_markup (GtkLabel *self,
gboolean setting)
{
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_object_freeze_notify (G_OBJECT (label));
+ g_object_freeze_notify (G_OBJECT (self));
- if (gtk_label_set_use_markup_internal (label, !!setting))
- gtk_label_recalculate (label);
+ if (gtk_label_set_use_markup_internal (self, !!setting))
+ gtk_label_recalculate (self);
- g_object_thaw_notify (G_OBJECT (label));
+ g_object_thaw_notify (G_OBJECT (self));
}
/**
@@ -4883,13 +4774,11 @@ gtk_label_set_use_markup (GtkLabel *label,
* Returns: %TRUE if the label’s text will be parsed for markup.
**/
gboolean
-gtk_label_get_use_markup (GtkLabel *label)
+gtk_label_get_use_markup (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), FALSE);
- g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
-
- return priv->use_markup;
+ return self->use_markup;
}
/**
@@ -4901,17 +4790,17 @@ gtk_label_get_use_markup (GtkLabel *label)
* used for the mnemonic accelerator key.
*/
void
-gtk_label_set_use_underline (GtkLabel *label,
+gtk_label_set_use_underline (GtkLabel *self,
gboolean setting)
{
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_object_freeze_notify (G_OBJECT (label));
+ g_object_freeze_notify (G_OBJECT (self));
- if (gtk_label_set_use_underline_internal (label, !!setting))
- gtk_label_recalculate (label);
+ if (gtk_label_set_use_underline_internal (self, !!setting))
+ gtk_label_recalculate (self);
- g_object_thaw_notify (G_OBJECT (label));
+ g_object_thaw_notify (G_OBJECT (self));
}
/**
@@ -4925,13 +4814,11 @@ gtk_label_set_use_underline (GtkLabel *label,
* the mnemonic accelerator keys.
**/
gboolean
-gtk_label_get_use_underline (GtkLabel *label)
+gtk_label_get_use_underline (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), FALSE);
- g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
-
- return priv->use_underline;
+ return self->use_underline;
}
/**
@@ -4942,23 +4829,21 @@ gtk_label_get_use_underline (GtkLabel *label)
* Sets whether the label is in single line mode.
*/
void
-gtk_label_set_single_line_mode (GtkLabel *label,
+gtk_label_set_single_line_mode (GtkLabel *self,
gboolean single_line_mode)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
single_line_mode = single_line_mode != FALSE;
- if (priv->single_line_mode != single_line_mode)
+ if (self->single_line_mode != single_line_mode)
{
- priv->single_line_mode = single_line_mode;
+ self->single_line_mode = single_line_mode;
- gtk_label_clear_layout (label);
- gtk_widget_queue_resize (GTK_WIDGET (label));
+ gtk_label_clear_layout (self);
+ gtk_widget_queue_resize (GTK_WIDGET (self));
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_SINGLE_LINE_MODE]);
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_SINGLE_LINE_MODE]);
}
}
@@ -4971,13 +4856,11 @@ gtk_label_set_single_line_mode (GtkLabel *label,
* Returns: %TRUE when the label is in single line mode.
**/
gboolean
-gtk_label_get_single_line_mode (GtkLabel *label)
+gtk_label_get_single_line_mode (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), FALSE);
- g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
-
- return priv->single_line_mode;
+ return self->single_line_mode;
}
/* Compute the X position for an offset that corresponds to the "more important
@@ -4986,26 +4869,25 @@ gtk_label_get_single_line_mode (GtkLabel *label)
* right arrow key.
*/
static void
-get_better_cursor (GtkLabel *label,
+get_better_cursor (GtkLabel *self,
gint index,
gint *x,
gint *y)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (label)));
+ GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
GdkDevice *device = gdk_seat_get_keyboard (seat);
PangoDirection keymap_direction = gdk_device_get_direction (device);
- PangoDirection cursor_direction = get_cursor_direction (label);
+ PangoDirection cursor_direction = get_cursor_direction (self);
gboolean split_cursor;
PangoRectangle strong_pos, weak_pos;
- g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
+ g_object_get (gtk_widget_get_settings (GTK_WIDGET (self)),
"gtk-split-cursor", &split_cursor,
NULL);
- gtk_label_ensure_layout (label);
+ gtk_label_ensure_layout (self);
- pango_layout_get_cursor_pos (priv->layout, index,
+ pango_layout_get_cursor_pos (self->layout, index,
&strong_pos, &weak_pos);
if (split_cursor)
@@ -5030,25 +4912,24 @@ get_better_cursor (GtkLabel *label,
static gint
-gtk_label_move_logically (GtkLabel *label,
+gtk_label_move_logically (GtkLabel *self,
gint start,
gint count)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- gint offset = g_utf8_pointer_to_offset (priv->text,
- priv->text + start);
+ gint offset = g_utf8_pointer_to_offset (self->text,
+ self->text + start);
- if (priv->text)
+ if (self->text)
{
const PangoLogAttr *log_attrs;
gint n_attrs;
gint length;
- gtk_label_ensure_layout (label);
+ gtk_label_ensure_layout (self);
- length = g_utf8_strlen (priv->text, -1);
+ length = g_utf8_strlen (self->text, -1);
- log_attrs = pango_layout_get_log_attrs_readonly (priv->layout, &n_attrs);
+ log_attrs = pango_layout_get_log_attrs_readonly (self->layout, &n_attrs);
while (count > 0 && offset < length)
{
@@ -5068,15 +4949,14 @@ gtk_label_move_logically (GtkLabel *label,
}
}
- return g_utf8_offset_to_pointer (priv->text, offset) - priv->text;
+ return g_utf8_offset_to_pointer (self->text, offset) - self->text;
}
static gint
-gtk_label_move_visually (GtkLabel *label,
+gtk_label_move_visually (GtkLabel *self,
gint start,
gint count)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
gint index;
index = start;
@@ -5087,9 +4967,9 @@ gtk_label_move_visually (GtkLabel *label,
gboolean split_cursor;
gboolean strong;
- gtk_label_ensure_layout (label);
+ gtk_label_ensure_layout (self);
- g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
+ g_object_get (gtk_widget_get_settings (GTK_WIDGET (self)),
"gtk-split-cursor", &split_cursor,
NULL);
@@ -5097,21 +4977,21 @@ gtk_label_move_visually (GtkLabel *label,
strong = TRUE;
else
{
- GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (label)));
+ GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
GdkDevice *device = gdk_seat_get_keyboard (seat);
PangoDirection keymap_direction = gdk_device_get_direction (device);
- strong = keymap_direction == get_cursor_direction (label);
+ strong = keymap_direction == get_cursor_direction (self);
}
if (count > 0)
{
- pango_layout_move_cursor_visually (priv->layout, strong, index, 0, 1, &new_index, &new_trailing);
+ pango_layout_move_cursor_visually (self->layout, strong, index, 0, 1, &new_index, &new_trailing);
count--;
}
else
{
- pango_layout_move_cursor_visually (priv->layout, strong, index, 0, -1, &new_index, &new_trailing);
+ pango_layout_move_cursor_visually (self->layout, strong, index, 0, -1, &new_index, &new_trailing);
count++;
}
@@ -5121,30 +5001,29 @@ gtk_label_move_visually (GtkLabel *label,
index = new_index;
while (new_trailing--)
- index = g_utf8_next_char (priv->text + new_index) - priv->text;
+ index = g_utf8_next_char (self->text + new_index) - self->text;
}
return index;
}
static gint
-gtk_label_move_forward_word (GtkLabel *label,
+gtk_label_move_forward_word (GtkLabel *self,
gint start)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- gint new_pos = g_utf8_pointer_to_offset (priv->text,
- priv->text + start);
+ gint new_pos = g_utf8_pointer_to_offset (self->text,
+ self->text + start);
gint length;
- length = g_utf8_strlen (priv->text, -1);
+ length = g_utf8_strlen (self->text, -1);
if (new_pos < length)
{
const PangoLogAttr *log_attrs;
gint n_attrs;
- gtk_label_ensure_layout (label);
+ gtk_label_ensure_layout (self);
- log_attrs = pango_layout_get_log_attrs_readonly (priv->layout, &n_attrs);
+ log_attrs = pango_layout_get_log_attrs_readonly (self->layout, &n_attrs);
/* Find the next word end */
new_pos++;
@@ -5152,26 +5031,25 @@ gtk_label_move_forward_word (GtkLabel *label,
new_pos++;
}
- return g_utf8_offset_to_pointer (priv->text, new_pos) - priv->text;
+ return g_utf8_offset_to_pointer (self->text, new_pos) - self->text;
}
static gint
-gtk_label_move_backward_word (GtkLabel *label,
+gtk_label_move_backward_word (GtkLabel *self,
gint start)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- gint new_pos = g_utf8_pointer_to_offset (priv->text,
- priv->text + start);
+ gint new_pos = g_utf8_pointer_to_offset (self->text,
+ self->text + start);
if (new_pos > 0)
{
const PangoLogAttr *log_attrs;
gint n_attrs;
- gtk_label_ensure_layout (label);
+ gtk_label_ensure_layout (self);
- log_attrs = pango_layout_get_log_attrs_readonly (priv->layout, &n_attrs);
+ log_attrs = pango_layout_get_log_attrs_readonly (self->layout, &n_attrs);
new_pos -= 1;
@@ -5180,25 +5058,24 @@ gtk_label_move_backward_word (GtkLabel *label,
new_pos--;
}
- return g_utf8_offset_to_pointer (priv->text, new_pos) - priv->text;
+ return g_utf8_offset_to_pointer (self->text, new_pos) - self->text;
}
static void
-gtk_label_move_cursor (GtkLabel *label,
+gtk_label_move_cursor (GtkLabel *self,
GtkMovementStep step,
gint count,
gboolean extend_selection)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
gint old_pos;
gint new_pos;
- if (priv->select_info == NULL)
+ if (self->select_info == NULL)
return;
- old_pos = new_pos = priv->select_info->selection_end;
+ old_pos = new_pos = self->select_info->selection_end;
- if (priv->select_info->selection_end != priv->select_info->selection_anchor &&
+ if (self->select_info->selection_end != self->select_info->selection_anchor &&
!extend_selection)
{
/* If we have a current selection and aren't extending it, move to the
@@ -5212,29 +5089,29 @@ gtk_label_move_cursor (GtkLabel *label,
gint anchor_x, anchor_y;
gboolean end_is_left;
- get_better_cursor (label, priv->select_info->selection_end, &end_x, &end_y);
- get_better_cursor (label, priv->select_info->selection_anchor, &anchor_x, &anchor_y);
+ get_better_cursor (self, self->select_info->selection_end, &end_x, &end_y);
+ get_better_cursor (self, self->select_info->selection_anchor, &anchor_x, &anchor_y);
end_is_left = (end_y < anchor_y) || (end_y == anchor_y && end_x < anchor_x);
if (count < 0)
- new_pos = end_is_left ? priv->select_info->selection_end : priv->select_info->selection_anchor;
+ new_pos = end_is_left ? self->select_info->selection_end : self->select_info->selection_anchor;
else
- new_pos = !end_is_left ? priv->select_info->selection_end : priv->select_info->selection_anchor;
+ new_pos = !end_is_left ? self->select_info->selection_end : self->select_info->selection_anchor;
break;
}
case GTK_MOVEMENT_LOGICAL_POSITIONS:
case GTK_MOVEMENT_WORDS:
if (count < 0)
- new_pos = MIN (priv->select_info->selection_end, priv->select_info->selection_anchor);
+ new_pos = MIN (self->select_info->selection_end, self->select_info->selection_anchor);
else
- new_pos = MAX (priv->select_info->selection_end, priv->select_info->selection_anchor);
+ new_pos = MAX (self->select_info->selection_end, self->select_info->selection_anchor);
break;
case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
case GTK_MOVEMENT_PARAGRAPH_ENDS:
case GTK_MOVEMENT_BUFFER_ENDS:
/* FIXME: Can do better here */
- new_pos = count < 0 ? 0 : strlen (priv->text);
+ new_pos = count < 0 ? 0 : strlen (self->text);
break;
case GTK_MOVEMENT_DISPLAY_LINES:
case GTK_MOVEMENT_PARAGRAPHS:
@@ -5249,19 +5126,19 @@ gtk_label_move_cursor (GtkLabel *label,
switch (step)
{
case GTK_MOVEMENT_LOGICAL_POSITIONS:
- new_pos = gtk_label_move_logically (label, new_pos, count);
+ new_pos = gtk_label_move_logically (self, new_pos, count);
break;
case GTK_MOVEMENT_VISUAL_POSITIONS:
- new_pos = gtk_label_move_visually (label, new_pos, count);
+ new_pos = gtk_label_move_visually (self, new_pos, count);
if (new_pos == old_pos)
{
if (!extend_selection)
{
- if (!gtk_widget_keynav_failed (GTK_WIDGET (label),
+ if (!gtk_widget_keynav_failed (GTK_WIDGET (self),
count > 0 ?
GTK_DIR_RIGHT : GTK_DIR_LEFT))
{
- GtkRoot *root = gtk_widget_get_root (GTK_WIDGET (label));
+ GtkRoot *root = gtk_widget_get_root (GTK_WIDGET (self));
if (root)
gtk_widget_child_focus (GTK_WIDGET (root), count > 0 ? GTK_DIR_RIGHT : GTK_DIR_LEFT);
@@ -5269,31 +5146,31 @@ gtk_label_move_cursor (GtkLabel *label,
}
else
{
- gtk_widget_error_bell (GTK_WIDGET (label));
+ gtk_widget_error_bell (GTK_WIDGET (self));
}
}
break;
case GTK_MOVEMENT_WORDS:
while (count > 0)
{
- new_pos = gtk_label_move_forward_word (label, new_pos);
+ new_pos = gtk_label_move_forward_word (self, new_pos);
count--;
}
while (count < 0)
{
- new_pos = gtk_label_move_backward_word (label, new_pos);
+ new_pos = gtk_label_move_backward_word (self, new_pos);
count++;
}
if (new_pos == old_pos)
- gtk_widget_error_bell (GTK_WIDGET (label));
+ gtk_widget_error_bell (GTK_WIDGET (self));
break;
case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
case GTK_MOVEMENT_PARAGRAPH_ENDS:
case GTK_MOVEMENT_BUFFER_ENDS:
/* FIXME: Can do better here */
- new_pos = count < 0 ? 0 : strlen (priv->text);
+ new_pos = count < 0 ? 0 : strlen (self->text);
if (new_pos == old_pos)
- gtk_widget_error_bell (GTK_WIDGET (label));
+ gtk_widget_error_bell (GTK_WIDGET (self));
break;
case GTK_MOVEMENT_DISPLAY_LINES:
case GTK_MOVEMENT_PARAGRAPHS:
@@ -5305,30 +5182,28 @@ gtk_label_move_cursor (GtkLabel *label,
}
if (extend_selection)
- gtk_label_select_region_index (label,
- priv->select_info->selection_anchor,
+ gtk_label_select_region_index (self,
+ self->select_info->selection_anchor,
new_pos);
else
- gtk_label_select_region_index (label, new_pos, new_pos);
+ gtk_label_select_region_index (self, new_pos, new_pos);
}
static void
-gtk_label_copy_clipboard (GtkLabel *label)
+gtk_label_copy_clipboard (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->text && priv->select_info)
+ if (self->text && self->select_info)
{
gint start, end;
gint len;
GdkClipboard *clipboard;
- start = MIN (priv->select_info->selection_anchor,
- priv->select_info->selection_end);
- end = MAX (priv->select_info->selection_anchor,
- priv->select_info->selection_end);
+ start = MIN (self->select_info->selection_anchor,
+ self->select_info->selection_end);
+ end = MAX (self->select_info->selection_anchor,
+ self->select_info->selection_end);
- len = strlen (priv->text);
+ len = strlen (self->text);
if (end > len)
end = len;
@@ -5336,11 +5211,11 @@ gtk_label_copy_clipboard (GtkLabel *label)
if (start > len)
start = len;
- clipboard = gtk_widget_get_clipboard (GTK_WIDGET (label));
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (self));
if (start != end)
{
- char *str = g_strndup (priv->text + start, end - start);
+ char *str = g_strndup (self->text + start, end - start);
gdk_clipboard_set_text (clipboard, str);
g_free (str);
}
@@ -5348,7 +5223,7 @@ gtk_label_copy_clipboard (GtkLabel *label)
{
GtkLabelLink *link;
- link = gtk_label_get_focus_link (label, NULL);
+ link = gtk_label_get_focus_link (self, NULL);
if (link)
gdk_clipboard_set_text (clipboard, link->uri);
}
@@ -5356,11 +5231,9 @@ gtk_label_copy_clipboard (GtkLabel *label)
}
static void
-gtk_label_select_all (GtkLabel *label)
+gtk_label_select_all (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- gtk_label_select_region_index (label, 0, strlen (priv->text));
+ gtk_label_select_region_index (self, 0, strlen (self->text));
}
static void
@@ -5368,12 +5241,11 @@ gtk_label_activate_link_open (GtkWidget *widget,
const char *name,
GVariant *parameter)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelLink *link = priv->select_info->context_link;
+ GtkLabel *self = GTK_LABEL (widget);
+ GtkLabelLink *link = self->select_info->context_link;
if (link)
- emit_activate_link (label, link);
+ emit_activate_link (self, link);
}
static void
@@ -5381,9 +5253,8 @@ gtk_label_activate_link_copy (GtkWidget *widget,
const char *name,
GVariant *parameter)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelLink *link = priv->select_info->context_link;
+ GtkLabel *self = GTK_LABEL (widget);
+ GtkLabelLink *link = self->select_info->context_link;
if (link)
{
@@ -5420,35 +5291,33 @@ gtk_label_nop (GtkWidget *widget,
}
static void
-gtk_label_update_actions (GtkLabel *label)
+gtk_label_update_actions (GtkLabel *self)
{
- GtkWidget *widget = GTK_WIDGET (label);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GtkWidget *widget = GTK_WIDGET (self);
gboolean has_selection;
GtkLabelLink *link;
- if (priv->select_info)
+ if (self->select_info)
{
- has_selection = priv->select_info->selection_anchor != priv->select_info->selection_end;
- link = priv->select_info->active_link;
+ has_selection = self->select_info->selection_anchor != self->select_info->selection_end;
+ link = self->select_info->active_link;
}
else
{
has_selection = FALSE;
- link = gtk_label_get_focus_link (label, NULL);
+ link = gtk_label_get_focus_link (self, NULL);
}
gtk_widget_action_set_enabled (widget, "clipboard.copy", has_selection);
gtk_widget_action_set_enabled (widget, "selection.select-all",
- gtk_label_get_selectable (label));
+ gtk_label_get_selectable (self));
gtk_widget_action_set_enabled (widget, "link.open", !has_selection && link);
gtk_widget_action_set_enabled (widget, "link.copy", !has_selection && link);
}
static GMenuModel *
-gtk_label_get_menu_model (GtkLabel *label)
+gtk_label_get_menu_model (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
GMenu *menu, *section;
GMenuItem *item;
@@ -5479,40 +5348,38 @@ gtk_label_get_menu_model (GtkLabel *label)
g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
g_object_unref (section);
- if (priv->extra_menu)
- g_menu_append_section (menu, NULL, priv->extra_menu);
+ if (self->extra_menu)
+ g_menu_append_section (menu, NULL, self->extra_menu);
return G_MENU_MODEL (menu);
}
static void
-gtk_label_do_popup (GtkLabel *label,
+gtk_label_do_popup (GtkLabel *self,
double x,
double y)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (!priv->select_info)
+ if (!self->select_info)
return;
- if (priv->select_info->link_clicked)
- priv->select_info->context_link = priv->select_info->active_link;
+ if (self->select_info->link_clicked)
+ self->select_info->context_link = self->select_info->active_link;
else
- priv->select_info->context_link = gtk_label_get_focus_link (label, NULL);
+ self->select_info->context_link = gtk_label_get_focus_link (self, NULL);
- gtk_label_update_actions (label);
+ gtk_label_update_actions (self);
- if (!priv->popup_menu)
+ if (!self->popup_menu)
{
GMenuModel *model;
- model = gtk_label_get_menu_model (label);
- priv->popup_menu = gtk_popover_menu_new_from_model (model);
- gtk_widget_set_parent (priv->popup_menu, GTK_WIDGET (label));
- gtk_popover_set_position (GTK_POPOVER (priv->popup_menu), GTK_POS_BOTTOM);
+ model = gtk_label_get_menu_model (self);
+ self->popup_menu = gtk_popover_menu_new_from_model (model);
+ gtk_widget_set_parent (self->popup_menu, GTK_WIDGET (self));
+ gtk_popover_set_position (GTK_POPOVER (self->popup_menu), GTK_POS_BOTTOM);
- gtk_popover_set_has_arrow (GTK_POPOVER (priv->popup_menu), FALSE);
- gtk_widget_set_halign (priv->popup_menu, GTK_ALIGN_START);
+ gtk_popover_set_has_arrow (GTK_POPOVER (self->popup_menu), FALSE);
+ gtk_widget_set_halign (self->popup_menu, GTK_ALIGN_START);
g_object_unref (model);
}
@@ -5520,12 +5387,12 @@ gtk_label_do_popup (GtkLabel *label,
if (x != -1 && y != -1)
{
GdkRectangle rect = { x, y, 1, 1 };
- gtk_popover_set_pointing_to (GTK_POPOVER (priv->popup_menu), &rect);
+ gtk_popover_set_pointing_to (GTK_POPOVER (self->popup_menu), &rect);
}
else
- gtk_popover_set_pointing_to (GTK_POPOVER (priv->popup_menu), NULL);
+ gtk_popover_set_pointing_to (GTK_POPOVER (self->popup_menu), NULL);
- gtk_popover_popup (GTK_POPOVER (priv->popup_menu));
+ gtk_popover_popup (GTK_POPOVER (self->popup_menu));
}
static void
@@ -5533,18 +5400,17 @@ gtk_label_popup_menu (GtkWidget *widget,
const char *action_name,
GVariant *parameters)
{
- GtkLabel *label = GTK_LABEL (widget);
+ GtkLabel *self = GTK_LABEL (widget);
- gtk_label_do_popup (label, -1, -1);
+ gtk_label_do_popup (self, -1, -1);
}
static void
-gtk_label_clear_links (GtkLabel *label)
+gtk_label_clear_links (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
guint i;
- if (!priv->select_info)
+ if (!self->select_info)
return;
for (i = 0; i < self->select_info->n_links; i++)
@@ -5553,16 +5419,16 @@ gtk_label_clear_links (GtkLabel *label)
self->select_info->links = NULL;
self->select_info->n_links = 0;
self->select_info->active_link = NULL;
- gtk_widget_remove_css_class (GTK_WIDGET (label), "link");
+ gtk_widget_remove_css_class (GTK_WIDGET (self), "link");
- _gtk_label_accessible_update_links (label);
+ _gtk_label_accessible_update_links (self);
}
static gboolean
-gtk_label_activate_link (GtkLabel *label,
+gtk_label_activate_link (GtkLabel *self,
const gchar *uri)
{
- GtkWidget *widget = GTK_WIDGET (label);
+ GtkWidget *widget = GTK_WIDGET (self);
GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
if (!GTK_IS_WINDOW (toplevel))
@@ -5574,53 +5440,51 @@ gtk_label_activate_link (GtkLabel *label,
}
static void
-emit_activate_link (GtkLabel *label,
+emit_activate_link (GtkLabel *self,
GtkLabelLink *link)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
gboolean handled;
- g_signal_emit (label, signals[ACTIVATE_LINK], 0, link->uri, &handled);
+ g_signal_emit (self, signals[ACTIVATE_LINK], 0, link->uri, &handled);
/* signal handler might have invalidated the layout */
- if (!priv->layout)
+ if (!self->layout)
return;
if (handled && !link->visited &&
- priv->select_info && priv->select_info->links)
+ self->select_info && self->select_info->links)
{
link->visited = TRUE;
- update_link_state (label);
+ update_link_state (self);
}
}
static void
-gtk_label_activate_current_link (GtkLabel *label)
+gtk_label_activate_current_link (GtkLabel *self)
{
GtkLabelLink *link;
- GtkWidget *widget = GTK_WIDGET (label);
+ GtkWidget *widget = GTK_WIDGET (self);
- link = gtk_label_get_focus_link (label, NULL);
+ link = gtk_label_get_focus_link (self, NULL);
if (link)
- emit_activate_link (label, link);
+ emit_activate_link (self, link);
else
gtk_widget_activate_default (widget);
}
static GtkLabelLink *
-gtk_label_get_current_link (GtkLabel *label)
+gtk_label_get_current_link (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
GtkLabelLink *link;
- if (!priv->select_info)
+ if (!self->select_info)
return NULL;
- if (priv->select_info->link_clicked)
- link = priv->select_info->active_link;
+ if (self->select_info->link_clicked)
+ link = self->select_info->active_link;
else
- link = gtk_label_get_focus_link (label, NULL);
+ link = gtk_label_get_focus_link (self, NULL);
return link;
}
@@ -5641,13 +5505,13 @@ gtk_label_get_current_link (GtkLabel *label)
* The string is owned by GTK+ and must not be freed or modified.
*/
const gchar *
-gtk_label_get_current_uri (GtkLabel *label)
+gtk_label_get_current_uri (GtkLabel *self)
{
GtkLabelLink *link;
- g_return_val_if_fail (GTK_IS_LABEL (label), NULL);
+ g_return_val_if_fail (GTK_IS_LABEL (self), NULL);
- link = gtk_label_get_current_link (label);
+ link = gtk_label_get_current_link (self);
if (link)
return link->uri;
@@ -5662,9 +5526,8 @@ gtk_label_query_tooltip (GtkWidget *widget,
gboolean keyboard_tip,
GtkTooltip *tooltip)
{
- GtkLabel *label = GTK_LABEL (widget);
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelSelectionInfo *info = priv->select_info;
+ GtkLabel *self = GTK_LABEL (widget);
+ GtkLabelSelectionInfo *info = self->select_info;
gint index = -1;
if (info && info->links)
@@ -5676,13 +5539,13 @@ gtk_label_query_tooltip (GtkWidget *widget,
}
else
{
- if (!get_layout_index (label, x, y, &index))
+ if (!get_layout_index (self, x, y, &index))
index = -1;
}
if (index != -1)
{
- const int link_index = _gtk_label_get_link_at (label, index);
+ const int link_index = _gtk_label_get_link_at (self, index);
if (link_index != -1)
{
@@ -5703,25 +5566,21 @@ gtk_label_query_tooltip (GtkWidget *widget,
}
gint
-_gtk_label_get_cursor_position (GtkLabel *label)
+_gtk_label_get_cursor_position (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->select_info && priv->select_info->selectable)
- return g_utf8_pointer_to_offset (priv->text,
- priv->text + priv->select_info->selection_end);
+ if (self->select_info && self->select_info->selectable)
+ return g_utf8_pointer_to_offset (self->text,
+ self->text + self->select_info->selection_end);
return 0;
}
gint
-_gtk_label_get_selection_bound (GtkLabel *label)
+_gtk_label_get_selection_bound (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->select_info && priv->select_info->selectable)
- return g_utf8_pointer_to_offset (priv->text,
- priv->text + priv->select_info->selection_anchor);
+ if (self->select_info && self->select_info->selectable)
+ return g_utf8_pointer_to_offset (self->text,
+ self->text + self->select_info->selection_anchor);
return 0;
}
@@ -5737,19 +5596,17 @@ _gtk_label_get_selection_bound (GtkLabel *label)
* number of lines.
*/
void
-gtk_label_set_lines (GtkLabel *label,
+gtk_label_set_lines (GtkLabel *self,
gint lines)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_return_if_fail (GTK_IS_LABEL (label));
-
- if (priv->lines != lines)
+ if (self->lines != lines)
{
- priv->lines = lines;
- gtk_label_clear_layout (label);
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_LINES]);
- gtk_widget_queue_resize (GTK_WIDGET (label));
+ self->lines = lines;
+ gtk_label_clear_layout (self);
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_LINES]);
+ gtk_widget_queue_resize (GTK_WIDGET (self));
}
}
@@ -5763,49 +5620,41 @@ gtk_label_set_lines (GtkLabel *label,
* Returns: The number of lines
*/
gint
-gtk_label_get_lines (GtkLabel *label)
+gtk_label_get_lines (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), -1);
- g_return_val_if_fail (GTK_IS_LABEL (label), -1);
-
- return priv->lines;
+ return self->lines;
}
gint
-_gtk_label_get_n_links (GtkLabel *label)
+_gtk_label_get_n_links (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->select_info)
- return priv->select_info->n_links;
+ if (self->select_info)
+ return self->select_info->n_links;
return 0;
}
const gchar *
-_gtk_label_get_link_uri (GtkLabel *label,
+_gtk_label_get_link_uri (GtkLabel *self,
gint idx)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->select_info)
- return priv->select_info->links[idx].uri;
+ if (self->select_info)
+ return self->select_info->links[idx].uri;
return NULL;
}
void
-_gtk_label_get_link_extent (GtkLabel *label,
+_gtk_label_get_link_extent (GtkLabel *self,
gint idx,
gint *start,
gint *end)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->select_info)
+ if (self->select_info)
{
- const GtkLabelLink *link = &priv->select_info->links[idx];
+ const GtkLabelLink *link = &self->select_info->links[idx];
*start = link->start;
*end = link->end;
@@ -5818,18 +5667,16 @@ _gtk_label_get_link_extent (GtkLabel *label,
}
int
-_gtk_label_get_link_at (GtkLabel *label,
+_gtk_label_get_link_at (GtkLabel *self,
int pos)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->select_info)
+ if (self->select_info)
{
guint i;
- for (i = 0; i < priv->select_info->n_links; i++)
+ for (i = 0; i < self->select_info->n_links; i++)
{
- const GtkLabelLink *link = &priv->select_info->links[i];
+ const GtkLabelLink *link = &self->select_info->links[i];
if (link->start <= pos && pos < link->end)
return i;
@@ -5840,37 +5687,32 @@ _gtk_label_get_link_at (GtkLabel *label,
}
void
-_gtk_label_activate_link (GtkLabel *label,
+_gtk_label_activate_link (GtkLabel *self,
gint idx)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->select_info)
+ if (self->select_info)
{
- GtkLabelLink *link = &priv->select_info->links[idx];
+ GtkLabelLink *link = &self->select_info->links[idx];
- emit_activate_link (label, link);
+ emit_activate_link (self, link);
}
}
gboolean
-_gtk_label_get_link_visited (GtkLabel *label,
+_gtk_label_get_link_visited (GtkLabel *self,
gint idx)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- if (priv->select_info)
- return priv->select_info->links[idx].visited;
+ if (self->select_info)
+ return self->select_info->links[idx].visited;
return FALSE;
}
gboolean
-_gtk_label_get_link_focused (GtkLabel *label,
+_gtk_label_get_link_focused (GtkLabel *self,
gint idx)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GtkLabelSelectionInfo *info = priv->select_info;
+ GtkLabelSelectionInfo *info = self->select_info;
if (!info)
return FALSE;
@@ -5898,22 +5740,20 @@ _gtk_label_get_link_focused (GtkLabel *label,
* Sets the #GtkLabel:xalign property for @label.
*/
void
-gtk_label_set_xalign (GtkLabel *label,
+gtk_label_set_xalign (GtkLabel *self,
gfloat xalign)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_return_if_fail (GTK_IS_LABEL (label));
+ xalign = CLAMP (xalign, 0.0, 1.0);
- xalign = CLAMP (xalign, 0.0, 1.0);
-
- if (priv->xalign == xalign)
+ if (self->xalign == xalign)
return;
- priv->xalign = xalign;
+ self->xalign = xalign;
- gtk_widget_queue_draw (GTK_WIDGET (label));
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_XALIGN]);
+ gtk_widget_queue_draw (GTK_WIDGET (self));
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_XALIGN]);
}
/**
@@ -5925,13 +5765,11 @@ gtk_label_set_xalign (GtkLabel *label,
* Returns: the xalign property
*/
gfloat
-gtk_label_get_xalign (GtkLabel *label)
+gtk_label_get_xalign (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), 0.5);
- g_return_val_if_fail (GTK_IS_LABEL (label), 0.5);
-
- return priv->xalign;
+ return self->xalign;
}
/**
@@ -5942,22 +5780,20 @@ gtk_label_get_xalign (GtkLabel *label)
* Sets the #GtkLabel:yalign property for @label.
*/
void
-gtk_label_set_yalign (GtkLabel *label,
+gtk_label_set_yalign (GtkLabel *self,
gfloat yalign)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
-
- g_return_if_fail (GTK_IS_LABEL (label));
+ g_return_if_fail (GTK_IS_LABEL (self));
yalign = CLAMP (yalign, 0.0, 1.0);
- if (priv->yalign == yalign)
+ if (self->yalign == yalign)
return;
- priv->yalign = yalign;
+ self->yalign = yalign;
- gtk_widget_queue_draw (GTK_WIDGET (label));
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_YALIGN]);
+ gtk_widget_queue_draw (GTK_WIDGET (self));
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_YALIGN]);
}
/**
@@ -5969,13 +5805,11 @@ gtk_label_set_yalign (GtkLabel *label,
* Returns: the yalign property
*/
gfloat
-gtk_label_get_yalign (GtkLabel *label)
+gtk_label_get_yalign (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), 0.5);
- g_return_val_if_fail (GTK_IS_LABEL (label), 0.5);
-
- return priv->yalign;
+ return self->yalign;
}
/**
@@ -5987,17 +5821,15 @@ gtk_label_get_yalign (GtkLabel *label)
* the context menu for @label.
*/
void
-gtk_label_set_extra_menu (GtkLabel *label,
+gtk_label_set_extra_menu (GtkLabel *self,
GMenuModel *model)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_if_fail (GTK_IS_LABEL (self));
- g_return_if_fail (GTK_IS_LABEL (label));
-
- if (g_set_object (&priv->extra_menu, model))
+ if (g_set_object (&self->extra_menu, model))
{
- g_clear_pointer (&priv->popup_menu, gtk_widget_unparent);
- g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_EXTRA_MENU]);
+ g_clear_pointer (&self->popup_menu, gtk_widget_unparent);
+ g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_EXTRA_MENU]);
}
}
@@ -6010,11 +5842,9 @@ gtk_label_set_extra_menu (GtkLabel *label,
* Returns: (transfer none): (nullable): the menu model
*/
GMenuModel *
-gtk_label_get_extra_menu (GtkLabel *label)
+gtk_label_get_extra_menu (GtkLabel *self)
{
- GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ g_return_val_if_fail (GTK_IS_LABEL (self), NULL);
- g_return_val_if_fail (GTK_IS_LABEL (label), NULL);
-
- return priv->extra_menu;
+ return self->extra_menu;
}
diff --git a/gtk/gtklabel.h b/gtk/gtklabel.h
index 81320427e4..7a89b6a2fe 100644
--- a/gtk/gtklabel.h
+++ b/gtk/gtklabel.h
@@ -29,7 +29,6 @@
#error "Only can be included directly."
#endif
-#include
#include
G_BEGIN_DECLS
@@ -47,131 +46,131 @@ GtkWidget* gtk_label_new (const gchar *str);
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_label_new_with_mnemonic (const gchar *str);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_text (GtkLabel *label,
+void gtk_label_set_text (GtkLabel *self,
const gchar *str);
GDK_AVAILABLE_IN_ALL
-const gchar* gtk_label_get_text (GtkLabel *label);
+const gchar* gtk_label_get_text (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_attributes (GtkLabel *label,
+void gtk_label_set_attributes (GtkLabel *self,
PangoAttrList *attrs);
GDK_AVAILABLE_IN_ALL
-PangoAttrList *gtk_label_get_attributes (GtkLabel *label);
+PangoAttrList *gtk_label_get_attributes (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_label (GtkLabel *label,
+void gtk_label_set_label (GtkLabel *self,
const gchar *str);
GDK_AVAILABLE_IN_ALL
-const gchar * gtk_label_get_label (GtkLabel *label);
+const gchar * gtk_label_get_label (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_markup (GtkLabel *label,
+void gtk_label_set_markup (GtkLabel *self,
const gchar *str);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_use_markup (GtkLabel *label,
+void gtk_label_set_use_markup (GtkLabel *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
-gboolean gtk_label_get_use_markup (GtkLabel *label);
+gboolean gtk_label_get_use_markup (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_use_underline (GtkLabel *label,
+void gtk_label_set_use_underline (GtkLabel *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
-gboolean gtk_label_get_use_underline (GtkLabel *label);
+gboolean gtk_label_get_use_underline (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_markup_with_mnemonic (GtkLabel *label,
+void gtk_label_set_markup_with_mnemonic (GtkLabel *self,
const gchar *str);
GDK_AVAILABLE_IN_ALL
-guint gtk_label_get_mnemonic_keyval (GtkLabel *label);
+guint gtk_label_get_mnemonic_keyval (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_mnemonic_widget (GtkLabel *label,
+void gtk_label_set_mnemonic_widget (GtkLabel *self,
GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
-GtkWidget *gtk_label_get_mnemonic_widget (GtkLabel *label);
+GtkWidget *gtk_label_get_mnemonic_widget (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_text_with_mnemonic (GtkLabel *label,
+void gtk_label_set_text_with_mnemonic (GtkLabel *self,
const gchar *str);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_justify (GtkLabel *label,
+void gtk_label_set_justify (GtkLabel *self,
GtkJustification jtype);
GDK_AVAILABLE_IN_ALL
-GtkJustification gtk_label_get_justify (GtkLabel *label);
+GtkJustification gtk_label_get_justify (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_ellipsize (GtkLabel *label,
- PangoEllipsizeMode mode);
+void gtk_label_set_ellipsize (GtkLabel *self,
+ PangoEllipsizeMode mode);
GDK_AVAILABLE_IN_ALL
-PangoEllipsizeMode gtk_label_get_ellipsize (GtkLabel *label);
+PangoEllipsizeMode gtk_label_get_ellipsize (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_width_chars (GtkLabel *label,
- gint n_chars);
+void gtk_label_set_width_chars (GtkLabel *self,
+ int n_chars);
GDK_AVAILABLE_IN_ALL
-gint gtk_label_get_width_chars (GtkLabel *label);
+gint gtk_label_get_width_chars (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_max_width_chars (GtkLabel *label,
- gint n_chars);
+void gtk_label_set_max_width_chars (GtkLabel *self,
+ int n_chars);
GDK_AVAILABLE_IN_ALL
-gint gtk_label_get_max_width_chars (GtkLabel *label);
+gint gtk_label_get_max_width_chars (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_lines (GtkLabel *label,
+void gtk_label_set_lines (GtkLabel *self,
gint lines);
GDK_AVAILABLE_IN_ALL
-gint gtk_label_get_lines (GtkLabel *label);
+gint gtk_label_get_lines (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_wrap (GtkLabel *label,
+void gtk_label_set_wrap (GtkLabel *self,
gboolean wrap);
GDK_AVAILABLE_IN_ALL
-gboolean gtk_label_get_wrap (GtkLabel *label);
+gboolean gtk_label_get_wrap (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_wrap_mode (GtkLabel *label,
+void gtk_label_set_wrap_mode (GtkLabel *self,
PangoWrapMode wrap_mode);
GDK_AVAILABLE_IN_ALL
-PangoWrapMode gtk_label_get_wrap_mode (GtkLabel *label);
+PangoWrapMode gtk_label_get_wrap_mode (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_selectable (GtkLabel *label,
+void gtk_label_set_selectable (GtkLabel *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
-gboolean gtk_label_get_selectable (GtkLabel *label);
+gboolean gtk_label_get_selectable (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_select_region (GtkLabel *label,
+void gtk_label_select_region (GtkLabel *self,
gint start_offset,
gint end_offset);
GDK_AVAILABLE_IN_ALL
-gboolean gtk_label_get_selection_bounds (GtkLabel *label,
+gboolean gtk_label_get_selection_bounds (GtkLabel *self,
gint *start,
gint *end);
GDK_AVAILABLE_IN_ALL
-PangoLayout *gtk_label_get_layout (GtkLabel *label);
+PangoLayout *gtk_label_get_layout (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_get_layout_offsets (GtkLabel *label,
+void gtk_label_get_layout_offsets (GtkLabel *self,
gint *x,
gint *y);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_single_line_mode (GtkLabel *label,
+void gtk_label_set_single_line_mode (GtkLabel *self,
gboolean single_line_mode);
GDK_AVAILABLE_IN_ALL
-gboolean gtk_label_get_single_line_mode (GtkLabel *label);
+gboolean gtk_label_get_single_line_mode (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-const gchar *gtk_label_get_current_uri (GtkLabel *label);
+const gchar *gtk_label_get_current_uri (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_xalign (GtkLabel *label,
+void gtk_label_set_xalign (GtkLabel *self,
gfloat xalign);
GDK_AVAILABLE_IN_ALL
-gfloat gtk_label_get_xalign (GtkLabel *label);
+gfloat gtk_label_get_xalign (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_yalign (GtkLabel *label,
+void gtk_label_set_yalign (GtkLabel *self,
gfloat yalign);
GDK_AVAILABLE_IN_ALL
-gfloat gtk_label_get_yalign (GtkLabel *label);
+gfloat gtk_label_get_yalign (GtkLabel *self);
GDK_AVAILABLE_IN_ALL
-void gtk_label_set_extra_menu (GtkLabel *label,
+void gtk_label_set_extra_menu (GtkLabel *self,
GMenuModel *model);
GDK_AVAILABLE_IN_ALL
-GMenuModel * gtk_label_get_extra_menu (GtkLabel *label);
+GMenuModel * gtk_label_get_extra_menu (GtkLabel *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLabel, g_object_unref)