Updating branch refs/heads/xfce-4.8
         to 6ade6385d1b672c86254cefbef5bf5780a6dffc4 (commit)
       from b625c6b66b82d1830f7d4c12a81f7087f3266ae6 (commit)

commit 6ade6385d1b672c86254cefbef5bf5780a6dffc4
Author: Nick Schermer <n...@xfce.org>
Date:   Tue Feb 8 17:55:23 2011 +0100

    Set some atk object names on widgets.

 plugins/actions/actions.c             |   14 ++++++++++++++
 plugins/directorymenu/directorymenu.c |    9 +++++++++
 plugins/launcher/launcher.c           |   21 +++++++++++++++++++--
 plugins/showdesktop/showdesktop.c     |   21 ++++++++++++++++-----
 4 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c
index 4664b89..f905851 100644
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -164,6 +164,7 @@ actions_plugin_init (ActionsPlugin *plugin)
 {
   GtkWidget   *widget;
   ActionEntry *entry = &action_entries[ACTION_LOG_OUT_DIALOG];
+  AtkObject   *atkobj;
 
   plugin->first_action = ACTION_LOG_OUT_DIALOG;
   plugin->second_action = ACTION_DISABLED;
@@ -180,6 +181,10 @@ actions_plugin_init (ActionsPlugin *plugin)
   xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (plugin), widget);
   gtk_widget_show (widget);
 
+  atkobj = gtk_widget_get_accessible (widget);
+  if (atkobj != NULL)
+    atk_object_set_name (atkobj, _(entry->title));
+
   plugin->first_image = xfce_panel_image_new_from_source (entry->icon_name);
   gtk_container_add (GTK_CONTAINER (widget), plugin->first_image);
   gtk_widget_show (plugin->first_image);
@@ -232,6 +237,7 @@ actions_plugin_set_property (GObject      *object,
 {
   ActionsPlugin *plugin = XFCE_ACTIONS_PLUGIN (object);
   ActionType     action;
+  AtkObject     *atkobj;
 
   switch (prop_id)
     {
@@ -243,6 +249,10 @@ actions_plugin_set_property (GObject      *object,
       xfce_panel_image_set_from_source (
           XFCE_PANEL_IMAGE (plugin->first_image),
           action_entries[action].icon_name);
+
+      atkobj = gtk_widget_get_accessible (plugin->first_button);
+      if (atkobj != NULL)
+        atk_object_set_name (atkobj, _(action_entries[action].title));
       break;
 
     case PROP_SECOND_ACTION:
@@ -262,6 +272,10 @@ actions_plugin_set_property (GObject      *object,
           xfce_panel_image_set_from_source (
               XFCE_PANEL_IMAGE (plugin->second_image),
               action_entries[action].icon_name);
+
+          atkobj = gtk_widget_get_accessible (plugin->second_button);
+          if (atkobj != NULL)
+            atk_object_set_name (atkobj, _(action_entries[action].title));
         }
 
       /* update plugin size */
diff --git a/plugins/directorymenu/directorymenu.c 
b/plugins/directorymenu/directorymenu.c
index 7a217dd..229a340 100644
--- a/plugins/directorymenu/directorymenu.c
+++ b/plugins/directorymenu/directorymenu.c
@@ -226,6 +226,7 @@ directory_menu_plugin_set_property (GObject      *object,
   guint                 i;
   GFile                *base_directory;
   const gchar          *path;
+  AtkObject            *atkobj;
 
   switch (prop_id)
     {
@@ -242,6 +243,14 @@ directory_menu_plugin_set_property (GObject      *object,
 
       display_name = g_file_get_parse_name (plugin->base_directory);
       gtk_widget_set_tooltip_text (plugin->button, display_name);
+
+      atkobj = gtk_widget_get_accessible (plugin->button);
+      if (atkobj != NULL)
+        {
+          atk_object_set_name (atkobj, _("Directory Menu"));
+          atk_object_set_description (atkobj, display_name);
+        }
+
       g_free (display_name);
       break;
 
diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index c3a5dce..272b5a7 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -341,6 +341,7 @@ static void
 launcher_plugin_init (LauncherPlugin *plugin)
 {
   GtkIconTheme *icon_theme;
+  AtkObject    *atkobj;
 
   plugin->disable_tooltips = FALSE;
   plugin->move_first = FALSE;
@@ -384,8 +385,6 @@ launcher_plugin_init (LauncherPlugin *plugin)
   g_signal_connect_after (G_OBJECT (plugin->button), "expose-event",
       G_CALLBACK (launcher_plugin_button_expose_event), plugin);
 
-
-
   plugin->child = xfce_panel_image_new ();
   gtk_container_add (GTK_CONTAINER (plugin->button), plugin->child);
 
@@ -403,6 +402,10 @@ launcher_plugin_init (LauncherPlugin *plugin)
   g_signal_connect (G_OBJECT (plugin->arrow), "drag-leave",
       G_CALLBACK (launcher_plugin_arrow_drag_leave), plugin);
 
+  atkobj = gtk_widget_get_accessible (plugin->arrow);
+  if (atkobj != NULL)
+    atk_object_set_name (atkobj, _("Open launcher menu"));
+
   /* accept all sorts of drag data, but filter in drag-drop, so we can
    * send other sorts of drops to parent widgets */
   gtk_drag_dest_set (plugin->button, 0, NULL, 0, 0);
@@ -1675,6 +1678,8 @@ launcher_plugin_button_update (LauncherPlugin *plugin)
 {
   GarconMenuItem *item = NULL;
   const gchar    *icon_name;
+  AtkObject      *atkobj;
+  const gchar    *text;
 
   panel_return_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin));
 
@@ -1702,6 +1707,18 @@ launcher_plugin_button_update (LauncherPlugin *plugin)
       icon_name = garcon_menu_item_get_icon_name (item);
       xfce_panel_image_set_from_source (XFCE_PANEL_IMAGE (plugin->child),
           exo_str_is_empty (icon_name) ? GTK_STOCK_MISSING_IMAGE : icon_name);
+
+      atkobj = gtk_widget_get_accessible (plugin->button);
+      if (atkobj != NULL)
+        {
+          text = garcon_menu_item_get_name (item);
+          if (text != NULL)
+            atk_object_set_name (atkobj, text);
+
+          text = garcon_menu_item_get_comment (item);
+          if (text != NULL)
+            atk_object_set_description (atkobj, text);
+        }
     }
   else
     {
diff --git a/plugins/showdesktop/showdesktop.c 
b/plugins/showdesktop/showdesktop.c
index 2751f41..2d663af 100644
--- a/plugins/showdesktop/showdesktop.c
+++ b/plugins/showdesktop/showdesktop.c
@@ -177,7 +177,9 @@ static void
 show_desktop_plugin_toggled (GtkToggleButton   *button,
                              ShowDesktopPlugin *plugin)
 {
-  gboolean active;
+  gboolean     active;
+  AtkObject   *atkobj;
+  const gchar *text;
 
   panel_return_if_fail (XFCE_IS_SHOW_DESKTOP_PLUGIN (plugin));
   panel_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
@@ -188,10 +190,19 @@ show_desktop_plugin_toggled (GtkToggleButton   *button,
   if (active != wnck_screen_get_showing_desktop (plugin->wnck_screen))
     wnck_screen_toggle_showing_desktop (plugin->wnck_screen, active);
 
-  /* update the tooltip */
-  gtk_widget_set_tooltip_text (GTK_WIDGET (button),
-      active ? _("Restore the minimized windows") :
-      _("Minimize all open windows and show the desktop"));
+  if (active)
+    text = _("Restore the minimized windows");
+  else
+    text = _("Minimize all open windows and show the desktop");
+
+  gtk_widget_set_tooltip_text (GTK_WIDGET (button), text);
+
+  atkobj = gtk_widget_get_accessible (GTK_WIDGET (button));
+  if (atkobj != NULL)
+    {
+      atk_object_set_name (atkobj, _("Show Desktop"));
+      atk_object_set_description (atkobj, text);
+    }
 }
 
 
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to