static void gail_toggle_button_real_notify_gtk (GObject *obj, GParamSpec *pspec) { GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (obj); AtkObject *atk_obj; atk_obj = gtk_widget_get_accessible (GTK_WIDGET (toggle_button)); if (strcmp (pspec->name, "inconsistent") == 0) atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (gtk_widget_get_sensitive (GTK_WIDGET (toggle_button)) && !gtk_toggle_button_get_inconsistent (toggle_button))); else if (strcmp (pspec->name, "sensitive") == 0) { /* Need to override gailwidget behavior of notifying for ENABLED */ gboolean sensitive; gboolean enabled; sensitive = gtk_widget_get_sensitive (GTK_WIDGET (toggle_button)); enabled = sensitive && !gtk_toggle_button_get_inconsistent (toggle_button); atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive); atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, enabled); } else GAIL_WIDGET_CLASS (gail_toggle_button_parent_class)->notify_gtk (obj, pspec); }
static void gail_window_real_notify_gtk (GObject *obj, GParamSpec *pspec) { GtkWidget *widget = GTK_WIDGET (obj); AtkObject* atk_obj = gtk_widget_get_accessible (widget); GailWindow *window = GAIL_WINDOW (atk_obj); const gchar *name; gboolean name_changed = FALSE; if (strcmp (pspec->name, "title") == 0) { name = gtk_window_get_title (GTK_WINDOW (widget)); if (name) { if (window->previous_name == NULL || strcmp (name, window->previous_name) != 0) name_changed = TRUE; } else if (window->previous_name != NULL) name_changed = TRUE; if (name_changed) { g_free (window->previous_name); window->previous_name = g_strdup (name); if (window->name_change_handler == 0) window->name_change_handler = gdk_threads_add_idle (idle_notify_name_change, atk_obj); } } else GAIL_WIDGET_CLASS (gail_window_parent_class)->notify_gtk (obj, pspec); }
static void gail_spin_button_real_notify_gtk (GObject *obj, GParamSpec *pspec) { GtkWidget *widget = GTK_WIDGET (obj); GailSpinButton *spin_button = GAIL_SPIN_BUTTON (gtk_widget_get_accessible (widget)); if (strcmp (pspec->name, "adjustment") == 0) { /* * Get rid of the GailAdjustment for the GtkAdjustment * which was associated with the spin_button. */ GtkSpinButton* gtk_spin_button; if (spin_button->adjustment) { g_object_unref (spin_button->adjustment); spin_button->adjustment = NULL; } /* * Create the GailAdjustment when notify for "adjustment" property * is received */ gtk_spin_button = GTK_SPIN_BUTTON (widget); spin_button->adjustment = gail_adjustment_new (gtk_spin_button->adjustment); g_signal_connect (gtk_spin_button->adjustment, "value-changed", G_CALLBACK (gail_spin_button_value_changed), spin_button); } else GAIL_WIDGET_CLASS (gail_spin_button_parent_class)->notify_gtk (obj, pspec); }
static void gail_scale_button_class_init (GailScaleButtonClass *klass) { AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); GailWidgetClass *widget_class = GAIL_WIDGET_CLASS (klass); atk_object_class->initialize = gail_scale_button_initialize; widget_class->notify_gtk = gail_scale_button_notify_gtk; }
static void gail_check_sub_menu_item_real_notify_gtk (GObject *obj, GParamSpec *pspec) { GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (obj); AtkObject *atk_obj; atk_obj = gtk_widget_get_accessible (GTK_WIDGET (check_menu_item)); if (strcmp (pspec->name, "inconsistent") == 0) atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, !gtk_check_menu_item_get_inconsistent (check_menu_item)); else GAIL_WIDGET_CLASS (gail_check_sub_menu_item_parent_class)->notify_gtk (obj, pspec); }
static void gail_toggle_button_real_notify_gtk (GObject *obj, GParamSpec *pspec) { GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (obj); AtkObject *atk_obj; atk_obj = gtk_widget_get_accessible (GTK_WIDGET (toggle_button)); if (strcmp (pspec->name, "inconsistent") == 0) atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, !gtk_toggle_button_get_inconsistent (toggle_button)); else GAIL_WIDGET_CLASS (gail_toggle_button_parent_class)->notify_gtk (obj, pspec); }
static void gail_expander_real_notify_gtk (GObject *obj, GParamSpec *pspec) { AtkObject* atk_obj; GtkExpander *expander; GailExpander *gail_expander; expander = GTK_EXPANDER (obj); atk_obj = gtk_widget_get_accessible (GTK_WIDGET (expander)); ; if (strcmp (pspec->name, "label") == 0) { const gchar* label_text; label_text = gail_expander_get_full_text (expander); gail_expander = GAIL_EXPANDER (atk_obj); if (gail_expander->textutil) gail_text_util_text_setup (gail_expander->textutil, label_text); if (atk_obj->name == NULL) { /* * The label has changed so notify a change in accessible-name */ g_object_notify (G_OBJECT (atk_obj), "accessible-name"); } /* * The label is the only property which can be changed */ g_signal_emit_by_name (atk_obj, "visible_data_changed"); } else if (strcmp (pspec->name, "expanded") == 0) { atk_object_notify_state_change (atk_obj, ATK_STATE_CHECKED, gtk_expander_get_expanded (expander)); atk_object_notify_state_change (atk_obj, ATK_STATE_EXPANDED, gtk_expander_get_expanded (expander)); g_signal_emit_by_name (atk_obj, "visible_data_changed"); } else GAIL_WIDGET_CLASS (gail_expander_parent_class)->notify_gtk (obj, pspec); }
static void gail_scale_button_notify_gtk (GObject *obj, GParamSpec *pspec) { GtkScaleButton *gtk_scale_button; GailScaleButton *scale_button; g_return_if_fail (GTK_IS_SCALE_BUTTON (obj)); gtk_scale_button = GTK_SCALE_BUTTON (obj); scale_button = GAIL_SCALE_BUTTON (gtk_widget_get_accessible (GTK_WIDGET (gtk_scale_button))); if (strcmp (pspec->name, "value") == 0) { g_object_notify (G_OBJECT (scale_button), "accessible-value"); } else { GAIL_WIDGET_CLASS (gail_scale_button_parent_class)->notify_gtk (obj, pspec); } }
static void gail_notebook_real_notify_gtk (GObject *obj, GParamSpec *pspec) { GtkWidget *widget; AtkObject* atk_obj; widget = GTK_WIDGET (obj); atk_obj = gtk_widget_get_accessible (widget); if (strcmp (pspec->name, "page") == 0) { gint page_num, old_page_num; gint focus_page_num = 0; gint old_focus_page_num; GailNotebook *gail_notebook; GtkNotebook *gtk_notebook; gail_notebook = GAIL_NOTEBOOK (atk_obj); gtk_notebook = GTK_NOTEBOOK (widget); if (gail_notebook->page_count < gtk_notebook_get_n_pages (gtk_notebook)) check_cache (gail_notebook, gtk_notebook); /* * Notify SELECTED state change for old and new page */ old_page_num = gail_notebook->selected_page; page_num = gtk_notebook_get_current_page (gtk_notebook); gail_notebook->selected_page = page_num; gail_notebook->focus_tab_page = page_num; old_focus_page_num = gail_notebook->focus_tab_page; if (page_num != old_page_num) { AtkObject *obj; if (old_page_num != -1) { obj = gail_notebook_ref_child (atk_obj, old_page_num); if (obj) { atk_object_notify_state_change (obj, ATK_STATE_SELECTED, FALSE); g_object_unref (obj); } } obj = gail_notebook_ref_child (atk_obj, page_num); if (obj) { atk_object_notify_state_change (obj, ATK_STATE_SELECTED, TRUE); g_object_unref (obj); /* * The page which is being displayed has changed but there is * no need to tell the focus tracker as the focus page will also * change or a widget in the page will receive focus if the * Notebook does not have tabs. */ } g_signal_emit_by_name (atk_obj, "selection_changed"); g_signal_emit_by_name (atk_obj, "visible_data_changed"); } if (gtk_notebook_get_show_tabs (gtk_notebook) && (focus_page_num != old_focus_page_num)) { if (gail_notebook->idle_focus_id) g_source_remove (gail_notebook->idle_focus_id); gail_notebook->idle_focus_id = gdk_threads_add_idle (gail_notebook_check_focus_tab, atk_obj); } } else GAIL_WIDGET_CLASS (gail_notebook_parent_class)->notify_gtk (obj, pspec); }
static void gail_label_real_notify_gtk (GObject *obj, GParamSpec *pspec) { GtkWidget *widget = GTK_WIDGET (obj); AtkObject* atk_obj = gtk_widget_get_accessible (widget); GtkLabel *label; GailLabel *gail_label; GObject *gail_obj; AtkObject *top_level; AtkObject *temp_obj; gail_label = GAIL_LABEL (atk_obj); if (strcmp (pspec->name, "label") == 0) { /* * We may get a label change for a label which is not attached to an * application. We wait until the toplevel window is created before * emitting the notification. * * This happens when [Ctrl+]Alt+Tab is pressed in metacity */ if (!gail_label->has_top_level) { temp_obj = atk_obj; top_level = NULL; while (temp_obj) { top_level = temp_obj; temp_obj = atk_object_get_parent (top_level); } if (atk_object_get_role (top_level) != ATK_ROLE_APPLICATION) { if (gail_label->window_create_handler == 0 && GAIL_IS_WINDOW (top_level)) gail_label->window_create_handler = g_signal_connect_after (top_level, "create", G_CALLBACK (window_created), atk_obj); } else gail_label->has_top_level = TRUE; } if (gail_label->has_top_level) notify_name_change (atk_obj); } else if (strcmp (pspec->name, "cursor-position") == 0) { gint start, end, tmp; gboolean text_caret_moved = FALSE; gboolean selection_changed = FALSE; gail_obj = G_OBJECT (atk_obj); label = GTK_LABEL (widget); if (gail_label->selection_bound != -1 && gail_label->selection_bound < gail_label->cursor_position) { tmp = gail_label->selection_bound; gail_label->selection_bound = gail_label->cursor_position; gail_label->cursor_position = tmp; } if (gtk_label_get_selection_bounds (label, &start, &end)) { if (start != gail_label->cursor_position || end != gail_label->selection_bound) { if (end != gail_label->selection_bound) { gail_label->selection_bound = start; gail_label->cursor_position = end; } else { gail_label->selection_bound = end; gail_label->cursor_position = start; } text_caret_moved = TRUE; if (start != end) selection_changed = TRUE; } } else { if (gail_label->cursor_position != gail_label->selection_bound) selection_changed = TRUE; if (gtk_label_get_selectable (label)) { if (gail_label->cursor_position != -1 && start != gail_label->cursor_position) text_caret_moved = TRUE; if (gail_label->selection_bound != -1 && end != gail_label->selection_bound) { text_caret_moved = TRUE; gail_label->cursor_position = end; gail_label->selection_bound = start; } else { gail_label->cursor_position = start; gail_label->selection_bound = end; } } else { /* GtkLabel has become non selectable */ gail_label->cursor_position = 0; gail_label->selection_bound = 0; text_caret_moved = TRUE; } } if (text_caret_moved) g_signal_emit_by_name (gail_obj, "text_caret_moved", gail_label->cursor_position); if (selection_changed) g_signal_emit_by_name (gail_obj, "text_selection_changed"); } else GAIL_WIDGET_CLASS (gail_label_parent_class)->notify_gtk (obj, pspec); }