[Xfce4-commits] <libxfce4ui:nick/gtk3-optional> Compile GTK+-3 version of libxfce4ui when possible.
Nick Schermer
noreply at xfce.org
Wed Sep 19 21:32:02 CEST 2012
Updating branch refs/heads/nick/gtk3-optional
to 9f4995402215621414c737ea1a2f961e7429a8bd (commit)
from 44fedcd555b9b83f2667e10fb294c309a552da00 (commit)
commit 9f4995402215621414c737ea1a2f961e7429a8bd
Author: Nick Schermer <nick at xfce.org>
Date: Wed Sep 19 18:57:55 2012 +0200
Compile GTK+-3 version of libxfce4ui when possible.
Preovide a GTK3 version of the library next to the GTK2
version if GTK3 is found on the system. The same code
is compiled twice.
configure.ac.in | 11 +-
libxfce4kbd-private/Makefile.am | 4 +-
libxfce4ui/Makefile.am | 64 ++++++--
.../{libxfce4ui-1.pc.in => libxfce4ui-2.pc.in} | 6 +-
libxfce4ui/xfce-gdk-extensions.c | 15 ++-
libxfce4ui/xfce-heading.c | 189 ++++++++++++++++----
libxfce4ui/xfce-sm-client.c | 7 +-
libxfce4ui/xfce-spawn.c | 13 +-
libxfce4ui/xfce-titled-dialog.c | 27 ++-
xfce4-about/Makefile.am | 4 +-
10 files changed, 271 insertions(+), 69 deletions(-)
diff --git a/configure.ac.in b/configure.ac.in
index 414bcdb..9889a15 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -126,9 +126,17 @@ dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.24.0])
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.20.0])
+XDT_CHECK_PACKAGE([GTK2], [gtk+-2.0], [2.20.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.9.0])
+dnl ***********************************************************
+dnl *** Optional support for a GTK+3 version of the library ***
+dnl ***********************************************************
+XDT_CHECK_OPTIONAL_PACKAGE([GTK3],
+ [gtk+-3.0], [3.2.0], [gtk3],
+ [GTK+ 3 support])
+AM_CONDITIONAL([ENABLE_GTK3_LIBRARY], [test "x$GTK3_FOUND" = "xyes"])
+
dnl *************************************************
dnl *** Optional support for startup notification ***
dnl *************************************************
@@ -301,6 +309,7 @@ icons/48x48/Makefile
libxfce4kbd-private/libxfce4kbd-private-2.pc
libxfce4kbd-private/Makefile
libxfce4ui/libxfce4ui-1.pc
+libxfce4ui/libxfce4ui-2.pc
libxfce4ui/libxfce4ui-config.h
libxfce4ui/Makefile
xfce4-about/Makefile
diff --git a/libxfce4kbd-private/Makefile.am b/libxfce4kbd-private/Makefile.am
index abff01e..284cf21 100644
--- a/libxfce4kbd-private/Makefile.am
+++ b/libxfce4kbd-private/Makefile.am
@@ -40,7 +40,7 @@ libxfce4kbd_private_2_la_SOURCES = \
libxfce4kbd_private_2_la_CFLAGS = \
$(PLATFORM_CFLAGS) \
$(GLIB_CFLAGS) \
- $(GTK_CFLAGS) \
+ $(GTK2_CFLAGS) \
$(LIBX11_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(XFCONF_CFLAGS)
@@ -56,7 +56,7 @@ libxfce4kbd_private_2_la_LDFLAGS = \
libxfce4kbd_private_2_la_LIBADD = \
$(top_builddir)/libxfce4ui/libxfce4ui-$(LIBXFCE4UI_VERSION_API).la \
$(GLIB_LIBS) \
- $(GTK_LIBS) \
+ $(GTK2_LIBS) \
$(LIBX11_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(XFCONF_LIBS)
diff --git a/libxfce4ui/Makefile.am b/libxfce4ui/Makefile.am
index 0c3b8f9..d70f161 100644
--- a/libxfce4ui/Makefile.am
+++ b/libxfce4ui/Makefile.am
@@ -11,8 +11,6 @@ INCLUDES = \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
$(PLATFORM_CPPFLAGS)
-lib_LTLIBRARIES = libxfce4ui-1.la
-
libxfce4ui_enum_headers = \
xfce-sm-client.h
@@ -35,13 +33,7 @@ libxfce4ui_built_sources = \
libxfce4ui-marshal.c \
libxfce4ui-marshal.h
-libxfce4ui_includedir = \
- $(includedir)/xfce4/libxfce4ui-$(LIBXFCE4UI_VERSION_API)/libxfce4ui
-
-libxfce4ui_include_HEADERS = \
- $(libxfce4ui_headers)
-
-libxfce4ui_1_la_SOURCES = \
+libxfce4ui_sources = \
$(libxfce4ui_headers) \
$(libxfce4ui_built_sources) \
libxfce4ui-config.c \
@@ -55,9 +47,20 @@ libxfce4ui_1_la_SOURCES = \
xfce-spawn.c \
xfce-titled-dialog.c
+libxfce4ui_includedir = \
+ $(includedir)/xfce4/libxfce4ui-$(LIBXFCE4UI_VERSION_API)/libxfce4ui
+
+libxfce4ui_include_HEADERS = \
+ $(libxfce4ui_headers)
+
+lib_LTLIBRARIES = libxfce4ui-1.la
+
+libxfce4ui_1_la_SOURCES = \
+ $(libxfce4ui_sources)
+
libxfce4ui_1_la_CFLAGS = \
$(LIBSM_CFLAGS) \
- $(GTK_CFLAGS) \
+ $(GTK2_CFLAGS) \
$(LIBSTARTUP_NOTIFICATION_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(PLATFORM_CFLAGS)
@@ -71,13 +74,52 @@ libxfce4ui_1_la_LDFLAGS = \
libxfce4ui_1_la_LIBADD = \
$(LIBSM_LIBS) \
- $(GTK_LIBS) \
+ $(GTK2_LIBS) \
$(LIBSTARTUP_NOTIFICATION_LIBS) \
$(LIBXFCE4UTIL_LIBS)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libxfce4ui-1.pc
+##
+## GTK+ 3 support library
+##
+if ENABLE_GTK3_LIBRARY
+
+libxfce4ui2_includedir = \
+ $(includedir)/xfce4/libxfce4ui-2/libxfce4ui
+
+libxfce4ui2_include_HEADERS = \
+ $(libxfce4ui_headers)
+
+lib_LTLIBRARIES += libxfce4ui-2.la
+
+libxfce4ui_2_la_SOURCES = \
+ $(libxfce4ui_sources)
+
+libxfce4ui_2_la_CFLAGS = \
+ $(LIBSM_CFLAGS) \
+ $(GTK3_CFLAGS) \
+ $(LIBSTARTUP_NOTIFICATION_CFLAGS) \
+ $(LIBXFCE4UTIL_CFLAGS) \
+ $(PLATFORM_CFLAGS)
+
+libxfce4ui_2_la_LDFLAGS = \
+ -version-info $(LIBXFCE4UI_VERINFO) \
+ -export-symbols-regex "^[^_].*" \
+ -no-undefined \
+ $(LIBSM_LDFLAGS) \
+ $(PLATFORM_LDFLAGS)
+
+libxfce4ui_2_la_LIBADD = \
+ $(LIBSM_LIBS) \
+ $(GTK3_LIBS) \
+ $(LIBSTARTUP_NOTIFICATION_LIBS) \
+ $(LIBXFCE4UTIL_LIBS)
+
+pkgconfig_DATA += libxfce4ui-2.pc
+
+endif
##
## Rules to auto-generate built sources
diff --git a/libxfce4ui/libxfce4ui-1.pc.in b/libxfce4ui/libxfce4ui-2.pc.in
similarity index 64%
copy from libxfce4ui/libxfce4ui-1.pc.in
copy to libxfce4ui/libxfce4ui-2.pc.in
index cb6a507..0be7b80 100644
--- a/libxfce4ui/libxfce4ui-1.pc.in
+++ b/libxfce4ui/libxfce4ui-2.pc.in
@@ -9,7 +9,7 @@ glade_moduledir=@GLADEUI_PIXMAPDIR@
Name: libxfce4ui
Description: Widgets library for Xfce
-Requires: gtk+-2.0 libxfce4util-1.0
+Requires: gtk+-3.0 libxfce4util-1.0
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lxfce4ui- at LIBXFCE4UI_VERSION_API@
-Cflags: -I${includedir}/xfce4/libxfce4ui- at LIBXFCE4UI_VERSION_API@
+Libs: -L${libdir} -lxfce4ui-2
+Cflags: -I${includedir}/xfce4/libxfce4ui-2
diff --git a/libxfce4ui/xfce-gdk-extensions.c b/libxfce4ui/xfce-gdk-extensions.c
index 402da5b..90599a0 100644
--- a/libxfce4ui/xfce-gdk-extensions.c
+++ b/libxfce4ui/xfce-gdk-extensions.c
@@ -49,12 +49,21 @@
GdkScreen *
xfce_gdk_screen_get_active (gint *monitor_return)
{
- GdkDisplay *display;
- gint rootx, rooty;
- GdkScreen *screen;
+ GdkDisplay *display;
+ gint rootx, rooty;
+ GdkScreen *screen;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkDeviceManager *manager;
+
+ display = gdk_display_get_default ();
+ manager = gdk_display_get_device_manager (display);
+ gdk_device_get_position (gdk_device_manager_get_client_pointer (manager),
+ &screen, &rootx, &rooty);
+#else
display = gdk_display_get_default ();
gdk_display_get_pointer (display, &screen, &rootx, &rooty, NULL);
+#endif
if (G_UNLIKELY (screen == NULL))
{
diff --git a/libxfce4ui/xfce-heading.c b/libxfce4ui/xfce-heading.c
index 064becc..83e1de7 100644
--- a/libxfce4ui/xfce-heading.c
+++ b/libxfce4ui/xfce-heading.c
@@ -39,17 +39,29 @@
#define XFCE_HEADING_ICON_SIZE 48
-static void _xfce_heading_finalize (GObject *object);
-static void _xfce_heading_realize (GtkWidget *widget);
-static void _xfce_heading_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void _xfce_heading_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-static gboolean _xfce_heading_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-static AtkObject *_xfce_heading_get_accessible (GtkWidget *widget);
-static PangoLayout *_xfce_heading_make_layout (XfceHeading *heading);
-static GdkPixbuf *_xfce_heading_make_pixbuf (XfceHeading *heading);
+static void _xfce_heading_finalize (GObject *object);
+static void _xfce_heading_realize (GtkWidget *widget);
+static void _xfce_heading_size_request (GtkWidget *widget,
+ GtkRequisition *requisition);
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void _xfce_heading_get_preferred_width (GtkWidget *widget,
+ gint *min,
+ gint *natural);
+static void _xfce_heading_get_preferred_height (GtkWidget *widget,
+ gint *min,
+ gint *natural);
+static gboolean _xfce_heading_draw (GtkWidget *widget,
+ cairo_t *ctx);
+#else
+static void _xfce_heading_style_set (GtkWidget *widget,
+ GtkStyle *previous_style);
+static gboolean _xfce_heading_expose_event (GtkWidget *widget,
+ GdkEventExpose *event);
+#endif
+static AtkObject *_xfce_heading_get_accessible (GtkWidget *widget);
+static PangoLayout *_xfce_heading_make_layout (XfceHeading *heading);
+static GdkPixbuf *_xfce_heading_make_pixbuf (XfceHeading *heading);
+
@@ -62,12 +74,12 @@ struct _XfceHeadingClass
struct _XfceHeading
{
/*< private >*/
- GtkWidget __parent__;
+ GtkWidget __parent__;
- GdkPixbuf *icon;
- gchar *icon_name;
- gchar *subtitle;
- gchar *title;
+ GdkPixbuf *icon;
+ gchar *icon_name;
+ gchar *subtitle;
+ gchar *title;
};
@@ -87,10 +99,16 @@ _xfce_heading_class_init (XfceHeadingClass *klass)
gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->realize = _xfce_heading_realize;
+ gtkwidget_class->get_accessible = _xfce_heading_get_accessible;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtkwidget_class->get_preferred_width = _xfce_heading_get_preferred_width;
+ gtkwidget_class->get_preferred_height = _xfce_heading_get_preferred_height;
+ gtkwidget_class->draw = _xfce_heading_draw;
+#else
gtkwidget_class->size_request = _xfce_heading_size_request;
gtkwidget_class->style_set = _xfce_heading_style_set;
gtkwidget_class->expose_event = _xfce_heading_expose_event;
- gtkwidget_class->get_accessible = _xfce_heading_get_accessible;
+#endif
}
@@ -99,7 +117,7 @@ static void
_xfce_heading_init (XfceHeading *heading)
{
/* setup the widget parameters */
- GTK_WIDGET_UNSET_FLAGS (heading, GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (heading), TRUE);
}
@@ -125,34 +143,138 @@ _xfce_heading_finalize (GObject *object)
static void
_xfce_heading_realize (GtkWidget *widget)
{
- GdkWindowAttr attributes;
+ GdkWindowAttr attributes;
+ GtkAllocation allocation;
+ GdkWindow *window;
/* mark the widget as realized */
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_set_realized (widget, TRUE);
+ gtk_widget_get_allocation (widget, &allocation);
/* setup the window attributes */
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget)
| GDK_EXPOSURE_MASK;
/* allocate the widget window */
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
- GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP);
- gdk_window_set_user_data (widget->window, widget);
+ window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
+ GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL);
+ gtk_widget_set_window (widget, window);
+ gdk_window_set_user_data (window, widget);
+}
+
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void
+_xfce_heading_get_preferred_width (GtkWidget *widget,
+ gint *min,
+ gint *natural)
+{
+ GtkRequisition requisition;
+
+ _xfce_heading_size_request (widget, &requisition);
+
+ *min = *natural = requisition.width;
+}
+
+
+
+static void
+_xfce_heading_get_preferred_height (GtkWidget *widget,
+ gint *min,
+ gint *natural)
+{
+
+ GtkRequisition requisition;
+
+ _xfce_heading_size_request (widget, &requisition);
+
+ *min = *natural = requisition.height;
+}
+
+
+
+static gboolean
+_xfce_heading_draw (GtkWidget *widget,
+ cairo_t *ctx)
+{
+ XfceHeading *heading = XFCE_HEADING (widget);
+ PangoLayout *layout;
+ GdkPixbuf *pixbuf;
+ gboolean rtl;
+ gint width;
+ gint height;
+ gint x;
+ gint y;
+ GtkAllocation allocation;
+ GtkStyleContext *context;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ context = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_HIGHLIGHT);
+
+ /* check if we should render from right to left */
+ rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
+
+ /* determine the initial horizontal position */
+ x = (rtl ? allocation.width - XFCE_HEADING_BORDER : XFCE_HEADING_BORDER);
+
+ gtk_render_background (context, ctx,
+ allocation.x, allocation.y,
+ allocation.x + allocation.width,
+ allocation.y + allocation.height);
+
+ /* check if we have a pixbuf to render */
+ pixbuf = _xfce_heading_make_pixbuf (heading);
+ if (G_LIKELY (pixbuf != NULL))
+ {
+ /* determine the pixbuf dimensions */
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+
+ /* determine the vertical position */
+ y = (allocation.height - height) / 2;
+
+ gtk_render_icon (context, ctx,
+ pixbuf,
+ rtl ? x - width : x,
+ y);
+
+ /* release the pixbuf */
+ g_object_unref (G_OBJECT (pixbuf));
+
+ /* advance the horizontal position */
+ x += (rtl ? -1 : 1) * (width + XFCE_HEADING_SPACING);
+ }
+
+ /* generate the title layout */
+ layout = _xfce_heading_make_layout (heading);
+ pango_layout_get_pixel_size (layout, &width, &height);
+
+ /* determine the vertical position */
+ y = (allocation.height - height) / 2;
- /* connect the style to the window */
- widget->style = gtk_style_attach (widget->style, widget->window);
+ gtk_render_layout (context, ctx,
+ rtl ? x - width : x, y,
+ layout);
- /* set background color (using the base color) */
- gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
+ /* release the layout */
+ g_object_unref (G_OBJECT (layout));
+
+ gtk_style_context_restore (context);
+
+ return FALSE;
}
+#endif
@@ -193,6 +315,7 @@ _xfce_heading_size_request (GtkWidget *widget,
+#if !GTK_CHECK_VERSION (3, 0, 0)
static void
_xfce_heading_style_set (GtkWidget *widget,
GtkStyle *previous_style)
@@ -266,6 +389,7 @@ _xfce_heading_expose_event (GtkWidget *widget,
return FALSE;
}
+#endif
@@ -312,6 +436,7 @@ _xfce_heading_make_layout (XfceHeading *heading)
/* allocate and setup a new layout from the widget's context */
layout = gtk_widget_create_pango_layout (GTK_WIDGET (heading), text->str);
+
/* allocate an attribute list (large bold title) */
attr_list = pango_attr_list_new ();
attribute = pango_attr_scale_new (PANGO_SCALE_LARGE); /* large title */
diff --git a/libxfce4ui/xfce-sm-client.c b/libxfce4ui/xfce-sm-client.c
index c757246..509406b 100644
--- a/libxfce4ui/xfce-sm-client.c
+++ b/libxfce4ui/xfce-sm-client.c
@@ -56,7 +56,8 @@
#include <X11/SM/SMlib.h>
#endif
-#include <gdk/gdkwindow.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <libxfce4util/libxfce4util.h>
@@ -643,7 +644,7 @@ xfce_sm_client_set_client_id(XfceSMClient *sm_client,
g_free(sm_client->client_id);
sm_client->client_id = g_strdup(client_id);
- gdk_set_sm_client_id(sm_client->client_id);
+ gdk_x11_set_sm_client_id(sm_client->client_id);
g_object_notify(G_OBJECT(sm_client), "client-id");
}
@@ -1719,7 +1720,7 @@ xfce_sm_client_disconnect(XfceSMClient *sm_client)
SmcCloseConnection(sm_client->session_connection, 0, NULL);
sm_client->session_connection = NULL;
- gdk_set_sm_client_id(NULL);
+ gdk_x11_set_sm_client_id(NULL);
xfce_sm_client_set_state(sm_client, XFCE_SM_CLIENT_STATE_DISCONNECTED);
#endif
diff --git a/libxfce4ui/xfce-spawn.c b/libxfce4ui/xfce-spawn.c
index 2479d88..e023c55 100644
--- a/libxfce4ui/xfce-spawn.c
+++ b/libxfce4ui/xfce-spawn.c
@@ -210,12 +210,14 @@ xfce_spawn_get_active_workspace_number (GdkScreen *screen)
_NET_CURRENT_DESKTOP = XInternAtom (GDK_WINDOW_XDISPLAY (root), "_NET_CURRENT_DESKTOP", False);
_WIN_WORKSPACE = XInternAtom (GDK_WINDOW_XDISPLAY (root), "_WIN_WORKSPACE", False);
- if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root), GDK_WINDOW_XWINDOW (root),
+ if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root),
+ gdk_x11_get_default_root_xwindow(),
_NET_CURRENT_DESKTOP, 0, 32, False, XA_CARDINAL,
&type_ret, &format_ret, &nitems_ret, &bytes_after_ret,
(gpointer) &prop_ret) != Success)
{
- if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root), GDK_WINDOW_XWINDOW (root),
+ if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root),
+ gdk_x11_get_default_root_xwindow(),
_WIN_WORKSPACE, 0, 32, False, XA_CARDINAL,
&type_ret, &format_ret, &nitems_ret, &bytes_after_ret,
(gpointer) &prop_ret) != Success)
@@ -235,7 +237,12 @@ xfce_spawn_get_active_workspace_number (GdkScreen *screen)
XFree (prop_ret);
}
- gdk_error_trap_pop ();
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_error_trap_pop_ignored ();
+#else
+ if (gdk_error_trap_pop () != 0)
+ return 0;
+#endif
return ws_num;
}
diff --git a/libxfce4ui/xfce-titled-dialog.c b/libxfce4ui/xfce-titled-dialog.c
index 5c8939d..30a3bb9 100644
--- a/libxfce4ui/xfce-titled-dialog.c
+++ b/libxfce4ui/xfce-titled-dialog.c
@@ -106,8 +106,8 @@ xfce_titled_dialog_class_init (XfceTitledDialogClass *klass)
/* connect additional key bindings to the GtkDialog::close action signal */
binding_set = gtk_binding_set_by_class (klass);
- gtk_binding_entry_add_signal (binding_set, GDK_w, GDK_CONTROL_MASK, "close", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_W, GDK_CONTROL_MASK, "close", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_w, GDK_CONTROL_MASK, "close", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_W, GDK_CONTROL_MASK, "close", 0);
}
@@ -117,16 +117,22 @@ xfce_titled_dialog_init (XfceTitledDialog *titled_dialog)
{
GtkWidget *line;
GtkWidget *vbox;
+ GtkWidget *content_area;
/* connect the private data */
titled_dialog->priv = XFCE_TITLED_DIALOG_GET_PRIVATE (titled_dialog);
/* remove the main dialog box from the window */
- g_object_ref (G_OBJECT (GTK_DIALOG (titled_dialog)->vbox));
- gtk_container_remove (GTK_CONTAINER (titled_dialog), GTK_DIALOG (titled_dialog)->vbox);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (titled_dialog));
+ g_object_ref (G_OBJECT (content_area));
+ gtk_container_remove (GTK_CONTAINER (titled_dialog), content_area);
/* add a new vbox w/o border to the main window */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+#else
vbox = gtk_vbox_new (FALSE, 0);
+#endif
gtk_container_add (GTK_CONTAINER (titled_dialog), vbox);
gtk_widget_show (vbox);
@@ -136,13 +142,17 @@ xfce_titled_dialog_init (XfceTitledDialog *titled_dialog)
gtk_widget_show (titled_dialog->priv->heading);
/* add the separator between header and content */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ line = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+#else
line = gtk_hseparator_new ();
+#endif
gtk_box_pack_start (GTK_BOX (vbox), line, FALSE, FALSE, 0);
gtk_widget_show (line);
/* add the main dialog box to the new vbox */
- gtk_box_pack_start (GTK_BOX (vbox), GTK_DIALOG (titled_dialog)->vbox, TRUE, TRUE, 0);
- g_object_unref (G_OBJECT (GTK_DIALOG (titled_dialog)->vbox));
+ gtk_box_pack_start (GTK_BOX (vbox), content_area, TRUE, TRUE, 0);
+ g_object_unref (G_OBJECT(content_area));
/* make sure to update the heading whenever one of the relevant window properties changes */
g_signal_connect (G_OBJECT (titled_dialog), "notify::icon", G_CALLBACK (xfce_titled_dialog_update_heading), NULL);
@@ -216,11 +226,11 @@ xfce_titled_dialog_close (GtkDialog *dialog)
GdkEvent *event;
/* verify that the dialog is realized */
- if (G_LIKELY (GTK_WIDGET_REALIZED (dialog)))
+ if (G_LIKELY (gtk_widget_get_realized (GTK_WIDGET (dialog))))
{
/* send a delete event to the dialog */
event = gdk_event_new (GDK_DELETE);
- event->any.window = g_object_ref (GTK_WIDGET (dialog)->window);
+ event->any.window = g_object_ref (gtk_widget_get_window(GTK_WIDGET (dialog)));
event->any.send_event = TRUE;
gtk_main_do_event (event);
gdk_event_free (event);
@@ -283,7 +293,6 @@ xfce_titled_dialog_new_with_buttons (const gchar *title,
/* allocate the dialog */
dialog = g_object_new (XFCE_TYPE_TITLED_DIALOG,
"destroy-with-parent", ((flags & GTK_DIALOG_DESTROY_WITH_PARENT) != 0),
- "has-separator", ((flags & GTK_DIALOG_NO_SEPARATOR) == 0),
"modal", ((flags & GTK_DIALOG_MODAL) != 0),
"title", title,
NULL);
diff --git a/xfce4-about/Makefile.am b/xfce4-about/Makefile.am
index 0187239..7234dd9 100644
--- a/xfce4-about/Makefile.am
+++ b/xfce4-about/Makefile.am
@@ -20,13 +20,13 @@ xfce4_about_SOURCES = \
xfce4_about_CFLAGS = \
$(LIBXFCE4UTIL_CFLAGS) \
- $(GTK_CFLAGS) \
+ $(GTK2_CFLAGS) \
$(PLATFORM_CFLAGS)
xfce4_about_LDADD = \
$(top_builddir)/libxfce4ui/libxfce4ui-$(LIBXFCE4UI_VERSION_API).la \
$(LIBXFCE4UTIL_LIBS) \
- $(GTK_LIBS)
+ $(GTK2_LIBS)
xfce4_about_DEPENDENCIES = \
$(top_builddir)/libxfce4ui/libxfce4ui-$(LIBXFCE4UI_VERSION_API).la
More information about the Xfce4-commits
mailing list