diff options
author | Stefano Karapetsas <[email protected]> | 2014-01-20 09:31:35 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-01-20 09:31:35 +0100 |
commit | 7779705809b61a180aeb2371afcf8d0cba9ba0e3 (patch) | |
tree | 9d0d1c191f55ca46d54f6cc0a021556f2b1aad06 /trashapplet | |
parent | 3da42cef82ee714a2271849275dfeea3b03ed508 (diff) | |
download | mate-applets-7779705809b61a180aeb2371afcf8d0cba9ba0e3.tar.bz2 mate-applets-7779705809b61a180aeb2371afcf8d0cba9ba0e3.tar.xz |
trashapplet: Add GTK3 support
Diffstat (limited to 'trashapplet')
-rw-r--r-- | trashapplet/src/trash-empty.c | 12 | ||||
-rw-r--r-- | trashapplet/src/trashapplet.c | 32 | ||||
-rw-r--r-- | trashapplet/src/xstuff.c | 19 | ||||
-rw-r--r-- | trashapplet/src/xstuff.h | 2 |
4 files changed, 63 insertions, 2 deletions
diff --git a/trashapplet/src/trash-empty.c b/trashapplet/src/trash-empty.c index 16b39191..18a1260a 100644 --- a/trashapplet/src/trash-empty.c +++ b/trashapplet/src/trash-empty.c @@ -125,7 +125,11 @@ trash_empty_update_dialog (gpointer user_data) static gboolean trash_empty_done (gpointer user_data) { +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_destroy (GTK_WIDGET (trash_empty_dialog)); +#else gtk_object_destroy (GTK_OBJECT (trash_empty_dialog)); +#endif g_assert (trash_empty_dialog == NULL); @@ -260,7 +264,11 @@ trash_empty_start (GtkWidget *parent) g_critical ("failed to parse trash-empty dialog markup"); if (trash_empty_dialog) +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_destroy (GTK_WIDGET (trash_empty_dialog)); +#else gtk_object_destroy (GTK_OBJECT (trash_empty_dialog)); +#endif g_object_unref (builder); return; @@ -302,7 +310,11 @@ trash_empty_confirmation_response (GtkDialog *dialog, if (response_id == GTK_RESPONSE_YES) trash_empty_start (GTK_WIDGET (dialog)); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_destroy (GTK_WIDGET (dialog)); +#else gtk_object_destroy (GTK_OBJECT (dialog)); +#endif g_assert (trash_empty_confirm_dialog == NULL); } diff --git a/trashapplet/src/trashapplet.c b/trashapplet/src/trashapplet.c index 464bb176..5cca0fc4 100644 --- a/trashapplet/src/trashapplet.c +++ b/trashapplet/src/trashapplet.c @@ -30,6 +30,9 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> +#if GTK_CHECK_VERSION (3, 0, 0) +#include <gdk/gdkkeysyms-compat.h> +#endif #include <gio/gio.h> #include <mate-panel-applet.h> @@ -184,7 +187,11 @@ trash_applet_size_allocate (GtkWidget *widget, } static void +#if GTK_CHECK_VERSION (3, 0, 0) +trash_applet_dispose (GObject *object) +#else trash_applet_destroy (GtkObject *object) +#endif { TrashApplet *applet = TRASH_APPLET (object); @@ -204,8 +211,11 @@ trash_applet_destroy (GtkObject *object) g_object_unref (applet->icon); applet->icon = NULL; - GTK_OBJECT_CLASS (trash_applet_parent_class) - ->destroy (object); +#if GTK_CHECK_VERSION (3, 0, 0) + G_OBJECT_CLASS (trash_applet_parent_class)->dispose (object); +#else + GTK_OBJECT_CLASS (trash_applet_parent_class)->destroy (object); +#endif } static void @@ -309,7 +319,11 @@ trash_applet_drag_motion (GtkWidget *widget, GList *target; /* refuse drops of panel applets */ +#if GTK_CHECK_VERSION (3, 0, 0) + for (target = gdk_drag_context_list_targets (context); target; target = target->next) +#else for (target = context->targets; target; target = target->next) +#endif { const char *name = gdk_atom_name (target->data); @@ -450,7 +464,9 @@ confirm_delete_immediately (GtkWidget *parent_view, gtk_window_set_screen (GTK_WINDOW (dialog), screen); atk_object_set_role (gtk_widget_get_accessible (dialog), ATK_ROLE_ALERT); gtk_window_set_title (GTK_WINDOW (dialog), _("Delete Immediately?")); +#if !GTK_CHECK_VERSION (3, 0, 0) gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); +#endif gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); @@ -516,7 +532,11 @@ confirm_delete_immediately (GtkWidget *parent_view, response = gtk_dialog_run (GTK_DIALOG (dialog)); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_destroy (GTK_WIDGET (dialog)); +#else gtk_object_destroy (GTK_OBJECT (dialog)); +#endif return response == GTK_RESPONSE_YES; } @@ -591,10 +611,18 @@ trash_applet_drag_data_received (GtkWidget *widget, static void trash_applet_class_init (TrashAppletClass *class) { +#if GTK_CHECK_VERSION (3, 0, 0) + GObjectClass *gobject_class = G_OBJECT_CLASS (class); +#else GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (class); +#endif GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); +#if GTK_CHECK_VERSION (3, 0, 0) + gobject_class->dispose = trash_applet_dispose; +#else gtkobject_class->destroy = trash_applet_destroy; +#endif widget_class->size_allocate = trash_applet_size_allocate; widget_class->button_release_event = trash_applet_button_release; widget_class->key_press_event = trash_applet_key_press; diff --git a/trashapplet/src/xstuff.c b/trashapplet/src/xstuff.c index 0458f182..75ae8eb3 100644 --- a/trashapplet/src/xstuff.c +++ b/trashapplet/src/xstuff.c @@ -24,6 +24,11 @@ #include "xstuff.h" +#if GTK_CHECK_VERSION (3, 0, 0) +#define GDK_WINDOW_XWINDOW(x) GDK_WINDOW_XID(x) +#define gdk_x11_drawable_get_xid(x) GDK_WINDOW_XID(x) +#endif + static Atom panel_atom_get (const char *atom_name) { @@ -177,11 +182,13 @@ xstuff_is_compliant_wm (void) return TRUE; } +#if !GTK_CHECK_VERSION (3, 0, 0) gboolean xstuff_net_wm_supports (const char *hint) { return gdk_net_wm_supports (gdk_atom_intern (hint, FALSE)); } +#endif void xstuff_set_no_group (GdkWindow *win) @@ -337,11 +344,17 @@ draw_zoom_animation (GdkScreen *gscreen, dpy = gdk_x11_display_get_xdisplay (gdk_screen_get_display (gscreen)); root_win = gdk_x11_drawable_get_xid (gdk_screen_get_root_window (gscreen)); screen = gdk_screen_get_number (gscreen); +#if GTK_CHECK_VERSION (3, 0, 0) + depth = DefaultDepth(dpy,screen); +#else depth = gdk_drawable_get_depth (gdk_screen_get_root_window (gscreen)); +#endif /* frame GC */ +#if !GTK_CHECK_VERSION (3, 0, 0) gdk_colormap_alloc_color ( gdk_screen_get_system_colormap (gscreen), &color, FALSE, TRUE); +#endif gcv.function = GXxor; /* this will raise the probability of the XORed color being different * of the original color in PseudoColor when not all color cells are @@ -432,8 +445,10 @@ draw_zoom_animation (GdkScreen *gscreen, XUngrabServer(dpy); XFreeGC (dpy, frame_gc); +#if !GTK_CHECK_VERSION (3, 0, 0) gdk_colormap_free_colors (gdk_screen_get_system_colormap (gscreen), &color, 1); +#endif } #undef FRAMES @@ -484,7 +499,11 @@ xstuff_get_current_workspace (GdkScreen *screen) gdk_screen_get_root_window (screen)); gdk_error_trap_push (); +#if GTK_CHECK_VERSION (3, 0, 0) + result = XGetWindowProperty (GDK_SCREEN_XDISPLAY (screen), +#else result = XGetWindowProperty (gdk_display, +#endif root_window, panel_atom_get ("_NET_CURRENT_DESKTOP"), 0, G_MAXLONG, diff --git a/trashapplet/src/xstuff.h b/trashapplet/src/xstuff.h index f927c220..6bc1e835 100644 --- a/trashapplet/src/xstuff.h +++ b/trashapplet/src/xstuff.h @@ -7,7 +7,9 @@ void xstuff_delete_property (GdkWindow *window, const char *name); gboolean xstuff_is_compliant_wm (void); +#if !GTK_CHECK_VERSION (3, 0, 0) gboolean xstuff_net_wm_supports (const char *hint); +#endif void xstuff_set_no_group (GdkWindow *win); |