summaryrefslogtreecommitdiff
path: root/trashapplet/src/trashapplet.c
diff options
context:
space:
mode:
Diffstat (limited to 'trashapplet/src/trashapplet.c')
-rw-r--r--trashapplet/src/trashapplet.c62
1 files changed, 38 insertions, 24 deletions
diff --git a/trashapplet/src/trashapplet.c b/trashapplet/src/trashapplet.c
index 2ba46c7c..e4f2966b 100644
--- a/trashapplet/src/trashapplet.c
+++ b/trashapplet/src/trashapplet.c
@@ -28,13 +28,13 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gio/gio.h>
#include <mate-panel-applet.h>
#include "trash-empty.h"
-#include "xstuff.h"
#define TRASH_TYPE_APPLET (trash_applet_get_type ())
@@ -85,6 +85,7 @@ trash_applet_monitor_changed (TrashApplet *applet)
GError *error = NULL;
GFileInfo *info;
GIcon *icon;
+ AtkObject *atk_obj;
gint items;
info = g_file_query_info (applet->trash,
@@ -92,6 +93,8 @@ trash_applet_monitor_changed (TrashApplet *applet)
G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT,
0, NULL, &error);
+ atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet));
+
if (!info)
{
g_critical ("could not query trash:/: '%s'", error->message);
@@ -120,19 +123,20 @@ trash_applet_monitor_changed (TrashApplet *applet)
if (items != applet->items)
{
+ char *text;
+
if (items)
{
- char *text;
-
text = g_strdup_printf (ngettext ("%d Item in Trash",
"%d Items in Trash",
items), items);
- gtk_widget_set_tooltip_text (GTK_WIDGET (applet), text);
- g_free (text);
}
else
- gtk_widget_set_tooltip_text (GTK_WIDGET (applet),
- _("No Items in Trash"));
+ text = g_strdup (_("No Items in Trash"));
+
+ gtk_widget_set_tooltip_text (GTK_WIDGET (applet), text);
+ atk_object_set_description (atk_obj, text);
+ g_free (text);
applet->items = items;
}
@@ -251,21 +255,18 @@ trash_applet_button_release (GtkWidget *widget,
if (settings == NULL)
settings = g_settings_new (PANEL_SCHEMA);
- if (event->button == 1)
- {
- if (g_settings_get_boolean (settings, PANEL_ENABLE_ANIMATIONS))
- xstuff_zoom_animate (widget, NULL);
+ if (event->button == 2)
+ return FALSE;
+ if ((event->button == 1) &&
+ (event->type != GDK_2BUTTON_PRESS) &&
+ (event->type != GDK_3BUTTON_PRESS))
+ {
trash_applet_open_folder (NULL, applet);
-
return TRUE;
}
- if (GTK_WIDGET_CLASS (trash_applet_parent_class)->button_release_event)
- return GTK_WIDGET_CLASS (trash_applet_parent_class)
- ->button_release_event (widget, event);
- else
- return FALSE;
+ return GTK_WIDGET_CLASS (trash_applet_parent_class)->button_press_event (widget, event);
}
static gboolean
trash_applet_key_press (GtkWidget *widget,
@@ -398,7 +399,6 @@ trash_applet_show_help (GtkAction *action,
}
}
-
static void
trash_applet_show_about (GtkAction *action,
TrashApplet *applet)
@@ -600,7 +600,12 @@ trash_applet_class_init (TrashAppletClass *class)
gobject_class->dispose = trash_applet_dispose;
widget_class->size_allocate = trash_applet_size_allocate;
- widget_class->button_release_event = trash_applet_button_release;
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
+ widget_class->button_release_event = trash_applet_button_release;
+ else /* for Wayland we need to watch button press rather than release */
+#endif
+ widget_class->button_press_event = trash_applet_button_release;
widget_class->key_press_event = trash_applet_key_press;
widget_class->drag_motion = trash_applet_drag_motion;
widget_class->drag_data_received = trash_applet_drag_data_received;
@@ -615,9 +620,12 @@ trash_applet_factory (MatePanelApplet *applet,
if (!strcmp (iid, "TrashApplet"))
{
+ AtkObject *atk_obj;
GtkActionGroup *action_group;
+#ifndef ENABLE_IN_PROCESS
g_set_application_name (_("Trash Applet"));
+#endif
gtk_window_set_default_icon_name ("user-trash");
@@ -633,6 +641,12 @@ trash_applet_factory (MatePanelApplet *applet,
action_group);
g_object_unref (action_group);
+ atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet));
+
+ if (GTK_IS_ACCESSIBLE (atk_obj)) {
+ atk_object_set_name (atk_obj, _("Trash Applet"));
+ }
+
gtk_widget_show (GTK_WIDGET (applet));
retval = TRUE;
@@ -641,8 +655,8 @@ trash_applet_factory (MatePanelApplet *applet,
return retval;
}
-MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("TrashAppletFactory",
- TRASH_TYPE_APPLET,
- "TrashApplet",
- trash_applet_factory,
- NULL)
+PANEL_APPLET_FACTORY ("TrashAppletFactory",
+ TRASH_TYPE_APPLET,
+ "TrashApplet",
+ trash_applet_factory,
+ NULL)