static void
nemo_blank_desktop_window_constructed (GObject *obj)
{
	AtkObject *accessible;
	NemoBlankDesktopWindow *window = NEMO_BLANK_DESKTOP_WINDOW (obj);

	G_OBJECT_CLASS (nemo_blank_desktop_window_parent_class)->constructed (obj);

	/* Set the accessible name so that it doesn't inherit the cryptic desktop URI. */
	accessible = gtk_widget_get_accessible (GTK_WIDGET (window));

	if (accessible) {
		atk_object_set_name (accessible, _("Desktop"));
	}

    nemo_blank_desktop_window_update_geometry (window);

    gtk_window_set_resizable (GTK_WINDOW (window),
                  FALSE);
    gtk_window_set_decorated (GTK_WINDOW (window),
                  FALSE);

    gtk_widget_show_all (GTK_WIDGET (window));

    g_signal_connect (GTK_WIDGET (window), "button-press-event", G_CALLBACK (on_button_press), window);
    g_signal_connect (GTK_WIDGET (window), "popup-menu", G_CALLBACK (on_popup_menu), window);
}
static AtkObject *
panel_menu_button_accessible_ref_child (AtkObject *obj,
					int        index)
{
	PanelMenuButton *button;
	GtkWidget       *menu;

	g_return_val_if_fail (PANEL_IS_MENU_BUTTON_ACCESSIBLE (obj), NULL);

	if (index != 0)
		return NULL;

#if GTK_CHECK_VERSION (2, 21, 0)
	if (!(button = PANEL_MENU_BUTTON (gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)))))
#else
	if (!(button = PANEL_MENU_BUTTON (GTK_ACCESSIBLE (obj)->widget)))
#endif
		return NULL;

	if (!(menu = panel_menu_button_create_menu (button)))
		return NULL;
	/*
	 * This ensures that the menu is populated with all menu items
	 */
	g_signal_emit_by_name (menu, "show", NULL);

	return g_object_ref (gtk_widget_get_accessible (menu));
}
Exemple #3
0
static gboolean applet_factory(MatePanelApplet* applet, const gchar* iid, gpointer user_data)
{
    AtkObject* atko;

    if (!(strcmp (iid, "NotificationArea") == 0 || strcmp (iid, "SystemTrayApplet") == 0))
    {
        return FALSE;
    }

    /* Defer loading until applet is added to panel so
     * gtk_widget_get_screen returns correct information */
    g_signal_connect(GTK_WIDGET(applet), "realize", G_CALLBACK(on_applet_realized), NULL);

    atko = gtk_widget_get_accessible (GTK_WIDGET (applet));
    atk_object_set_name (atko, _("Panel Notification Area"));

    mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_HAS_HANDLE | MATE_PANEL_APPLET_EXPAND_MINOR);

    mate_panel_applet_set_background_widget(applet, GTK_WIDGET(applet));

    force_no_focus_padding(GTK_WIDGET(applet));

#ifndef NOTIFICATION_AREA_INPROCESS
    gtk_window_set_default_icon_name(NOTIFICATION_AREA_ICON);
#endif

    gtk_widget_show_all(GTK_WIDGET(applet));
    return TRUE;
}
Exemple #4
0
static AtkObject *
gtk_menu_item_accessible_ref_selection (AtkSelection *selection,
                                           gint          i)
{
  GtkMenuShell *shell;
  AtkObject *obj;
  GtkWidget *widget;
  GtkWidget *menu;
  GtkWidget *item;

  if (i != 0)
    return NULL;

  widget =  gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
  if (widget == NULL)
    return NULL;

  menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
  if (menu == NULL)
    return NULL;

  shell = GTK_MENU_SHELL (menu);

  item = gtk_menu_shell_get_selected_item (shell);
  if (item != NULL)
    {
      obj = gtk_widget_get_accessible (item);
      g_object_ref (obj);
      return obj;
    }

  return NULL;
}
static void
nemo_blank_desktop_window_constructed (GObject *obj)
{
	AtkObject *accessible;
	NemoBlankDesktopWindow *window = NEMO_BLANK_DESKTOP_WINDOW (obj);

	G_OBJECT_CLASS (nemo_blank_desktop_window_parent_class)->constructed (obj);

	/* Set the accessible name so that it doesn't inherit the cryptic desktop URI. */
	accessible = gtk_widget_get_accessible (GTK_WIDGET (window));

	if (accessible) {
		atk_object_set_name (accessible, _("Desktop"));
	}

    GdkRectangle rect;

    nemo_desktop_utils_get_monitor_geometry (window->details->monitor, &rect);

    DEBUG ("NemoBlankDesktopWindow monitor:%d: x:%d, y:%d, w:%d, h:%d",
           window->details->monitor,
           rect.x, rect.y,
           rect.width, rect.height);

    gtk_window_move (GTK_WINDOW (window), rect.x, rect.y);
    gtk_widget_set_size_request (GTK_WIDGET (window), rect.width, rect.height);

    gtk_window_set_resizable (GTK_WINDOW (window),
                  FALSE);

    gtk_widget_show_all (GTK_WIDGET (window));

    g_signal_connect (GTK_WIDGET (window), "button-press-event", G_CALLBACK (on_button_press), window);
    g_signal_connect (GTK_WIDGET (window), "popup-menu", G_CALLBACK (on_popup_menu), window);
}
Exemple #6
0
int
main (int argc, char *argv[])
{
    GtkWidget *window, *list, *sw, *row;
    GtkWidget *hbox, *vbox, *combo, *button;
    gint i;
    gchar *text;

    gtk_init (NULL, NULL);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size (GTK_WINDOW (window), -1, 300);

    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
    gtk_container_add (GTK_CONTAINER (window), hbox);
    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
    g_object_set (vbox, "margin", 12, NULL);
    gtk_container_add (GTK_CONTAINER (hbox), vbox);

    list = gtk_list_box_new ();
    gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);

    g_signal_connect (list, "row-activated", G_CALLBACK (on_row_activated), NULL);
    g_signal_connect (list, "selected-rows-changed", G_CALLBACK (on_selected_children_changed), NULL);
    g_signal_connect (gtk_widget_get_accessible (list), "selection-changed", G_CALLBACK (a11y_selection_changed), NULL);

    sw = gtk_scrolled_window_new (NULL, NULL);
    gtk_widget_set_hexpand (sw, TRUE);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
    gtk_container_add (GTK_CONTAINER (hbox), sw);
    gtk_container_add (GTK_CONTAINER (sw), list);

    button = gtk_check_button_new_with_label ("Activate on single click");
    g_object_bind_property (list, "activate-on-single-click",
                            button, "active",
                            G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
    gtk_container_add (GTK_CONTAINER (vbox), button);

    combo = gtk_combo_box_text_new ();
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "None");
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Single");
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Browse");
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Multiple");
    g_signal_connect (combo, "changed", G_CALLBACK (selection_mode_changed), list);
    gtk_container_add (GTK_CONTAINER (vbox), combo);
    gtk_combo_box_set_active (GTK_COMBO_BOX (combo), gtk_list_box_get_selection_mode (GTK_LIST_BOX (list)));

    for (i = 0; i < 20; i++)
    {
        text = g_strdup_printf ("Row %d", i);
        row = create_row (text);
        gtk_list_box_insert (GTK_LIST_BOX (list), row, -1);
    }

    gtk_widget_show_all (window);

    gtk_main ();

    return 0;
}
Exemple #7
0
static AtkObject*
gail_menu_shell_ref_selection (AtkSelection   *selection,
                               gint           i)
{
  GtkMenuShell *shell;
  AtkObject *obj;
  GtkWidget *widget;
  GtkWidget *item;

  if (i != 0)
    return NULL;

  widget =  gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
  if (widget == NULL)
  {
    /* State is defunct */
    return NULL;
  }

  shell = GTK_MENU_SHELL (widget);

  item = gtk_menu_shell_get_selected_item (shell);
  if (item != NULL)
  {
    obj = gtk_widget_get_accessible (item);
    g_object_ref (obj);
    return obj;
  }
  else
  {
    return NULL;
  }
}
static GtkWidget *getCloseButton(TaskTitle* title) {
    //Create the button
    GtkWidget *button = g_object_new (
        GTK_TYPE_EVENT_BOX,
        "visible-window", FALSE,
        "above-child", TRUE,
        NULL
    );

    //Add accessibility
    AtkObject *atk = gtk_widget_get_accessible (button);
    atk_object_set_name (atk, _("Close"));
    atk_object_set_description (atk, _("Close current window."));
    atk_object_set_role (atk, ATK_ROLE_PUSH_BUTTON);

    //Connect the signals
    g_signal_connect (button, "button-release-event",
        G_CALLBACK (on_close_clicked), title);
    g_signal_connect (button, "enter-notify-event",
        G_CALLBACK (on_enter_notify), title);
    g_signal_connect (button, "leave-notify-event",
        G_CALLBACK (on_leave_notify), title);
    g_signal_connect (button, "draw",
        G_CALLBACK (on_button_draw), title);

    return button;
}
Exemple #9
0
static gboolean
is_combo_window (GtkWidget *widget)
{
  GtkWidget *child;
  AtkObject *obj;

  child = gtk_bin_get_child (GTK_BIN (widget));

  if (!GTK_IS_EVENT_BOX (child))
    return FALSE;

  child = gtk_bin_get_child (GTK_BIN (child));

  if (!GTK_IS_FRAME (child))
    return FALSE;

  child = gtk_bin_get_child (GTK_BIN (child));

  if (!GTK_IS_SCROLLED_WINDOW (child))
    return FALSE;

  obj = gtk_widget_get_accessible (child);
  obj = atk_object_get_parent (obj);

  return FALSE;
}
Exemple #10
0
/**
 * gtk_tool_button_set_label:
 * @button: a #GtkToolButton
 * @label: (allow-none): a string that will be used as label, or %NULL.
 *
 * Sets @label as the label used for the tool button. The "label" property
 * only has an effect if not overridden by a non-%NULL "label_widget" property.
 * If both the "label_widget" and "label" properties are %NULL, the label
 * is determined by the "stock_id" property. If the "stock_id" property is also
 * %NULL, @button will not have a label.
 * 
 * Since: 2.4
 **/
void
gtk_tool_button_set_label (GtkToolButton *button,
			   const gchar   *label)
{
  gchar *old_label;
  gchar *elided_label;
  AtkObject *accessible;
  
  g_return_if_fail (GTK_IS_TOOL_BUTTON (button));

  old_label = button->priv->label_text;

  button->priv->label_text = g_strdup (label);
  button->priv->contents_invalid = TRUE;     

  if (label)
    {
      elided_label = _gtk_toolbar_elide_underscores (label);
      accessible = gtk_widget_get_accessible (GTK_WIDGET (button->priv->button));
      atk_object_set_name (accessible, elided_label);
      g_free (elided_label);
    }

  g_free (old_label);
 
  g_object_notify (G_OBJECT (button), "label");
}
void
_egg_list_box_accessible_selection_changed (EggListBox *box)
{
  AtkObject *accessible;
  accessible = gtk_widget_get_accessible (GTK_WIDGET (box));
  g_signal_emit_by_name (accessible, "selection-changed");
}
Exemple #12
0
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
gtk_check_menu_item_accessible_notify_gtk (GObject    *obj,
                                           GParamSpec *pspec)
{
  GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (obj);
  AtkObject *atk_obj;
  gboolean sensitive;
  gboolean inconsistent;
  gboolean active;

  atk_obj = gtk_widget_get_accessible (GTK_WIDGET (check_menu_item));
  sensitive = gtk_widget_get_sensitive (GTK_WIDGET (check_menu_item));
  inconsistent = gtk_check_menu_item_get_inconsistent (check_menu_item);
  active = gtk_check_menu_item_get_active (check_menu_item);

  if (strcmp (pspec->name, "inconsistent") == 0)
    {
      atk_object_notify_state_change (atk_obj, ATK_STATE_INDETERMINATE, inconsistent);
      atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
    }
  else if (strcmp (pspec->name, "sensitive") == 0)
    {
      /* Need to override gailwidget behavior of notifying for ENABLED */
      atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive);
      atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
    }
  else if (strcmp (pspec->name, "active") == 0)
    {
      atk_object_notify_state_change (atk_obj, ATK_STATE_CHECKED, active);
    }
  else
    GTK_WIDGET_ACCESSIBLE_CLASS (gtk_check_menu_item_accessible_parent_class)->notify_gtk (obj, pspec);
}
static void
add_section_toolbar (CEPageIP4 *page, GtkWidget *section, GCallback add_cb)
{
        GtkWidget *toolbar;
        GtkToolItem *item;
        GtkStyleContext *context;
        GtkWidget *box;
        GtkWidget *button;
        GtkWidget *image;

        toolbar = gtk_toolbar_new ();
        gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
        gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
        context = gtk_widget_get_style_context (toolbar);
        gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
        gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
        gtk_container_add (GTK_CONTAINER (section), toolbar);

        item = gtk_separator_tool_item_new ();
        gtk_tool_item_set_expand (item, TRUE);
        gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE);
        gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (item), 0);

        box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
        item = gtk_tool_item_new ();
        gtk_container_add (GTK_CONTAINER (item), box);
        button = gtk_button_new ();
        g_signal_connect_swapped (button, "clicked", G_CALLBACK (add_cb), page);
        image = gtk_image_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_MENU);
        atk_object_set_name (gtk_widget_get_accessible (button), _("Add"));
        gtk_button_set_image (GTK_BUTTON (button), image);
        gtk_container_add (GTK_CONTAINER (box), button);
        gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (item), 1);
}
Exemple #15
0
static void
gtk_icon_view_accessible_notify_gtk (GObject    *obj,
                                     GParamSpec *pspec)
{
  GtkIconView *icon_view;
  GtkWidget *widget;
  AtkObject *atk_obj;
  GtkIconViewAccessible *view;

  if (strcmp (pspec->name, "model") == 0)
    {
      widget = GTK_WIDGET (obj);
      atk_obj = gtk_widget_get_accessible (widget);
      view = (GtkIconViewAccessible*)atk_obj;
      if (view->model)
        {
          g_object_remove_weak_pointer (G_OBJECT (view->model),
                                        (gpointer *)&view->model);
          gtk_icon_view_accessible_disconnect_model_signals (view->model, widget);
        }
      gtk_icon_view_accessible_clear_cache (view);

      icon_view = GTK_ICON_VIEW (obj);
      view->model = icon_view->priv->model;
      /* If there is no model the GtkIconView is probably being destroyed */
      if (view->model)
        {
          g_object_add_weak_pointer (G_OBJECT (view->model), (gpointer *)&view->model);
          gtk_icon_view_accessible_connect_model_signals (icon_view);
        }
    }

  return;
}
Exemple #16
0
static gboolean
compare_focus (gpointer data)
{
  AtkObject *atk_focus;
  AtkObject *gtk_focus;
  GtkWidget *focus_widget;
  GList *list, *l;

  atk_focus = atk_get_focus_object ();

  focus_widget = NULL;
  list = gtk_window_list_toplevels ();
  for (l = list; l; l = l->next)
    {
      GtkWindow *w = l->data;
      if (gtk_window_is_active (w))
        {
          focus_widget = gtk_window_get_focus (w);
          break;
        }
    }
  g_list_free (list);

  if (GTK_IS_WIDGET (focus_widget))
    gtk_focus = gtk_widget_get_accessible (focus_widget);
  else
    gtk_focus = NULL;

  if (gtk_focus != atk_focus)
    g_print ("gtk focus: %s != atk focus: %s\n",
             get_name (gtk_focus), get_name (atk_focus));

  return G_SOURCE_CONTINUE;
}
Exemple #17
0
static AtkObject*
gtk_icon_view_accessible_ref_selection (AtkSelection *selection,
                                        gint          i)
{
  GList *l;
  GtkWidget *widget;
  GtkIconView *icon_view;
  GtkIconViewItem *item;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
  if (widget == NULL)
    return NULL;

  icon_view = GTK_ICON_VIEW (widget);

  l = icon_view->priv->items;
  while (l)
    {
      item = l->data;
      if (item->selected)
        {
          if (i == 0)
            return atk_object_ref_accessible_child (gtk_widget_get_accessible (widget), item->index);
          else
            i--;
        }
      l = l->next;
    }

  return NULL;
}
Exemple #18
0
static void test_webkit_atk_get_text_at_offset_text_input(void)
{
    WebKitWebView* webView;
    AtkObject* obj;
    GMainLoop* loop;
    AtkText* text_obj;

    webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
    g_object_ref_sink(webView);
    GtkAllocation alloc = { 0, 0, 800, 600 };
    gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
    webkit_web_view_load_string(webView, contentsInTextInput, NULL, NULL, NULL);
    loop = g_main_loop_new(NULL, TRUE);

    g_timeout_add(100, (GSourceFunc)bail_out, loop);
    g_main_loop_run(loop);

    /* Get to the inner AtkText object */
    obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
    g_assert(obj);
    obj = atk_object_ref_accessible_child(obj, 0);
    g_assert(obj);
    obj = atk_object_ref_accessible_child(obj, 0);
    g_assert(obj);

    text_obj = ATK_TEXT(obj);
    g_assert(ATK_IS_TEXT(text_obj));

    run_get_text_tests(text_obj);

    g_object_unref(webView);
}
Exemple #19
0
static AtkObject* 
gail_container_ref_child (AtkObject *obj,
                          gint       i)
{
  GList *children, *tmp_list;
  AtkObject  *accessible;
  GtkWidget *widget;

  g_return_val_if_fail (GAIL_IS_CONTAINER (obj), NULL);
  g_return_val_if_fail ((i >= 0), NULL);
  widget = GTK_ACCESSIBLE (obj)->widget;
  if (widget == NULL)
    return NULL;

  children = gtk_container_get_children (GTK_CONTAINER (widget));
  tmp_list = g_list_nth (children, i);
  if (!tmp_list)
    {
      g_list_free (children);
      return NULL;
    }  
  accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data));

  g_list_free (children);
  g_object_ref (accessible);
  return accessible; 
}
Exemple #20
0
static void testWebkitAtkGetTextInTable(void)
{
    WebKitWebView* webView;
    AtkObject* obj;
    GMainLoop* loop;

    webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
    g_object_ref_sink(webView);
    GtkAllocation alloc = { 0, 0, 800, 600 };
    gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
    webkit_web_view_load_string(webView, contentsInTable, NULL, NULL, NULL);
    loop = g_main_loop_new(NULL, TRUE);

    g_timeout_add(100, (GSourceFunc)bail_out, loop);
    g_main_loop_run(loop);

    obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
    g_assert(obj);
    obj = atk_object_ref_accessible_child(obj, 0);
    g_assert(obj);

    /* Tables should not implement AtkText */
    g_assert(G_TYPE_INSTANCE_GET_INTERFACE(obj, ATK_TYPE_TEXT, AtkTextIface) == NULL);

    g_object_unref(obj);
    g_object_unref(webView);
}
Exemple #21
0
static AtkObject *
gtk_menu_item_accessible_ref_child (AtkObject *obj,
                                    gint       i)
{
  AtkObject  *accessible;
  GtkWidget *widget;
  GtkWidget *submenu;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
  if (widget == NULL)
    return NULL;

  accessible = NULL;
  submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
  if (submenu)
    {
      GList *children;
      GList *tmp_list;

      children = gtk_container_get_children (GTK_CONTAINER (submenu));
      tmp_list = g_list_nth (children, i);
      if (tmp_list)
        {
          accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data));
          g_object_ref (accessible);
        }
      g_list_free (children);
    }

  return accessible;
}
Exemple #22
0
static void
caja_desktop_window_init (CajaDesktopWindow *window)
{
    GtkAction *action;
    AtkObject *accessible;

	window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_DESKTOP_WINDOW,
						       CajaDesktopWindowDetails);

    gtk_window_move (GTK_WINDOW (window), 0, 0);

    /* shouldn't really be needed given our semantic type
     * of _NET_WM_TYPE_DESKTOP, but why not
     */
    gtk_window_set_resizable (GTK_WINDOW (window),
                              FALSE);

    g_object_set_data (G_OBJECT (window), "is_desktop_window",
                       GINT_TO_POINTER (1));

    gtk_widget_hide (CAJA_WINDOW (window)->details->statusbar);
    gtk_widget_hide (CAJA_WINDOW (window)->details->menubar);

    /* Don't allow close action on desktop */
    action = gtk_action_group_get_action (CAJA_WINDOW (window)->details->main_action_group,
                                          CAJA_ACTION_CLOSE);
    gtk_action_set_sensitive (action, FALSE);

    /* Set the accessible name so that it doesn't inherit the cryptic desktop URI. */
    accessible = gtk_widget_get_accessible (GTK_WIDGET (window));

	if (accessible) {
        atk_object_set_name (accessible, _("Desktop"));
	}
}
static void
component_interface_get_extents (AtkComponent *component,
                                 gint *x,
                                 gint *y,
                                 gint *width,
                                 gint *height,
                                 AtkCoordType coord_type)
{
	GObject *g_obj;
	AtkObject *ea_canvas;
	EDayViewMainItem *main_item;
	EDayView *day_view;

	*x = *y = *width = *height = 0;

	g_return_if_fail (EA_IS_DAY_VIEW_MAIN_ITEM (component));

	g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component));
	if (!g_obj)
		/* defunct object*/
		return;
	main_item = E_DAY_VIEW_MAIN_ITEM (g_obj);
	day_view = e_day_view_main_item_get_day_view (main_item);

	ea_canvas = gtk_widget_get_accessible (day_view->main_canvas);
	atk_component_get_extents (
		ATK_COMPONENT (ea_canvas), x, y,
		width, height, coord_type);
}
Exemple #24
0
static AtkObject *
gtk_combo_box_accessible_ref_child (AtkObject *obj,
                                    gint       i)
{
    GtkWidget *widget;
    AtkObject *child;
    GtkComboBoxAccessible *box;

    widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
    if (widget == NULL)
        return NULL;

    if (i == 0)
    {
        child = gtk_combo_box_get_popup_accessible (GTK_COMBO_BOX (widget));
        box = GTK_COMBO_BOX_ACCESSIBLE (obj);
        if (box->popup_set == FALSE)
        {
            atk_object_set_parent (child, obj);
            box->popup_set = TRUE;
        }
    }
    else if (i == 1 && gtk_combo_box_get_has_entry (GTK_COMBO_BOX (widget)))
    {
        child = gtk_widget_get_accessible (gtk_bin_get_child (GTK_BIN (widget)));
    }
    else
    {
        return NULL;
    }

    return g_object_ref (child);
}
Exemple #25
0
static gboolean accessx_status_applet_fill(MatePanelApplet* applet)
{
	AccessxStatusApplet* sapplet;
	AtkObject* atk_object;
	GtkActionGroup* action_group;
	gchar* ui_path;
	gboolean was_realized = FALSE;

	sapplet = create_applet(applet);

	if (!gtk_widget_get_realized(sapplet->box))
	{
		g_signal_connect_after(G_OBJECT(sapplet->box), "realize", G_CALLBACK(accessx_status_applet_realize), sapplet);
	}
	else
	{
		accessx_status_applet_initialize(sapplet);
		was_realized = TRUE;
	}

	g_object_connect(sapplet->applet,
		"signal::destroy", accessx_status_applet_destroy, sapplet,
		"signal::change_orient", accessx_status_applet_reorient, sapplet,
		"signal::change_size", accessx_status_applet_resize, sapplet,
		NULL);

	g_signal_connect(sapplet->applet, "button_press_event", G_CALLBACK(button_press_cb), sapplet);
	g_signal_connect(sapplet->applet, "key_press_event", G_CALLBACK(key_press_cb), sapplet);

	action_group = gtk_action_group_new("Accessx Applet Actions");
	gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
	gtk_action_group_add_actions(action_group, accessx_status_applet_menu_actions, G_N_ELEMENTS(accessx_status_applet_menu_actions), sapplet);
	ui_path = g_build_filename(ACCESSX_MENU_UI_DIR, "accessx-status-applet-menu.xml", NULL);
	mate_panel_applet_setup_menu_from_file(sapplet->applet, ui_path, action_group);
	g_free(ui_path);

	if (mate_panel_applet_get_locked_down(sapplet->applet))
	{
		GtkAction* action = gtk_action_group_get_action(action_group, "Dialog");
		gtk_action_set_visible(action, FALSE);
	}

	g_object_unref(action_group);

	gtk_widget_set_tooltip_text(GTK_WIDGET(sapplet->applet), _("Keyboard Accessibility Status"));

	atk_object = gtk_widget_get_accessible(GTK_WIDGET(sapplet->applet));
	atk_object_set_name(atk_object, _("AccessX Status"));
	atk_object_set_description(atk_object, _("Displays current state of keyboard accessibility features"));
	gtk_widget_show_all(GTK_WIDGET(sapplet->applet));

	if (was_realized)
	{
		accessx_status_applet_reset(sapplet);
	}

	mate_panel_applet_set_background_widget (sapplet->applet, GTK_WIDGET (sapplet->applet));

	return TRUE;
}
Exemple #26
0
static void
gtk_combo_box_accessible_initialize (AtkObject *obj,
                                     gpointer   data)
{
    GtkComboBox *combo_box;
    GtkComboBoxAccessible *accessible;
    AtkObject *popup;

    ATK_OBJECT_CLASS (_gtk_combo_box_accessible_parent_class)->initialize (obj, data);

    combo_box = GTK_COMBO_BOX (data);
    accessible = GTK_COMBO_BOX_ACCESSIBLE (obj);

    g_signal_connect (combo_box, "changed", G_CALLBACK (changed_cb), NULL);
    accessible->old_selection = gtk_combo_box_get_active (combo_box);

    popup = gtk_combo_box_get_popup_accessible (combo_box);
    if (popup)
    {
        atk_object_set_parent (popup, obj);
        accessible->popup_set = TRUE;
    }
    if (gtk_combo_box_get_has_entry (combo_box))
        atk_object_set_parent (gtk_widget_get_accessible (gtk_bin_get_child (GTK_BIN (combo_box))), obj);

    obj->role = ATK_ROLE_COMBO_BOX;
}
static void
gtk_scale_button_accessible_notify_gtk (GObject    *obj,
                                        GParamSpec *pspec)
{
  GtkScaleButton *scale_button;
  GtkScaleButtonAccessible *accessible;

  scale_button = GTK_SCALE_BUTTON (obj);
  accessible = GTK_SCALE_BUTTON_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (scale_button)));

  if (strcmp (pspec->name, "adjustment") == 0)
    {
      GtkAdjustment* adjustment;

      adjustment = gtk_scale_button_get_adjustment (scale_button);
      g_signal_connect (adjustment,
                        "value-changed",
                        G_CALLBACK (gtk_scale_button_accessible_value_changed),
                        accessible);
    }
  else
    {
      GTK_WIDGET_ACCESSIBLE_CLASS (gtk_scale_button_accessible_parent_class)->notify_gtk (obj, pspec);
    }
}
Exemple #28
0
static gint
gail_notebook_real_remove_gtk (GtkContainer *container,
                               GtkWidget    *widget,
                               gpointer      data)    
{
  GailNotebook *gail_notebook;
  AtkObject *obj;
  gint index;

  g_return_val_if_fail (container != NULL, 1);
  gail_notebook = GAIL_NOTEBOOK (gtk_widget_get_accessible (GTK_WIDGET (container)));
  index = gail_notebook->remove_index;
  gail_notebook->remove_index = -1;

  obj = find_child_in_list (gail_notebook->page_cache, index);
  g_return_val_if_fail (obj, 1);
  gail_notebook->page_cache = g_list_remove (gail_notebook->page_cache, obj);
  gail_notebook->page_count -= 1;
  reset_cache (gail_notebook, index);
  g_signal_emit_by_name (gail_notebook,
                         "children_changed::remove",
                          GAIL_NOTEBOOK_PAGE (obj)->index, 
                          obj, NULL);
  g_object_unref (obj);
  return 1;
}
Exemple #29
0
static void
accessibility_settings_at (GtkToggleButton *button,
                           GtkBuilder      *builder)
{
  AtkObject  *atkobj;
  GObject    *info_logout;
  GObject    *no_atspi;
  gchar     **atspi;

  info_logout = gtk_builder_get_object (builder, "info-logout");
  no_atspi = gtk_builder_get_object (builder, "info-no-at");

  gtk_widget_hide (GTK_WIDGET (info_logout));
  gtk_widget_hide (GTK_WIDGET (no_atspi));

  if (gtk_toggle_button_get_active (button))
    {
      atspi = xfce_resource_match (XFCE_RESOURCE_CONFIG, "autostart/at-spi-*.desktop", TRUE);
      atkobj = gtk_widget_get_accessible (GTK_WIDGET (button));

      if (atspi == NULL || g_strv_length (atspi) == 0)
        gtk_widget_show (GTK_WIDGET (no_atspi));
      else if (!GTK_IS_ACCESSIBLE (atkobj))
        gtk_widget_show (GTK_WIDGET (info_logout));

      g_strfreev (atspi);
    }
}
Exemple #30
0
static void
gail_toggle_button_real_notify_gtk (GObject           *obj,
                                    GParamSpec        *pspec)
{
  GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (obj);
  AtkObject *atk_obj;
  gboolean sensitive;
  gboolean inconsistent;

  atk_obj = gtk_widget_get_accessible (GTK_WIDGET (toggle_button));
  sensitive = gtk_widget_get_sensitive (GTK_WIDGET (toggle_button));
  inconsistent = gtk_toggle_button_get_inconsistent (toggle_button);

  if (strcmp (pspec->name, "inconsistent") == 0)
    {
      atk_object_notify_state_change (atk_obj, ATK_STATE_INDETERMINATE, inconsistent);
      atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
    }
  else if (strcmp (pspec->name, "sensitive") == 0)
    {
      /* Need to override gailwidget behavior of notifying for ENABLED */
      atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive);
      atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
    }
  else
    GAIL_WIDGET_CLASS (gail_toggle_button_parent_class)->notify_gtk (obj, pspec);
}