Mercurial > pidgin
changeset 29729:a3b78a080a5b
merge of '1993306ee130a8c1c8eb294a1a05f86aa098cb9f'
and 'e5c9e334137918bc4e82fa4a3305623348817152'
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 14 Apr 2010 19:58:42 +0000 |
parents | 62cc2156961f (current diff) 3bb9bef6ac23 (diff) |
children | 2e0dffa155db b00abe5ec15e |
files | pidgin/eggtrayicon.c pidgin/eggtrayicon.h |
diffstat | 16 files changed, 215 insertions(+), 758 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Apr 14 19:57:09 2010 +0000 +++ b/ChangeLog Wed Apr 14 19:58:42 2010 +0000 @@ -36,7 +36,6 @@ in the distant past. (Greg McNew) * Added a menu set mood globally for all mood-supporting accounts (currently XMPP and ICQ). - * Use standard (but small) GTK+ buttons instead of custom "X" symbol. * Default binding of Ctrl+Shift+v to 'Paste as Plain Text' in conversation windows. This can be changed in .gtkrc-2.0. For example, Ctrl+v can be bound to 'Paste as Plain Text' by default.
--- a/pidgin/Makefile.am Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/Makefile.am Wed Apr 14 19:58:42 2010 +0000 @@ -75,7 +75,6 @@ bin_PROGRAMS = pidgin pidgin_SOURCES = \ - eggtrayicon.c \ pidginstock.c \ gtkaccount.c \ gtkblist.c \ @@ -126,7 +125,6 @@ pidgintooltip.c pidgin_headers = \ - eggtrayicon.h \ gtkaccount.h \ gtkblist.h \ gtkblist-theme.h \
--- a/pidgin/eggtrayicon.c Wed Apr 14 19:57:09 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,617 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* eggtrayicon.c - * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02111-1301, USA. - */ - -#include <config.h> -#include <string.h> - -#include "eggtrayicon.h" - -#include <X11/Xatom.h> - -#define _(x) x -#define N_(x) x - -#define SYSTEM_TRAY_REQUEST_DOCK 0 -#define SYSTEM_TRAY_BEGIN_MESSAGE 1 -#define SYSTEM_TRAY_CANCEL_MESSAGE 2 - -#define SYSTEM_TRAY_ORIENTATION_HORZ 0 -#define SYSTEM_TRAY_ORIENTATION_VERT 1 - -enum { - PROP_0, - PROP_ORIENTATION -}; - -static GtkPlugClass *parent_class = NULL; - -static void egg_tray_icon_init (EggTrayIcon *icon); -static void egg_tray_icon_class_init (EggTrayIconClass *klass); - -static void egg_tray_icon_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); - -static void egg_tray_icon_realize (GtkWidget *widget); -static void egg_tray_icon_unrealize (GtkWidget *widget); - -static void egg_tray_icon_add (GtkContainer *container, - GtkWidget *widget); - -static void egg_tray_icon_update_manager_window (EggTrayIcon *icon, - gboolean dock_if_realized); -static void egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon); - -GType -egg_tray_icon_get_type (void) -{ - static GType our_type = 0; - - if (our_type == 0) - { - our_type = g_type_from_name("EggTrayIcon"); - - if (our_type == 0) - { - static const GTypeInfo our_info = - { - sizeof (EggTrayIconClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) egg_tray_icon_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EggTrayIcon), - 0, /* n_preallocs */ - (GInstanceInitFunc) egg_tray_icon_init, - NULL /* value_table */ - }; - - our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0); - } - else if (parent_class == NULL) - { - /* we're reheating the old class from a previous instance - engage ugly hack =( */ - egg_tray_icon_class_init((EggTrayIconClass *)g_type_class_peek(our_type)); - } - } - - return our_type; -} - -static void -egg_tray_icon_init (EggTrayIcon *icon) -{ - icon->stamp = 1; - icon->orientation = GTK_ORIENTATION_HORIZONTAL; - - gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK); -} - -static void -egg_tray_icon_class_init (EggTrayIconClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass *)klass; - GtkWidgetClass *widget_class = (GtkWidgetClass *)klass; - GtkContainerClass *container_class = (GtkContainerClass *)klass; - - parent_class = g_type_class_peek_parent (klass); - - gobject_class->get_property = egg_tray_icon_get_property; - - widget_class->realize = egg_tray_icon_realize; - widget_class->unrealize = egg_tray_icon_unrealize; - - container_class->add = egg_tray_icon_add; - - g_object_class_install_property (gobject_class, - PROP_ORIENTATION, - g_param_spec_enum ("orientation", - _("Orientation"), - _("The orientation of the tray."), - GTK_TYPE_ORIENTATION, - GTK_ORIENTATION_HORIZONTAL, - G_PARAM_READABLE)); -} - -static void -egg_tray_icon_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggTrayIcon *icon = EGG_TRAY_ICON (object); - - switch (prop_id) - { - case PROP_ORIENTATION: - g_value_set_enum (value, icon->orientation); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static Display * -egg_tray_icon_get_x_display(EggTrayIcon *icon) -{ - Display *xdisplay = NULL; - -#if GTK_CHECK_VERSION(2,1,0) - { - GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (icon)); - if (!GDK_IS_DISPLAY (display)) - display = gdk_display_get_default (); - - xdisplay = GDK_DISPLAY_XDISPLAY (display); - } -#else - xdisplay = gdk_display; -#endif - - return xdisplay; -} - -static void -egg_tray_icon_get_orientation_property (EggTrayIcon *icon) -{ - Display *xdisplay; - Atom type; - int format; - union { - gulong *prop; - guchar *prop_ch; - } prop = { NULL }; - gulong nitems; - gulong bytes_after; - int error, result; - - g_return_if_fail(icon->manager_window != None); - - xdisplay = egg_tray_icon_get_x_display(icon); - - if (xdisplay == NULL) - return; - - gdk_error_trap_push (); - type = None; - result = XGetWindowProperty (xdisplay, - icon->manager_window, - icon->orientation_atom, - 0, G_MAXLONG, FALSE, - XA_CARDINAL, - &type, &format, &nitems, - &bytes_after, &(prop.prop_ch)); - error = gdk_error_trap_pop (); - - if (error || result != Success) - return; - - if (type == XA_CARDINAL) - { - GtkOrientation orientation; - - orientation = (prop.prop [0] == SYSTEM_TRAY_ORIENTATION_HORZ) ? - GTK_ORIENTATION_HORIZONTAL : - GTK_ORIENTATION_VERTICAL; - - if (icon->orientation != orientation) - { - icon->orientation = orientation; - - g_object_notify (G_OBJECT (icon), "orientation"); - } - } - - if (prop.prop) - XFree (prop.prop); -} - -static GdkFilterReturn -egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data) -{ - EggTrayIcon *icon = user_data; - XEvent *xev = (XEvent *)xevent; - - if (xev->xany.type == ClientMessage && - xev->xclient.message_type == icon->manager_atom && - xev->xclient.data.l[1] == icon->selection_atom) - { - egg_tray_icon_update_manager_window (icon, TRUE); - } - else if (xev->xany.window == icon->manager_window) - { - if (xev->xany.type == PropertyNotify && - xev->xproperty.atom == icon->orientation_atom) - { - egg_tray_icon_get_orientation_property (icon); - } - if (xev->xany.type == DestroyNotify) - { - egg_tray_icon_manager_window_destroyed (icon); - } - } - - return GDK_FILTER_CONTINUE; -} - -static void -egg_tray_icon_unrealize (GtkWidget *widget) -{ - EggTrayIcon *icon = EGG_TRAY_ICON (widget); - GdkWindow *root_window; - - if (icon->manager_window != None) - { - GdkWindow *gdkwin; - -#if GTK_CHECK_VERSION(2,1,0) - gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (widget), - icon->manager_window); -#else - gdkwin = gdk_window_lookup (icon->manager_window); -#endif - - gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon); - } - -#if GTK_CHECK_VERSION(2,1,0) - root_window = gdk_screen_get_root_window (gtk_widget_get_screen (widget)); -#else - root_window = gdk_window_lookup (gdk_x11_get_default_root_xwindow ()); -#endif - - gdk_window_remove_filter (root_window, egg_tray_icon_manager_filter, icon); - - if (GTK_WIDGET_CLASS (parent_class)->unrealize) - (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); -} - -static void -egg_tray_icon_send_manager_message (EggTrayIcon *icon, - long message, - Window window, - long data1, - long data2, - long data3) -{ - XClientMessageEvent ev; - Display *display; - - ev.type = ClientMessage; - ev.window = window; - ev.message_type = icon->system_tray_opcode_atom; - ev.format = 32; - ev.data.l[0] = gdk_x11_get_server_time (GTK_WIDGET (icon)->window); - ev.data.l[1] = message; - ev.data.l[2] = data1; - ev.data.l[3] = data2; - ev.data.l[4] = data3; - -#if GTK_CHECK_VERSION(2,1,0) - display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon))); -#else - display = gdk_display; -#endif - - gdk_error_trap_push (); - XSendEvent (display, - icon->manager_window, False, NoEventMask, (XEvent *)&ev); - XSync (display, False); - gdk_error_trap_pop (); -} - -static void -egg_tray_icon_send_dock_request (EggTrayIcon *icon) -{ - egg_tray_icon_send_manager_message (icon, - SYSTEM_TRAY_REQUEST_DOCK, - icon->manager_window, - gtk_plug_get_id (GTK_PLUG (icon)), - 0, 0); -} - -static void -egg_tray_icon_update_manager_window (EggTrayIcon *icon, - gboolean dock_if_realized) -{ - Display *xdisplay; - - if (icon->manager_window != None) - return; - - xdisplay = egg_tray_icon_get_x_display(icon); - - if (xdisplay == NULL) - return; - - XGrabServer (xdisplay); - - icon->manager_window = XGetSelectionOwner (xdisplay, - icon->selection_atom); - - if (icon->manager_window != None) - XSelectInput (xdisplay, - icon->manager_window, StructureNotifyMask|PropertyChangeMask); - - XUngrabServer (xdisplay); - XFlush (xdisplay); - - if (icon->manager_window != None) - { - GdkWindow *gdkwin; - -#if GTK_CHECK_VERSION(2,1,0) - gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)), - icon->manager_window); -#else - gdkwin = gdk_window_lookup (icon->manager_window); -#endif - - gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon); - - if (dock_if_realized && GTK_WIDGET_REALIZED (icon)) - egg_tray_icon_send_dock_request (icon); - - egg_tray_icon_get_orientation_property (icon); - } -} - -static void -egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon) -{ - GdkWindow *gdkwin; - - g_return_if_fail (icon->manager_window != None); - -#if GTK_CHECK_VERSION(2,1,0) - gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)), - icon->manager_window); -#else - gdkwin = gdk_window_lookup (icon->manager_window); -#endif - - gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon); - - icon->manager_window = None; - - egg_tray_icon_update_manager_window (icon, TRUE); -} - -static gboolean -transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) -{ - GtkWidget *focus_child = NULL; - gint border_width, x, y, width, height; - gboolean retval = FALSE; - - gdk_window_clear_area (widget->window, event->area.x, event->area.y, - event->area.width, event->area.height); - - if (GTK_WIDGET_CLASS (parent_class)->expose_event) - retval = GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); - - if (GTK_CONTAINER (widget)->focus_child) - focus_child = GTK_CONTAINER (GTK_CONTAINER (widget)->focus_child)->focus_child; - if (focus_child && GTK_WIDGET_HAS_FOCUS (focus_child)) - { - border_width = GTK_CONTAINER (widget)->border_width; - - x = widget->allocation.x + border_width; - y = widget->allocation.y + border_width; - - width = widget->allocation.width - 2 * border_width; - height = widget->allocation.height - 2 * border_width; - - gtk_paint_focus (widget->style, widget->window, - GTK_WIDGET_STATE (widget), - &event->area, widget, "tray_icon", - x, y, width, height); - } - - return retval; -} - -static void -make_transparent_again (GtkWidget *widget, GtkStyle *previous_style, - gpointer user_data) -{ - gdk_window_set_back_pixmap(widget->window, NULL, TRUE); -} - -static void -make_transparent (GtkWidget *widget, gpointer user_data) -{ - if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget)) - return; - - gtk_widget_set_app_paintable (widget, TRUE); - gtk_widget_set_double_buffered (widget, FALSE); - gdk_window_set_back_pixmap (widget->window, NULL, TRUE); - g_signal_connect (widget, "expose_event", - G_CALLBACK (transparent_expose_event), NULL); - g_signal_connect_after (widget, "style_set", - G_CALLBACK (make_transparent_again), NULL); -} - -static void -egg_tray_icon_realize (GtkWidget *widget) -{ - EggTrayIcon *icon = EGG_TRAY_ICON (widget); - gint screen; - Display *xdisplay; - char buffer[256]; - GdkWindow *root_window; - - if (GTK_WIDGET_CLASS (parent_class)->realize) - GTK_WIDGET_CLASS (parent_class)->realize (widget); - - make_transparent (widget, NULL); - - xdisplay = egg_tray_icon_get_x_display(icon); - - if (xdisplay == NULL) - return; - -#if GTK_CHECK_VERSION(2,1,0) - screen = gdk_screen_get_number (gtk_widget_get_screen (widget)); -#else - screen = XScreenNumberOfScreen (DefaultScreenOfDisplay (gdk_display)); -#endif - - /* Now see if there's a manager window around */ - g_snprintf (buffer, sizeof (buffer), - "_NET_SYSTEM_TRAY_S%d", - screen); - - icon->selection_atom = XInternAtom (xdisplay, buffer, False); - - icon->manager_atom = XInternAtom (xdisplay, "MANAGER", False); - - icon->system_tray_opcode_atom = XInternAtom (xdisplay, - "_NET_SYSTEM_TRAY_OPCODE", - False); - - icon->orientation_atom = XInternAtom (xdisplay, - "_NET_SYSTEM_TRAY_ORIENTATION", - False); - - egg_tray_icon_update_manager_window (icon, FALSE); - egg_tray_icon_send_dock_request (icon); - -#if GTK_CHECK_VERSION(2,1,0) - root_window = gdk_screen_get_root_window (gtk_widget_get_screen (widget)); -#else - root_window = gdk_window_lookup (gdk_x11_get_default_root_xwindow ()); -#endif - - /* Add a root window filter so that we get changes on MANAGER */ - gdk_window_add_filter (root_window, - egg_tray_icon_manager_filter, icon); -} - -static void -egg_tray_icon_add (GtkContainer *container, GtkWidget *widget) -{ - g_signal_connect (widget, "realize", - G_CALLBACK (make_transparent), NULL); - GTK_CONTAINER_CLASS (parent_class)->add (container, widget); -} - -#if GTK_CHECK_VERSION(2,1,0) -EggTrayIcon * -egg_tray_icon_new_for_screen (GdkScreen *screen, const char *name) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return g_object_new (EGG_TYPE_TRAY_ICON, "screen", screen, "title", name, NULL); -} -#endif - -EggTrayIcon* -egg_tray_icon_new (const gchar *name) -{ - return g_object_new (EGG_TYPE_TRAY_ICON, "title", name, NULL); -} - -guint -egg_tray_icon_send_message (EggTrayIcon *icon, - gint timeout, - const gchar *message, - gint len) -{ - guint stamp; - - g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), 0); - g_return_val_if_fail (timeout >= 0, 0); - g_return_val_if_fail (message != NULL, 0); - - if (icon->manager_window == None) - return 0; - - if (len < 0) - len = strlen (message); - - stamp = icon->stamp++; - - /* Get ready to send the message */ - egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_BEGIN_MESSAGE, - (Window)gtk_plug_get_id (GTK_PLUG (icon)), - timeout, len, stamp); - - /* Now to send the actual message */ - gdk_error_trap_push (); - while (len > 0) - { - XClientMessageEvent ev; - Display *xdisplay; - - xdisplay = egg_tray_icon_get_x_display(icon); - - if (xdisplay == NULL) - return 0; - - ev.type = ClientMessage; - ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon)); - ev.format = 8; - ev.message_type = XInternAtom (xdisplay, - "_NET_SYSTEM_TRAY_MESSAGE_DATA", False); - if (len > 20) - { - memcpy (&ev.data, message, 20); - len -= 20; - message += 20; - } - else - { - memcpy (&ev.data, message, len); - len = 0; - } - - XSendEvent (xdisplay, - icon->manager_window, False, StructureNotifyMask, (XEvent *)&ev); - XSync (xdisplay, False); - } - gdk_error_trap_pop (); - - return stamp; -} - -void -egg_tray_icon_cancel_message (EggTrayIcon *icon, - guint id) -{ - g_return_if_fail (EGG_IS_TRAY_ICON (icon)); - g_return_if_fail (id > 0); - - egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE, - (Window)gtk_plug_get_id (GTK_PLUG (icon)), - id, 0, 0); -} - -GtkOrientation -egg_tray_icon_get_orientation (EggTrayIcon *icon) -{ - g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), GTK_ORIENTATION_HORIZONTAL); - - return icon->orientation; -}
--- a/pidgin/eggtrayicon.h Wed Apr 14 19:57:09 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* eggtrayicon.h - * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02111-1301, USA. - */ - -#ifndef __EGG_TRAY_ICON_H__ -#define __EGG_TRAY_ICON_H__ - -#include <gtk/gtk.h> -#include <gdk/gdkx.h> - -G_BEGIN_DECLS - -#define EGG_TYPE_TRAY_ICON (egg_tray_icon_get_type ()) -#define EGG_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TRAY_ICON, EggTrayIcon)) -#define EGG_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TRAY_ICON, EggTrayIconClass)) -#define EGG_IS_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TRAY_ICON)) -#define EGG_IS_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TRAY_ICON)) -#define EGG_TRAY_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TRAY_ICON, EggTrayIconClass)) - -typedef struct _EggTrayIcon EggTrayIcon; -typedef struct _EggTrayIconClass EggTrayIconClass; - -struct _EggTrayIcon -{ - GtkPlug parent_instance; - - guint stamp; - - Atom selection_atom; - Atom manager_atom; - Atom system_tray_opcode_atom; - Atom orientation_atom; - Window manager_window; - - GtkOrientation orientation; -}; - -struct _EggTrayIconClass -{ - GtkPlugClass parent_class; -}; - -GType egg_tray_icon_get_type (void); - -#if GTK_CHECK_VERSION(2,1,0) -EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen *screen, - const gchar *name); -#endif - -EggTrayIcon *egg_tray_icon_new (const gchar *name); - -guint egg_tray_icon_send_message (EggTrayIcon *icon, - gint timeout, - const char *message, - gint len); -void egg_tray_icon_cancel_message (EggTrayIcon *icon, - guint id); - -GtkOrientation egg_tray_icon_get_orientation (EggTrayIcon *icon); - -G_END_DECLS - -#endif /* __EGG_TRAY_ICON_H__ */
--- a/pidgin/gtkconv.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/gtkconv.c Wed Apr 14 19:58:42 2010 +0000 @@ -4866,12 +4866,11 @@ pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) { GtkWidget *widget = gtk_hbox_new(FALSE, 0); - GtkWidget *label, *entry, *close, *image; + GtkWidget *label, *entry, *close; gtk_box_pack_start(GTK_BOX(container), widget, FALSE, FALSE, 0); - image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); - close = pidgin_create_small_button(image); + close = pidgin_create_small_button(gtk_label_new("×")); gtk_box_pack_start(GTK_BOX(widget), close, FALSE, FALSE, 0); gtk_tooltips_set_tip(gtkconv->tooltips, close, _("Close Find bar"), NULL); @@ -9450,7 +9449,6 @@ GtkWidget *tab_cont = gtkconv->tab_cont; PurpleConversationType conv_type; const gchar *tmp_lab; - GtkWidget *close_image; conv_type = purple_conversation_get_type(conv); @@ -9462,8 +9460,7 @@ /* Close button. */ - close_image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); - gtkconv->close = pidgin_create_small_button(close_image); + gtkconv->close = pidgin_create_small_button(gtk_label_new("×")); gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, _("Close conversation"), NULL);
--- a/pidgin/gtkutils.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/gtkutils.c Wed Apr 14 19:58:42 2010 +0000 @@ -3484,6 +3484,9 @@ "GtkWidget::focus-line-width = 0\n" "xthickness = 0\n" "ythickness = 0\n" + "GtkContainer::border-width = 0\n" + "GtkButton::inner-border = {0, 0, 0, 0}\n" + "GtkButton::default-border = {0, 0, 0, 0}\n" "}\n" "widget \"*.pidgin-small-close-button\" style \"pidgin-small-close-button\"");
--- a/pidgin/plugins/convcolors.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/plugins/convcolors.c Wed Apr 14 19:58:42 2010 +0000 @@ -198,7 +198,12 @@ { if (response == GTK_RESPONSE_OK) { +#if GTK_CHECK_VERSION(2,14,0) + GtkWidget *colorsel = + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog)); +#else GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel; +#endif GdkColor color; char colorstr[8]; char tmp[128]; @@ -232,8 +237,15 @@ g_snprintf(tmp, sizeof(tmp), "%s/color", data); if (gdk_color_parse(purple_prefs_get_string(tmp), &color)) { +#if GTK_CHECK_VERSION(2,14,0) + gtk_color_selection_set_current_color(GTK_COLOR_SELECTION( + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog))), + &color); +#else gtk_color_selection_set_current_color( - GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color); + GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), + &color); +#endif } gtk_window_present(GTK_WINDOW(color_dialog));
--- a/pidgin/plugins/disco/gtkdisco.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/plugins/disco/gtkdisco.c Wed Apr 14 19:58:42 2010 +0000 @@ -430,7 +430,13 @@ disco_paint_tooltip(GtkWidget *tipwindow, gpointer data) { PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); +#if GTK_CHECK_VERSION(2,14,0) + gtk_paint_layout(gtk_widget_get_style(tipwindow), + gtk_widget_get_window(tipwindow), + GTK_STATE_NORMAL, FALSE, +#else gtk_paint_layout(tipwindow->style, tipwindow->window, GTK_STATE_NORMAL, FALSE, +#endif NULL, tipwindow, "tooltip", 6, 6, layout); return TRUE;
--- a/pidgin/plugins/gestures/stroke-draw.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/plugins/gestures/stroke-draw.c Wed Apr 14 19:58:42 2010 +0000 @@ -19,6 +19,9 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> +#if !GTK_CHECK_VERSION(2,14,0) +#define gtk_widget_get_window(x) x->window +#endif static void gstroke_invisible_window_init (GtkWidget *widget); /*FIXME: Maybe these should be put in a structure, and not static...*/ @@ -75,7 +78,8 @@ /* FIXME: this does not work. It will only work if we create a corresponding GDK window for stroke_window and draw on that... */ - gdk_draw_line (widget->window, widget->style->fg_gc[GTK_STATE_NORMAL], + gdk_draw_line (gtk_widget_get_window(widget), + widget->style->fg_gc[GTK_STATE_NORMAL], last_mouse_position.last_point.x, last_mouse_position.last_point.y, x, @@ -156,7 +160,7 @@ if (cursor == NULL) cursor = gdk_cursor_new(GDK_PENCIL); - gdk_pointer_grab (widget->window, FALSE, + gdk_pointer_grab (gtk_widget_get_window(widget), FALSE, GDK_BUTTON_RELEASE_MASK, NULL, cursor, event->button.time); timer_id = g_timeout_add (GSTROKE_TIMEOUT_DURATION, @@ -334,8 +338,8 @@ unsigned long mask, col_border, col_background; unsigned int border_width; XSizeHints hints; - Display *disp = GDK_WINDOW_XDISPLAY(widget->window); - Window wind = GDK_WINDOW_XWINDOW (widget->window); + Display *disp = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget)); + Window wind = GDK_WINDOW_XWINDOW (gtk_widget_get_window(widget)); int screen = DefaultScreen (disp); if (!gstroke_draw_strokes())
--- a/pidgin/plugins/notify.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/plugins/notify.c Wed Apr 14 19:58:42 2010 +0000 @@ -547,7 +547,11 @@ } count = count_messages(purplewin); +#if GTK_CHECK_VERSION(2,14,0) + gdkwin = gtk_widget_get_window(window); +#else gdkwin = window->window; +#endif gdk_property_change(gdkwin, _PurpleUnseenCount, _Cardinal, 32, GDK_PROP_MODE_REPLACE, (guchar *) &count, 1);
--- a/pidgin/plugins/pidginrc.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/plugins/pidginrc.c Wed Apr 14 19:58:42 2010 +0000 @@ -242,7 +242,12 @@ if (response == GTK_RESPONSE_OK) { GdkColor color; gchar colorstr[8]; +#if GTK_CHECK_VERSION(2,14,0) + GtkWidget *colorsel = + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog)); +#else GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel; +#endif gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color); @@ -273,7 +278,13 @@ if (pref != NULL && strcmp(pref, "")) { if (gdk_color_parse(pref, &color)) { +#if GTK_CHECK_VERSION(2,14,0) + gtk_color_selection_set_current_color(GTK_COLOR_SELECTION( + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog))), + &color); +#else gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color); +#endif } } @@ -327,7 +338,7 @@ pref = purple_prefs_get_string(prefpath); if (pref != NULL && strcmp(pref, "")) { - gtk_font_selection_set_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(font_dialog)->fontsel), pref); + gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(font_dialog), pref); } gtk_window_present(GTK_WINDOW(font_dialog));
--- a/pidgin/plugins/themeedit.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/plugins/themeedit.c Wed Apr 14 19:58:42 2010 +0000 @@ -61,10 +61,17 @@ theme_color_selected(GtkDialog *dialog, gint response, const char *prop) { if (response == GTK_RESPONSE_OK) { + GtkWidget *colorsel; GdkColor color; PidginBlistTheme *theme; - gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel), &color); +#if GTK_CHECK_VERSION(2,14,0) + colorsel = + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dialog)); +#else + colorsel = GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel; +#endif + gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color); theme = pidgin_blist_get_theme(); @@ -119,7 +126,7 @@ face = pidgin_theme_font_get_font_face(font); dialog = gtk_font_selection_dialog_new(_("Select Font")); if (face && *face) - gtk_font_selection_set_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(dialog)->fontsel), + gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(dialog), face); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(theme_font_face_selected), font); @@ -145,9 +152,16 @@ } dialog = gtk_color_selection_dialog_new(_("Select Color")); +#if GTK_CHECK_VERSION(2,14,0) + if (color) + gtk_color_selection_set_current_color(GTK_COLOR_SELECTION( + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dialog))), + color); +#else if (color) gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel), color); +#endif g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(theme_color_selected), prop);
--- a/pidgin/plugins/ticker/gtkticker.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/plugins/ticker/gtkticker.c Wed Apr 14 19:58:42 2010 +0000 @@ -21,9 +21,37 @@ * GtkTicker Copyright 2000 Syd Logan */ +/* FIXME: GTK+ deprecated GTK_WIDGET_MAPPED/REALIZED, but don't provide + accessor functions yet. */ +#undef GSEAL_ENABLE + #include "gtkticker.h" #include <gtk/gtk.h> +/* These don't seem to be in a release yet. See BZ #69872 */ +#define gtk_widget_is_mapped(x) GTK_WIDGET_MAPPED(x) +#define gtk_widget_is_realized(x) GTK_WIDGET_REALIZED(x) +#define gtk_widget_set_realized(x,y) do {\ + if (y) \ + GTK_WIDGET_SET_FLAGS(x, GTK_REALIZED); \ + else \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_REALIZED); \ +} while(0) +#define gtk_widget_set_mapped(x,y) do {\ + if (y) \ + GTK_WIDGET_SET_FLAGS(x, GTK_MAPPED); \ + else \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_MAPPED); \ +} while(0) + +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) + +#if !GTK_CHECK_VERSION(2,14,0) +#define gtk_widget_get_window(x) x->window +#endif +#endif + static void gtk_ticker_compute_offsets (GtkTicker *ticker); static void gtk_ticker_class_init (GtkTickerClass *klass); static void gtk_ticker_init (GtkTicker *ticker); @@ -119,7 +147,11 @@ static void gtk_ticker_init (GtkTicker *ticker) { +#if GTK_CHECK_VERSION(2,18,0) + gtk_widget_set_has_window (GTK_WIDGET (ticker), TRUE); +#else GTK_WIDGET_UNSET_FLAGS (ticker, GTK_NO_WINDOW); +#endif ticker->interval = (guint) 200; ticker->scootch = (guint) 2; @@ -149,12 +181,13 @@ ticker->children = g_list_append (ticker->children, child_info); - if (GTK_WIDGET_REALIZED (ticker)) + if (gtk_widget_is_realized (ticker)) gtk_widget_realize (widget); - if (GTK_WIDGET_VISIBLE (ticker) && GTK_WIDGET_VISIBLE (widget)) + if (gtk_widget_get_visible (GTK_WIDGET (ticker)) && + gtk_widget_get_visible (widget)) { - if (GTK_WIDGET_MAPPED (ticker)) + if (gtk_widget_is_mapped (GTK_WIDGET (ticker))) gtk_widget_map (widget); gtk_widget_queue_resize (GTK_WIDGET (ticker)); @@ -213,7 +246,7 @@ { GtkTicker *ticker = (GtkTicker *) data; - if (GTK_WIDGET_VISIBLE (ticker)) + if (gtk_widget_get_visible (GTK_WIDGET (ticker))) gtk_widget_queue_resize (GTK_WIDGET (ticker)); return( TRUE ); @@ -255,7 +288,7 @@ g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TICKER (widget)); - GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); + gtk_widget_set_mapped (widget, TRUE); ticker = GTK_TICKER (widget); children = ticker->children; @@ -264,29 +297,42 @@ child = children->data; children = children->next; - if (GTK_WIDGET_VISIBLE (child->widget) && - !GTK_WIDGET_MAPPED (child->widget)) + if (gtk_widget_get_visible (child->widget) && + !gtk_widget_is_mapped (child->widget)) gtk_widget_map (child->widget); } - gdk_window_show (widget->window); + gdk_window_show (gtk_widget_get_window (widget)); } static void gtk_ticker_realize (GtkWidget *widget) { GdkWindowAttr attributes; gint attributes_mask; + GdkWindow *window; + GtkStyle *style; +#if GTK_CHECK_VERSION(2,18,0) + GtkAllocation allocation; +#endif g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TICKER (widget)); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); + gtk_widget_set_realized (widget, TRUE); attributes.window_type = GDK_WINDOW_CHILD; +#if GTK_CHECK_VERSION(2,18,0) + gtk_widget_get_allocation (widget, &allocation); + attributes.x = allocation.x; + attributes.y = allocation.y; + attributes.width = allocation.width; + attributes.height = allocation.height; +#else attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; +#endif attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); @@ -295,12 +341,23 @@ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), + window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); - gdk_window_set_user_data (widget->window, widget); +#if GTK_CHECK_VERSION(2,14,0) + gtk_widget_set_window (widget, window); +#else + widget->window = window; +#endif + gdk_window_set_user_data (window, widget); - widget->style = gtk_style_attach (widget->style, widget->window); - gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); +#if GTK_CHECK_VERSION(2,14,0) + style = gtk_widget_get_style (widget); + style = gtk_style_attach (style, window); + gtk_widget_set_style (widget, style); +#else + style = widget->style = gtk_style_attach (widget->style, window); +#endif + gtk_style_set_background (style, window, GTK_STATE_NORMAL); } static void gtk_ticker_size_request (GtkWidget *widget, GtkRequisition *requisition) @@ -309,6 +366,7 @@ GtkTickerChild *child; GList *children; GtkRequisition child_requisition; + guint border_width; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TICKER (widget)); @@ -324,7 +382,7 @@ child = children->data; children = children->next; - if (GTK_WIDGET_VISIBLE (child->widget)) + if (gtk_widget_get_visible (child->widget)) { gtk_widget_size_request (child->widget, &child_requisition); @@ -336,8 +394,9 @@ if ( requisition->width > ticker->spacing ) requisition->width -= ticker->spacing; - requisition->height += GTK_CONTAINER (ticker)->border_width * 2; - requisition->width += GTK_CONTAINER (ticker)->border_width * 2; + border_width = gtk_container_get_border_width (GTK_CONTAINER (ticker)); + requisition->height += border_width * 2; + requisition->width += border_width * 2; } static void gtk_ticker_compute_offsets (GtkTicker *ticker) @@ -350,16 +409,24 @@ g_return_if_fail (ticker != NULL); g_return_if_fail (GTK_IS_TICKER(ticker)); - border_width = GTK_CONTAINER (ticker)->border_width; + border_width = gtk_container_get_border_width (GTK_CONTAINER (ticker)); +#if GTK_CHECK_VERSION(2,18,0) + { + GtkAllocation allocation; + gtk_widget_get_allocation (GTK_WIDGET (ticker), &allocation); + ticker->width = allocation.width; + } +#else ticker->width = GTK_WIDGET(ticker)->allocation.width; +#endif ticker->total = 0; children = ticker->children; while (children) { child = children->data; child->x = 0; - if (GTK_WIDGET_VISIBLE (child->widget)) { + if (gtk_widget_get_visible (child->widget)) { gtk_widget_get_child_requisition (child->widget, &child_requisition); child->offset = ticker->total; ticker->total += @@ -386,22 +453,35 @@ ticker = GTK_TICKER (widget); +#if GTK_CHECK_VERSION(2,18,0) + { + GtkAllocation a; + gtk_widget_get_allocation (GTK_WIDGET (ticker), &a); + if ( a.width != ticker->width ) + ticker->dirty = TRUE; + } +#else if ( GTK_WIDGET(ticker)->allocation.width != ticker->width ) ticker->dirty = TRUE; +#endif if ( ticker->dirty == TRUE ) { gtk_ticker_compute_offsets( ticker ); } +#if GTK_CHECK_VERSION(2,18,0) + gtk_widget_set_allocation (widget, allocation); +#else widget->allocation = *allocation; - if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize (widget->window, +#endif + if (gtk_widget_is_realized (widget)) + gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y, allocation->width, allocation->height); - border_width = GTK_CONTAINER (ticker)->border_width; + border_width = gtk_container_get_border_width (GTK_CONTAINER (ticker)); children = ticker->children; while (children) @@ -409,16 +489,16 @@ child = children->data; child->x -= ticker->scootch; - if (GTK_WIDGET_VISIBLE (child->widget)) { + if (gtk_widget_get_visible (child->widget)) { gtk_widget_get_child_requisition (child->widget, &child_requisition); child_allocation.width = child_requisition.width; child_allocation.x = child->offset + border_width + child->x; - if ( ( child_allocation.x + child_allocation.width ) < GTK_WIDGET(ticker)->allocation.x ) { - if ( ticker->total >= GTK_WIDGET(ticker)->allocation.width ) { - child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width + ( ticker->total - ( GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width ) ); + if ( ( child_allocation.x + child_allocation.width ) < allocation->x ) { + if ( ticker->total >= allocation->width ) { + child->x += allocation->x + allocation->width + ( ticker->total - ( allocation->x + allocation->width ) ); } else { - child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width; + child->x += allocation->x + allocation->width; } } child_allocation.y = border_width; @@ -469,7 +549,7 @@ if (child->widget == widget) { - gboolean was_visible = GTK_WIDGET_VISIBLE (widget); + gboolean was_visible = gtk_widget_get_visible (widget); gtk_widget_unparent (widget); @@ -477,7 +557,7 @@ g_list_free (children); g_free (child); - if (was_visible && GTK_WIDGET_VISIBLE (container)) + if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container))) gtk_widget_queue_resize (GTK_WIDGET (container)); break;
--- a/pidgin/plugins/timestamp_format.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/plugins/timestamp_format.c Wed Apr 14 19:58:42 2010 +0000 @@ -122,7 +122,11 @@ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); g_signal_connect_after(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), dialog); +#if GTK_CHECK_VERSION(2,14,0) + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), frame); +#else gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), frame); +#endif gtk_window_set_role(GTK_WINDOW(dialog), "plugin_config"); gtk_window_set_title(GTK_WINDOW(dialog), _(purple_plugin_get_name(plugin))); gtk_widget_show_all(dialog); @@ -141,8 +145,13 @@ if (!GTK_IS_IMHTML(view)) return TRUE; +#if GTK_CHECK_VERSION(2,14,0) + if (!gdk_window_get_pointer(gtk_widget_get_window(GTK_WIDGET(view)), &cx, &cy, NULL)) + return TRUE; +#else if (!gdk_window_get_pointer(GTK_WIDGET(view)->window, &cx, &cy, NULL)) return TRUE; +#endif buffer = gtk_text_view_get_buffer(view);
--- a/pidgin/plugins/xmppconsole.c Wed Apr 14 19:57:09 2010 +0000 +++ b/pidgin/plugins/xmppconsole.c Wed Apr 14 19:58:42 2010 +0000 @@ -258,7 +258,7 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) { - GtkWidget *hbox, *to_entry, *label, *type_combo; + GtkWidget *vbox, *hbox, *to_entry, *label, *type_combo; GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); GtkTextIter iter; GtkTextBuffer *buffer; @@ -277,9 +277,14 @@ gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); +#if GTK_CHECK_VERSION(2,14,0) + vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); +#else + vbox = GTK_DIALOG(dialog)->vbox; +#endif hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("To:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -291,7 +296,7 @@ gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Type:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -305,7 +310,7 @@ gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); - gtk_widget_show_all(GTK_DIALOG(dialog)->vbox); + gtk_widget_show_all(vbox); result = gtk_dialog_run(GTK_DIALOG(dialog)); if (result != GTK_RESPONSE_ACCEPT) { @@ -334,6 +339,7 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) { + GtkWidget *vbox; GtkWidget *hbox; GtkWidget *to_entry; GtkWidget *status_entry; @@ -359,9 +365,14 @@ gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); +#if GTK_CHECK_VERSION(2,14,0) + vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); +#else + vbox = GTK_DIALOG(dialog)->vbox; +#endif hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("To:"); gtk_size_group_add_widget(sg, label); @@ -373,7 +384,7 @@ gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Type:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); @@ -391,7 +402,7 @@ gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Show:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); @@ -407,7 +418,7 @@ gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Status:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -419,7 +430,7 @@ gtk_box_pack_start(GTK_BOX(hbox), status_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Priority:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -430,7 +441,7 @@ gtk_spin_button_set_value(GTK_SPIN_BUTTON(priority_entry), 0); gtk_box_pack_start(GTK_BOX(hbox), priority_entry, FALSE, FALSE, 0); - gtk_widget_show_all(GTK_DIALOG(dialog)->vbox); + gtk_widget_show_all(vbox); result = gtk_dialog_run(GTK_DIALOG(dialog)); if (result != GTK_RESPONSE_ACCEPT) { @@ -486,6 +497,7 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) { + GtkWidget *vbox; GtkWidget *hbox; GtkWidget *to_entry; GtkWidget *body_entry; @@ -511,9 +523,14 @@ gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); +#if GTK_CHECK_VERSION(2,14,0) + vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); +#else + vbox = GTK_DIALOG(dialog)->vbox; +#endif hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("To:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -525,7 +542,7 @@ gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Type:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); @@ -540,7 +557,7 @@ gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Body:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -552,7 +569,7 @@ gtk_box_pack_start(GTK_BOX(hbox), body_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Subject:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -564,7 +581,7 @@ gtk_box_pack_start(GTK_BOX(hbox), subject_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Thread:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -575,7 +592,7 @@ gtk_entry_set_activates_default (GTK_ENTRY (thread_entry), TRUE); gtk_box_pack_start(GTK_BOX(hbox), thread_entry, FALSE, FALSE, 0); - gtk_widget_show_all(GTK_DIALOG(dialog)->vbox); + gtk_widget_show_all(vbox); result = gtk_dialog_run(GTK_DIALOG(dialog)); if (result != GTK_RESPONSE_ACCEPT) {