mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 14:31:10 +00:00
GtkLabelAccessible: remove redundant check
We always have the textutil now, so remove some NULL checks. Also, never say 'State is defunct' again...
This commit is contained in:
parent
dddf587aec
commit
828d70c6d7
@ -130,7 +130,7 @@ gtk_label_accessible_init (GtkLabelAccessible *label)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_label_accessible_real_initialize (AtkObject *obj,
|
gtk_label_accessible_real_initialize (AtkObject *obj,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkLabelAccessible *accessible;
|
GtkLabelAccessible *accessible;
|
||||||
@ -170,7 +170,7 @@ gtk_label_accessible_real_initialize (AtkObject *obj,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_label_accessible_init_text_util (GtkLabelAccessible *accessible,
|
gtk_label_accessible_init_text_util (GtkLabelAccessible *accessible,
|
||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkLabel *label;
|
GtkLabel *label;
|
||||||
const gchar *label_text;
|
const gchar *label_text;
|
||||||
@ -181,7 +181,7 @@ gtk_label_accessible_init_text_util (GtkLabelAccessible *accessible,
|
|||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
label_text = gtk_label_get_text (label);
|
label_text = gtk_label_get_text (label);
|
||||||
gail_text_util_text_setup (accessible->textutil, label_text);
|
gail_text_util_text_setup (accessible->textutil, label_text);
|
||||||
|
|
||||||
if (label_text == NULL)
|
if (label_text == NULL)
|
||||||
accessible->label_length = 0;
|
accessible->label_length = 0;
|
||||||
else
|
else
|
||||||
@ -198,18 +198,12 @@ notify_name_change (AtkObject *atk_obj)
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_obj));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_obj));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/*
|
|
||||||
* State is defunct
|
|
||||||
*/
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gail_obj = G_OBJECT (atk_obj);
|
gail_obj = G_OBJECT (atk_obj);
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
accessible = GTK_LABEL_ACCESSIBLE (atk_obj);
|
accessible = GTK_LABEL_ACCESSIBLE (atk_obj);
|
||||||
|
|
||||||
if (accessible->textutil == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether the label has actually changed before emitting
|
* Check whether the label has actually changed before emitting
|
||||||
* notification.
|
* notification.
|
||||||
@ -238,7 +232,7 @@ notify_name_change (AtkObject *atk_obj)
|
|||||||
|
|
||||||
gtk_label_accessible_init_text_util (accessible, widget);
|
gtk_label_accessible_init_text_util (accessible, widget);
|
||||||
|
|
||||||
g_signal_emit_by_name (gail_obj, "text_changed::insert", 0,
|
g_signal_emit_by_name (gail_obj, "text_changed::insert", 0,
|
||||||
accessible->label_length);
|
accessible->label_length);
|
||||||
|
|
||||||
if (atk_obj->name == NULL)
|
if (atk_obj->name == NULL)
|
||||||
@ -386,9 +380,6 @@ gtk_label_accessible_ref_relation_set (AtkObject *obj)
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/*
|
|
||||||
* State is defunct
|
|
||||||
*/
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
relation_set = ATK_OBJECT_CLASS (gtk_label_accessible_parent_class)->ref_relation_set (obj);
|
relation_set = ATK_OBJECT_CLASS (gtk_label_accessible_parent_class)->ref_relation_set (obj);
|
||||||
@ -462,9 +453,6 @@ gtk_label_accessible_get_name (AtkObject *accessible)
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/*
|
|
||||||
* State is defunct
|
|
||||||
*/
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_LABEL (widget), NULL);
|
g_return_val_if_fail (GTK_IS_LABEL (widget), NULL);
|
||||||
@ -509,22 +497,17 @@ gtk_label_accessible_get_text (AtkText *text,
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
|
|
||||||
label_text = gtk_label_get_text (label);
|
label_text = gtk_label_get_text (label);
|
||||||
|
|
||||||
if (label_text == NULL)
|
if (label_text == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
{
|
return gail_text_util_get_substring (GTK_LABEL_ACCESSIBLE (text)->textutil,
|
||||||
if (GTK_LABEL_ACCESSIBLE (text)->textutil == NULL)
|
|
||||||
gtk_label_accessible_init_text_util (GTK_LABEL_ACCESSIBLE (text), widget);
|
|
||||||
return gail_text_util_get_substring (GTK_LABEL_ACCESSIBLE (text)->textutil,
|
|
||||||
start_pos, end_pos);
|
start_pos, end_pos);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar*
|
static gchar*
|
||||||
@ -538,9 +521,7 @@ gtk_label_accessible_get_text_before_offset (AtkText *text,
|
|||||||
GtkLabel *label;
|
GtkLabel *label;
|
||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
|
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Get label */
|
/* Get label */
|
||||||
@ -564,7 +545,6 @@ gtk_label_accessible_get_text_at_offset (AtkText *text,
|
|||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
|
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Get label */
|
/* Get label */
|
||||||
@ -588,10 +568,7 @@ gtk_label_accessible_get_text_after_offset (AtkText *text,
|
|||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
|
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
{
|
|
||||||
/* State is defunct */
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* Get label */
|
/* Get label */
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
@ -609,7 +586,6 @@ gtk_label_accessible_get_character_count (AtkText *text)
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
@ -631,7 +607,6 @@ gtk_label_accessible_set_caret_offset (AtkText *text,
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
@ -656,7 +631,6 @@ gtk_label_accessible_get_n_selections (AtkText *text)
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
@ -681,7 +655,6 @@ gtk_label_accessible_get_selection (AtkText *text,
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
@ -717,7 +690,6 @@ gtk_label_accessible_add_selection (AtkText *text,
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
@ -744,7 +716,6 @@ gtk_label_accessible_remove_selection (AtkText *text,
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (selection_num != 0)
|
if (selection_num != 0)
|
||||||
@ -776,7 +747,6 @@ gtk_label_accessible_set_selection (AtkText *text,
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (selection_num != 0)
|
if (selection_num != 0)
|
||||||
@ -814,7 +784,6 @@ gtk_label_accessible_get_character_extents (AtkText *text,
|
|||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
|
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
@ -841,8 +810,8 @@ gtk_label_accessible_get_offset_at_point (AtkText *text,
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
|
|
||||||
gtk_label_get_layout_offsets (label, &x_layout, &y_layout);
|
gtk_label_get_layout_offsets (label, &x_layout, &y_layout);
|
||||||
@ -876,7 +845,6 @@ gtk_label_accessible_get_run_attributes (AtkText *text,
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
@ -915,7 +883,6 @@ gtk_label_accessible_get_default_attributes (AtkText *text)
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
@ -937,7 +904,6 @@ gtk_label_accessible_get_character_at_offset (AtkText *text,
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return '\0';
|
return '\0';
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
|
Loading…
Reference in New Issue
Block a user