示例#1
0
void _register_cb(void *data, Evas_Object *win, void *event_info) {
	Evas_Object *eo = (Evas_Object *)data;
	AtkObject *obj, *obj_item;
	obj = eail_factory_get_accessible(eo);
	atk_object_set_description(obj, DESCRITPION);
	atk_object_set_name (obj, NAME);
	obj_item = atk_object_ref_accessible_child(obj,0);
	atk_object_set_description(obj_item, DESCRITPION_ITEM);
	atk_object_set_name (obj_item, NAME_ITEM);
}
示例#2
0
static void _check_values (AtkObject *obj)
{
  static gint calls = 0;
  AtkRole role;

  g_print ("Start of _check_values\n");

  _set_values(obj);

  _add_handler (obj);

  if (++calls < 2)
  { 
    /*
     * Just do this on this on the first 2 objects visited
     */
    atk_object_set_name (obj, "test123");
    atk_object_set_description (obj, "test123");
  }

  role = atk_object_get_role (obj);

  if (role == ATK_ROLE_FRAME || role == ATK_ROLE_DIALOG)
  {
    /*
     * Add handlers to all children.
     */
    _traverse_children (obj);
  }
  g_print ("End of _check_values\n");
}
示例#3
0
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);
}
示例#4
0
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;
}
示例#5
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");
}
示例#6
0
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);
}
示例#7
0
void _register_cb(void *data, Evas_Object *win, void *event_info) {
	Evas_Object *eo = (Evas_Object *)data;
	AtkObject *obj;
	obj = eail_factory_get_accessible(eo);
	atk_object_set_description(obj, DESCRITPION);
	atk_object_set_name (obj, NAME);
}
static gboolean
app_state_changed_idle (gpointer user_data)
{
	GsFeatureTile *tile = GS_FEATURE_TILE (user_data);
	AtkObject *accessible;
	g_autofree gchar *name = NULL;

	accessible = gtk_widget_get_accessible (GTK_WIDGET (tile));

	switch (gs_app_get_state (tile->app)) {
	case AS_APP_STATE_INSTALLED:
	case AS_APP_STATE_INSTALLING:
	case AS_APP_STATE_REMOVING:
	case AS_APP_STATE_UPDATABLE:
	case AS_APP_STATE_UPDATABLE_LIVE:
		name = g_strdup_printf ("%s (%s)",
					gs_app_get_name (tile->app),
					_("Installed"));
		break;
	case AS_APP_STATE_AVAILABLE:
	default:
		name = g_strdup (gs_app_get_name (tile->app));
		break;
	}

	if (GTK_IS_ACCESSIBLE (accessible)) {
		atk_object_set_name (accessible, name);
		atk_object_set_description (accessible, gs_app_get_summary (tile->app));
	}

	g_object_unref (tile);
	return G_SOURCE_REMOVE;
}
示例#9
0
文件: main.c 项目: braikar/mate-panel
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;
}
示例#10
0
static void
add_section_toolbar (CEPageIP6 *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);
}
示例#11
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"));
	}
}
示例#12
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;
}
示例#13
0
文件: led.c 项目: pwithnall/mcus
static void
mcus_led_accessible_initialize (AtkObject *accessible, gpointer widget)
{
	atk_object_set_name (accessible, _("Single LED widget"));
	atk_object_set_description (accessible, _("Provides visual Boolean output"));

	a11y_parent_class->initialize (accessible, widget);
}
示例#14
0
static AtkObject *
create_accessible (HTMLObject *o,
                   AtkObject *parent)
{
	AtkObject *accessible = NULL;

	switch (HTML_OBJECT_TYPE (o)) {
	case HTML_TYPE_CLUEFLOW:
		accessible = html_a11y_paragraph_new (o);
		break;
	case HTML_TYPE_TEXT:
		accessible = html_a11y_text_new (o);
		break;
	case HTML_TYPE_IMAGE:
		accessible = html_a11y_image_new (o);
		break;
	case HTML_TYPE_TABLE:
		accessible = html_a11y_table_new (o);
		break;
	case HTML_TYPE_TABLECELL:
		accessible = html_a11y_cell_new (o);
		break;
	case HTML_TYPE_RULE:
		accessible = html_a11y_new (o, ATK_ROLE_SEPARATOR);
		break;
	case HTML_TYPE_EMBEDDED:
	case HTML_TYPE_SELECT:
	case HTML_TYPE_RADIO:
	case HTML_TYPE_OBJECT:
	case HTML_TYPE_TEXTAREA:
	case HTML_TYPE_TEXTINPUT:
	case HTML_TYPE_BUTTON:
	case HTML_TYPE_CHECKBOX:
	case HTML_TYPE_IFRAME:
		if (HTML_EMBEDDED (o)-> widget) {
			accessible = gtk_widget_get_accessible (HTML_EMBEDDED (o)->widget);

			if (HTML_EMBEDDED (o)->name) {
				if ((accessible != NULL) && (atk_object_get_name (accessible) == NULL))
					atk_object_set_name (accessible, HTML_EMBEDDED (o)->name);
			}
		}
		break;
	case HTML_TYPE_TEXTSLAVE: /* ignore */
		break;
	default:
		accessible = html_a11y_new (o, ATK_ROLE_UNKNOWN);
		break;
	}

	if (accessible && parent) {
		/* printf ("set parent of %p to %p\n", accessible, parent); */
		atk_object_set_parent (accessible, parent);
	}

	return accessible;
}
示例#15
0
static gboolean
applet_factory (PanelApplet *applet,
                const gchar *iid,
                gpointer     user_data)
{
  NaTray     *tray;
  AppletData *data;
  AtkObject  *atko;

  if (!(strcmp (iid, "OAFIID:GNOME_NotificationAreaApplet") == 0 ||
        strcmp (iid, "OAFIID:GNOME_SystemTrayApplet") == 0))
    return FALSE;

  tray = na_tray_new_for_screen (gtk_widget_get_screen (GTK_WIDGET (applet)),
				 get_orientation_from_applet (applet));

  data = g_slice_new (AppletData);
  data->applet = applet;
  data->tray = tray;
  data->about_dialog = NULL;

  g_object_set_data_full (G_OBJECT (applet),
                          "system-tray-data",
                          data,
                          (GDestroyNotify) free_applet_data);

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

  panel_applet_set_flags (applet,
                          PANEL_APPLET_HAS_HANDLE|PANEL_APPLET_EXPAND_MINOR);
  
  g_signal_connect (applet, "change_orient",
                    G_CALLBACK (applet_change_orientation), data);
  g_signal_connect (applet, "change_background",
                    G_CALLBACK (applet_change_background), data);
  g_signal_connect (applet, "destroy",
		    G_CALLBACK (applet_destroy), data);

  panel_applet_set_background_widget (applet, GTK_WIDGET (applet));

  gtk_container_add (GTK_CONTAINER (applet), GTK_WIDGET (tray));
  
#ifndef NOTIFICATION_AREA_INPROCESS
  gtk_window_set_default_icon_name (NOTIFICATION_AREA_ICON);
#endif
  gtk_widget_show_all (GTK_WIDGET (applet));

  panel_applet_setup_menu_from_file (applet,
  			             NULL,
                                     "GNOME_NotificationAreaApplet.xml",
                                     NULL,
                                     menu_verbs,
                                     data);
  
  return TRUE;
}
示例#16
0
static void
gtk_spinner_accessible_initialize (AtkObject *accessible,
                                   gpointer   widget)
{
  ATK_OBJECT_CLASS (_gtk_spinner_accessible_parent_class)->initialize (accessible, widget);

  atk_object_set_name (accessible, C_("throbbing progress animation widget", "Spinner"));
  atk_object_set_description (accessible, _("Provides visual indication of progress"));
  atk_object_set_role (accessible, ATK_ROLE_ANIMATION);
}
示例#17
0
文件: gtkswitch.c 项目: BYC/gtk
static void
_gtk_switch_accessible_initialize (AtkObject *accessible,
                                   gpointer   widget)
{
  ATK_OBJECT_CLASS (_gtk_switch_accessible_parent_class)->initialize (accessible, widget);

  atk_object_set_role (accessible, ATK_ROLE_TOGGLE_BUTTON);
  atk_object_set_name (accessible, C_("light switch widget", "Switch"));
  atk_object_set_description (accessible, _("Switches between on and off states"));
}
示例#18
0
void
eel_accessibility_set_name (gpointer    object,
			    const char *name)
{
	AtkObject *atk_object = eel_accessibility_for_object (object);

	if (atk_object) {
		atk_object_set_name (atk_object, name);
	}
}
示例#19
0
GtkWidget*
create_window1 (void)
{
  GtkWidget *window1;
  AtkObject *atko;
  GtkWidget *taula_principal;
  GtkWidget *llista;
  GtkWidget *reprodueix;
  GtkWidget *surt;

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window1), _("Miniphono"));

  taula_principal = gtk_table_new (3, 3, TRUE);
  gtk_widget_show (taula_principal);
  gtk_container_add (GTK_CONTAINER (window1), taula_principal);

  llista = gtk_button_new_with_mnemonic (_("Selecciona una llista"));
  gtk_widget_show (llista);
  gtk_table_attach (GTK_TABLE (taula_principal), llista, 2, 3, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);
  gtk_widget_set_size_request (llista, 200, 50);

  reprodueix = gtk_button_new_with_mnemonic (_("reprodueix"));
  gtk_widget_show (reprodueix);
  gtk_table_attach (GTK_TABLE (taula_principal), reprodueix, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);
  gtk_widget_set_size_request (reprodueix, 100, 50);

  surt = gtk_button_new_with_mnemonic (_("surt"));
  gtk_widget_show (surt);
  gtk_table_attach (GTK_TABLE (taula_principal), surt, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);
  gtk_widget_set_size_request (surt, 100, 50);

  g_signal_connect ((gpointer) surt, "clicked",
                    G_CALLBACK (gtk_main_quit),
                    NULL);

  atko = gtk_widget_get_accessible (window1);
  atk_object_set_name (atko, _("Miniphono"));


  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (window1, window1, "window1");
  GLADE_HOOKUP_OBJECT (window1, taula_principal, "taula_principal");
  GLADE_HOOKUP_OBJECT (window1, llista, "llista");
  GLADE_HOOKUP_OBJECT (window1, reprodueix, "reprodueix");
  GLADE_HOOKUP_OBJECT (window1, surt, "surt");

  return window1;
}
static AtkObject*
gucharmap_chartable_accessible_ref_child (AtkObject *obj,
                                          int index)
{
  GucharmapChartableAccessible *table;
  GucharmapChartableAccessiblePrivate *priv;
  GtkWidget *widget;
  GucharmapChartable *chartable;
  AtkObject *child;
  gchar* name;
  GPtrArray *cells;
  guint n_cells, n;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
  if (widget == NULL)
    /* State is defunct */
    return NULL;

  if (index > UNICHAR_MAX)
    return NULL;

  table = GUCHARMAP_CHARTABLE_ACCESSIBLE (obj);
  priv = GET_PRIVATE (table);

  /* Check whether the child is cached */
  cells = priv->cells;
  n_cells = cells->len;
  for (n = 0; n < n_cells; ++n)
    {
      GucharmapChartableCellAccessible *cell = g_ptr_array_index (cells, n);

      if (index == cell->index)
        return g_object_ref (cell);
    }

  /* Not cached, create a new cell accessible */
  chartable = GUCHARMAP_CHARTABLE (widget);

  child = gucharmap_chartable_cell_accessible_new ();
  gucharmap_chartable_cell_accessible_initialise (GUCHARMAP_CHARTABLE_CELL_ACCESSIBLE (child),
                            GTK_WIDGET (chartable), obj, index);
  /* Set the name of the cell */
  name = g_strdup_printf("U+%4.4X %s", index, gucharmap_get_unicode_name (index));
  atk_object_set_name (child, name);
  g_free (name);
  set_cell_visibility (chartable, GUCHARMAP_CHARTABLE_CELL_ACCESSIBLE (child), FALSE);

  /* Store the cell in our cache */
  g_ptr_array_add (priv->cells, child);
  g_object_weak_ref (G_OBJECT (child),
                     (GWeakNotify) cell_destroyed,
                     child);

  return child; 
}
示例#21
0
static gboolean
applet_factory (MatePanelApplet *applet,
		const char  *iid,
		gpointer     user_data)
{
    gboolean ret = FALSE;
    GtkWidget *drive_list;
    AtkObject *ao;
    GtkActionGroup *action_group;
    gchar *ui_path;

    if (!strcmp (iid, drivemount_iid)) {
	g_set_application_name (_("Disk Mounter"));

	gtk_window_set_default_icon_name ("media-floppy");

	mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
	mate_panel_applet_set_background_widget (applet, GTK_WIDGET (applet));

	drive_list = drive_list_new ();
	gtk_container_add (GTK_CONTAINER (applet), drive_list);

	g_signal_connect_object (applet, "change_orient",
				 G_CALLBACK (change_orient), drive_list, 0);
	g_signal_connect_object (applet, "size_allocate",
				 G_CALLBACK (size_allocate), drive_list, 0);
	g_signal_connect (applet, "change_background",
			  G_CALLBACK (change_background), drive_list);

	/* set initial state */
	change_orient (applet,
		       mate_panel_applet_get_orient (applet),
		       DRIVE_LIST (drive_list));

	action_group = gtk_action_group_new ("DriveMount Applet Actions");
	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
	gtk_action_group_add_actions (action_group,
				      applet_menu_actions,
				      G_N_ELEMENTS (applet_menu_actions),
				      drive_list);
	ui_path = g_build_filename (DRIVEMOUNT_MENU_UI_DIR, "drivemount-applet-menu.xml", NULL);
	mate_panel_applet_setup_menu_from_file (applet, ui_path, action_group);
	g_free (ui_path);
	g_object_unref (action_group);

	ao = gtk_widget_get_accessible (GTK_WIDGET (applet));
	atk_object_set_name (ao, _("Disk Mounter"));

	gtk_widget_show_all (GTK_WIDGET (applet));

	ret = TRUE;
    }

    return ret;
}
示例#22
0
static Drawer *
create_drawer_applet (PanelToplevel    *toplevel,
                      PanelToplevel    *parent_toplevel,
                      const char       *tooltip,
                      const char       *custom_icon,
                      gboolean          use_custom_icon,
                      PanelOrientation  orientation)
{
    Drawer *drawer;
    AtkObject *atk_obj;

    drawer = g_new0 (Drawer, 1);

    drawer->toplevel = toplevel;

    if (!use_custom_icon || !custom_icon || !custom_icon [0]) {
        drawer->button = button_widget_new (PANEL_ICON_DRAWER, TRUE, orientation);
    } else {
        drawer->button = button_widget_new (custom_icon, TRUE, orientation);
    }

    if (!drawer->button) {
        g_free (drawer);
        return NULL;
    }

    atk_obj = gtk_widget_get_accessible (drawer->button);
    atk_object_set_name (atk_obj, _("Drawer"));

    set_tooltip_and_name (drawer, tooltip);

    g_signal_connect (drawer->button, "clicked", G_CALLBACK (drawer_click), drawer);
    g_signal_connect (drawer->button, "key_press_event", G_CALLBACK (key_press_drawer), drawer);
    g_signal_connect (drawer->toplevel, "key_press_event", G_CALLBACK (key_press_drawer_widget), drawer);


    gtk_drag_dest_set (drawer->button, 0, NULL, 0, 0);

    g_signal_connect (drawer->button, "drag_data_get", G_CALLBACK (drag_data_get_cb), drawer);
    g_signal_connect (drawer->button, "drag_motion", G_CALLBACK (drag_motion_cb), drawer);
    g_signal_connect (drawer->button, "drag_drop", G_CALLBACK (drag_drop_cb), drawer);
    g_signal_connect (drawer->button, "drag_data_received", G_CALLBACK (drag_data_received_cb), drawer);
    g_signal_connect (drawer->button, "drag_leave", G_CALLBACK (drag_leave_cb), drawer);


    g_signal_connect (drawer->button, "destroy", G_CALLBACK (destroy_drawer), drawer);
    g_signal_connect (drawer->toplevel, "destroy", G_CALLBACK (toplevel_destroyed), drawer);

    gtk_widget_show (drawer->button);

    panel_toplevel_attach_to_widget (drawer->toplevel, parent_toplevel, GTK_WIDGET (drawer->button));

    return drawer;
}
示例#23
0
文件: accessible.c 项目: GNOME/at-spi
/*
 * CORBA Accessibility::Accessible::set_name method implementation
 */
static void
impl_accessibility_accessible_set_name (PortableServer_Servant servant,
                                        const CORBA_char      *name,
                                        CORBA_Environment     *ev)
{
  AtkObject *object = get_atkobject_from_servant (servant);

  g_return_if_fail (object != NULL);

  atk_object_set_name (object, name);
}
示例#24
0
static void
set_atk_name_description (GtkWidget *widget, const gchar *name, const gchar *description)
{
    AtkObject *aobj = gtk_widget_get_accessible (widget);
    
    /* Check if gail is loaded */
    if (GTK_IS_ACCESSIBLE (aobj) == FALSE)
        return;

    atk_object_set_name (aobj, name);
    atk_object_set_description (aobj, description);
}
示例#25
0
CajaIconContainer *
fm_icon_container_construct (FMIconContainer *icon_container, FMIconView *view)
{
    AtkObject *atk_obj;

    g_return_val_if_fail (FM_IS_ICON_VIEW (view), NULL);

    icon_container->view = view;
    atk_obj = gtk_widget_get_accessible (GTK_WIDGET (icon_container));
    atk_object_set_name (atk_obj, _("Icon View"));

    return CAJA_ICON_CONTAINER (icon_container);
}
NautilusCanvasContainer *
nautilus_canvas_view_container_construct (NautilusCanvasViewContainer *canvas_container, NautilusCanvasView *view)
{
	AtkObject *atk_obj;

	g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), NULL);

	canvas_container->view = view;
	atk_obj = gtk_widget_get_accessible (GTK_WIDGET (canvas_container));
	atk_object_set_name (atk_obj, _("Icon View"));

	return NAUTILUS_CANVAS_CONTAINER (canvas_container);
}
示例#27
0
NemoIconContainer *
nemo_icon_view_container_construct (NemoIconViewContainer *icon_container, NemoIconView *view)
{
	AtkObject *atk_obj;

	g_return_val_if_fail (NEMO_IS_ICON_VIEW (view), NULL);

	icon_container->view = view;
	atk_obj = gtk_widget_get_accessible (GTK_WIDGET (icon_container));
	atk_object_set_name (atk_obj, _("Icon View"));

	return NEMO_ICON_CONTAINER (icon_container);
}
示例#28
0
static void
_do_test(AtkObject *obj)
{
   g_assert(ATK_IS_OBJECT(obj));
   g_assert(atk_object_get_role(obj) == ATK_ROLE_ANIMATION);
   atk_object_set_description(obj, "test");
   g_assert_cmpstr(atk_object_get_description(obj), ==, "test");

   atk_object_set_name(obj, "test name");
   g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");

   eailu_test_code_called = 1;
}
GtkWidget *
hard_drive_status_tile_new ()
{
    GtkWidget *tile;

    GtkWidget *image;
    GtkWidget *header;
    GtkWidget *subheader;

    AtkObject *accessible;
    char *name;

    image = gtk_image_new ();
    slab_load_image (GTK_IMAGE (image), GTK_ICON_SIZE_BUTTON, "utilities-system-monitor");

    name = g_strdup (_("_System Monitor"));

    header = gtk_label_new (name);
    gtk_label_set_use_underline (GTK_LABEL (header), TRUE);
    gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5);

    subheader = gtk_label_new (NULL);
    gtk_misc_set_alignment (GTK_MISC (subheader), 0.0, 0.5);
    gtk_widget_modify_fg (subheader, GTK_STATE_NORMAL,
                          &subheader->style->fg[GTK_STATE_INSENSITIVE]);

    tile = g_object_new (HARD_DRIVE_STATUS_TILE_TYPE, "tile-uri", "tile://hard-drive-status",
                         "nameplate-image", image, "nameplate-header", header, "nameplate-subheader",
                         subheader, NULL);

    TILE (tile)->actions = g_new0 (TileAction *, 1);
    TILE (tile)->n_actions = 1;

    TILE (tile)->actions[HARD_DRIVE_STATUS_TILE_ACTION_OPEN] =
        tile_action_new (TILE (tile), open_hard_drive_tile, NULL,
                         TILE_ACTION_OPENS_NEW_WINDOW);

    TILE (tile)->default_action = TILE (tile)->actions[HARD_DRIVE_STATUS_TILE_ACTION_OPEN];

    g_signal_connect (G_OBJECT (tile), "hide", G_CALLBACK (tile_hide_event_cb), NULL);
    g_signal_connect (G_OBJECT (tile), "show", G_CALLBACK (tile_show_event_cb), NULL);

    accessible = gtk_widget_get_accessible (tile);
    atk_object_set_name (accessible, name);

    gtk_label_set_mnemonic_widget (GTK_LABEL (header), GTK_WIDGET (tile));

    g_free (name);

    return GTK_WIDGET (tile);
}
示例#30
0
static void
set_atk_name_description (GtkWidget  *widget,
			  const char *name,
			  const char *description)
{	
  AtkObject *aobj;
	
  aobj = gtk_widget_get_accessible (widget);
  if (!GTK_IS_ACCESSIBLE (aobj))
    return;

  atk_object_set_name (aobj, name);
  atk_object_set_description (aobj, description);
}