summaryrefslogtreecommitdiff
path: root/libnautilus-private
diff options
context:
space:
mode:
authorPadraig O'Briain <padraig.obriain@sun.com>2003-12-03 09:51:56 +0000
committerPadraig O'Briain <padraigo@src.gnome.org>2003-12-03 09:51:56 +0000
commit2a1f721c66db4719552f85bac7c675be69a34d81 (patch)
treeee446262f4dbd427e63c66e7d86470a244c7e778 /libnautilus-private
parentf7c2500ea4bfc0c367a8f58f88c59a1763387f2d (diff)
downloadnautilus-2a1f721c66db4719552f85bac7c675be69a34d81.tar.gz
Return TRUE when function succeeds.
2003-12-03 Padraig O'Briain <padraig.obriain@sun.com> * libnautilus-private/nautilus-icon-canvas-item.c: (nautilus_icon_canvas_item_accessible_action_set_description): Return TRUE when function succeeds. (nautilus_icon_canvas_item_accessible_get_name): If name has been set using atk_object_set_name return that. (nautilus_icon_canvas_item_accessible_finalize): Free image description or description if exists. (nautilus_icon_canvas_item_accessible_get_image_description): Return icon description, if it exists. (nautilus_icon_canvas_item_accessible_set_image-description): Implement this function. * libnautilus-private/nautrilus-icon-container.[ch]: (nautilus_icon_container_get_icon_description): New function. * src/file-manager/fm-icon-container.c: (fm_icon_container_get_icon_description): New function to implement NautilusIconContainerClass's get_icon_description. This fixes part of bug #126183.
Diffstat (limited to 'libnautilus-private')
-rw-r--r--libnautilus-private/nautilus-icon-canvas-item.c60
-rw-r--r--libnautilus-private/nautilus-icon-container.c22
-rw-r--r--libnautilus-private/nautilus-icon-container.h4
3 files changed, 72 insertions, 14 deletions
diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c
index 97403972c..5eb0b2a71 100644
--- a/libnautilus-private/nautilus-icon-canvas-item.c
+++ b/libnautilus-private/nautilus-icon-canvas-item.c
@@ -26,6 +26,8 @@
#include <math.h>
#include "nautilus-icon-canvas-item.h"
+#include <libgnome/gnome-i18n.h>
+
#include "nautilus-file-utilities.h"
#include "nautilus-global-preferences.h"
#include "nautilus-icon-factory.h"
@@ -142,6 +144,8 @@ enum {
typedef struct {
char *action_descriptions[LAST_ACTION];
+ char *image_description;
+ char *description;
} NautilusIconCanvasItemAccessiblePrivate;
typedef struct {
@@ -2148,7 +2152,7 @@ nautilus_icon_canvas_item_accessible_action_set_description (AtkAction *accessib
}
priv->action_descriptions[i] = g_strdup (description);
- return FALSE;
+ return TRUE;
}
static void
@@ -2167,11 +2171,14 @@ nautilus_icon_canvas_item_accessible_get_name (AtkObject *accessible)
{
NautilusIconCanvasItem *item;
+ if (accessible->name) {
+ return accessible->name;
+ }
+
item = eel_accessibility_get_gobject (accessible);
if (!item) {
return NULL;
}
-
return item->details->editable_text;
}
@@ -2301,16 +2308,16 @@ nautilus_icon_canvas_item_accessible_initialize (AtkObject *accessible,
static void
nautilus_icon_canvas_item_accessible_finalize (GObject *object)
{
- NautilusIconCanvasItemAccessiblePrivate *priv;
- int i;
+ NautilusIconCanvasItemAccessiblePrivate *priv;
+ int i;
- priv = accessible_get_priv (ATK_OBJECT (object));
+ priv = accessible_get_priv (ATK_OBJECT (object));
- for (i = 0; i < LAST_ACTION; i++) {
- if (priv->action_descriptions[i]) {
- g_free (priv->action_descriptions[i]);
- }
- }
+ for (i = 0; i < LAST_ACTION; i++) {
+ g_free (priv->action_descriptions[i]);
+ }
+ g_free (priv->image_description);
+ g_free (priv->description);
g_free (priv);
@@ -2340,9 +2347,28 @@ static G_CONST_RETURN gchar *
nautilus_icon_canvas_item_accessible_get_image_description
(AtkImage *image)
{
- return _("file icon");
-}
+ NautilusIconCanvasItemAccessiblePrivate *priv;
+ NautilusIconCanvasItem *item;
+ NautilusIcon *icon;
+ NautilusIconContainer *container;
+ char *description;
+ priv = accessible_get_priv (ATK_OBJECT (image));
+ if (priv->image_description) {
+ return priv->image_description;
+ } else {
+ item = eel_accessibility_get_gobject (ATK_OBJECT (image));
+ if (item == NULL) {
+ return NULL;
+ }
+ icon = item->user_data;
+ container = NAUTILUS_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas);
+ description = nautilus_icon_container_get_icon_description (container, icon->data);
+ g_free (priv->description);
+ priv->description = description;
+ return priv->description;
+ }
+}
static void
nautilus_icon_canvas_item_accessible_get_image_size
@@ -2416,8 +2442,14 @@ nautilus_icon_canvas_item_accessible_set_image_description
(AtkImage *image,
const gchar *description)
{
- g_warning (G_STRLOC "this api seems broken");
- return FALSE;
+ NautilusIconCanvasItemAccessiblePrivate *priv;
+
+ priv = accessible_get_priv (ATK_OBJECT (image));
+
+ g_free (priv->image_description);
+ priv->image_description = g_strdup (description);
+
+ return TRUE;
}
static void
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 066effe22..55b3cd620 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -6416,6 +6416,28 @@ nautilus_icon_container_set_font_size_table (NautilusIconContainer *container,
}
}
+/**
+ * nautilus_icon_container_get_icon_description
+ * @container: An icon container widget.
+ * @data: Icon data
+ *
+ * Gets the description for the icon. This function may return NULL.
+ **/
+char*
+nautilus_icon_container_get_icon_description (NautilusIconContainer *container,
+ NautilusIconData *data)
+{
+ NautilusIconContainerClass *klass;
+
+ klass = NAUTILUS_ICON_CONTAINER_GET_CLASS (container);
+
+ if (klass->get_icon_description) {
+ return klass->get_icon_description (container, data);
+ } else {
+ return NULL;
+ }
+}
+
/* NautilusIconContainerAccessible */
static NautilusIconContainerAccessiblePrivate *
diff --git a/libnautilus-private/nautilus-icon-container.h b/libnautilus-private/nautilus-icon-container.h
index 727f1c665..80255c9c9 100644
--- a/libnautilus-private/nautilus-icon-container.h
+++ b/libnautilus-private/nautilus-icon-container.h
@@ -121,6 +121,8 @@ typedef struct {
NautilusIconData *data,
char **editable_text,
char **additional_text);
+ char * (* get_icon_description) (NautilusIconContainer *container,
+ NautilusIconData *data);
int (* compare_icons) (NautilusIconContainer *container,
NautilusIconData *icon_a,
NautilusIconData *icon_b);
@@ -266,5 +268,7 @@ void nautilus_icon_container_set_margins (Nautilu
int bottom_margin);
void nautilus_icon_container_set_use_drop_shadows (NautilusIconContainer *container,
gboolean use_drop_shadows);
+char* nautilus_icon_container_get_icon_description (NautilusIconContainer *container,
+ NautilusIconData *data);
#endif /* NAUTILUS_ICON_CONTAINER_H */