[rhythmbox] Port to GTK+ 3
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] Port to GTK+ 3
- Date: Tue, 1 Feb 2011 13:21:40 +0000 (UTC)
commit fc79a43a79cb20065aa5e93afcd44e1e878d8a59
Author: Jonathan Matthew <jonathan d14n org>
Date: Tue Feb 1 21:50:23 2011 +1000
Port to GTK+ 3
backends/gstreamer/rb-encoder-gst.c | 2 +-
configure.ac | 59 ++++--
doc/reference/Makefile.am | 1 -
lib/Makefile.am | 1 -
lib/eggsmclient-private.h | 2 +-
lib/eggsmclient-xsmp.c | 3 +-
lib/gseal-gtk-compat.h | 48 ----
lib/rb-missing-plugins.c | 3 +-
lib/rb-tree-dnd.c | 4 +-
lib/rb-util.c | 20 +-
plugins/audiocd/rb-audiocd-source.c | 27 ++-
.../rb-audioscrobbler-profile-page.c | 9 +-
.../rb-disc-recorder-plugin.c | 4 +-
plugins/daap/rb-dacp-pairing-page.c | 2 +-
plugins/fmradio/rb-fm-radio-source.c | 2 +-
plugins/power-manager/rb-power-manager-plugin.c | 2 +-
plugins/status-icon/rb-status-icon-plugin.c | 3 +-
plugins/visualizer/rb-vis-widget.c | 19 +--
plugins/visualizer/rb-visualizer-plugin.c | 35 ++--
podcast/rb-podcast-properties-dialog.c | 13 +-
shell/main.c | 2 +-
shell/rb-plugin-manager.c | 2 -
shell/rb-shell.c | 14 +-
shell/rb-source-header.c | 30 ++--
shell/rb-statusbar.c | 2 -
sources/rb-display-page-model.c | 2 -
sources/rb-display-page-tree.c | 37 ++--
sources/rb-library-source.c | 5 +-
tests/bench-rhythmdb-load.c | 3 +-
tests/test-file-helpers.c | 3 +-
tests/test-rhythmdb-property-model.c | 3 +-
tests/test-rhythmdb-query-model.c | 3 +-
widgets/gossip-cell-renderer-expander.c | 232 +++-----------------
widgets/gossip-cell-renderer-expander.h | 5 -
widgets/rb-cell-renderer-pixbuf.c | 30 +--
widgets/rb-cell-renderer-rating.c | 30 ++--
widgets/rb-entry-view.c | 1 -
widgets/rb-library-browser.c | 1 -
widgets/rb-query-creator-properties.c | 1 -
widgets/rb-query-creator.c | 1 -
widgets/rb-rating-helper.c | 19 +-
widgets/rb-rating-helper.h | 2 +-
widgets/rb-rating.c | 112 ++++++-----
widgets/rb-search-entry.c | 30 ++-
widgets/rb-segmented-bar.c | 79 ++++---
45 files changed, 357 insertions(+), 551 deletions(-)
---
diff --git a/backends/gstreamer/rb-encoder-gst.c b/backends/gstreamer/rb-encoder-gst.c
index 7c49878..a7530e9 100644
--- a/backends/gstreamer/rb-encoder-gst.c
+++ b/backends/gstreamer/rb-encoder-gst.c
@@ -35,7 +35,7 @@
#include <gst/gst.h>
#include <gst/tag/tag.h>
#include <string.h>
-#include <profiles/gnome-media-profiles.h>
+#include <libgnome-media-profiles/gnome-media-profiles.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <gst/pbutils/missing-plugins.h>
diff --git a/configure.ac b/configure.ac
index 8383e47..7355385 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,26 +40,32 @@ m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(long)
+GTK_REQS=2.91.4
+
DBUS_MIN_REQS=0.35
GST_0_10_REQS=0.10.20
-GTK_REQS=2.18.0
+GDK_PIXBUF_REQS=2.18.0
GLIB_REQS=2.18.0
-GNOME_MEDIA_PROFILES_REQS=2.8
-LIBNOTIFY_REQS=0.4.1
LIBGPOD_REQS=0.6
MUSICBRAINZ_REQS=2.1.0
MUSICBRAINZ3_REQS=3.0.2
-BRASERO_MIN_REQS=0.9.1
TOTEM_PLPARSER_REQS=2.32.1
-VALA_REQS=0.1.0
+VALA_REQS=0.9.4
AVAHI_REQS=0.6
LIBSOUP_REQS=2.26.0
GUDEV_REQS=143
LIBMTP_REQS=0.3.0
PYGOBJECT_REQUIRED=2.15.4
-WEBKIT_MIN_REQS=1.1.17
GLIB_GDBUS_REQS=2.25.12
+GNOME_MEDIA_PROFILES_REQS=2.91.0
+LIBNOTIFY_REQS=0.5.1
+BRASERO_MIN_REQS=2.31.5
+WEBKIT_MIN_REQS=1.3.9
+
+
+
+
AC_MSG_CHECKING([for GNU extension fwrite_unlocked])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
@@ -86,11 +92,12 @@ PKG_CHECK_MODULES(RB_CLIENT, glib-2.0 >= $GLIB_REQS gio-2.0 >= $GLIB_REQS gio-un
dnl note: gio-unix-2.0 is here for libmediaplayerid
PKG_CHECK_MODULES(RHYTHMBOX, \
- gtk+-2.0 >= $GTK_REQS \
+ gtk+-3.0 >= $GTK_REQS \
+ gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQS \
glib-2.0 >= $GLIB_REQS \
gio-2.0 >= $GLIB_REQS \
gio-unix-2.0 >= $GLIB_REQS \
- gnome-media-profiles >= $GNOME_MEDIA_PROFILES_REQS \
+ libgnome-media-profiles-3.0 >= $GNOME_MEDIA_PROFILES_REQS \
libsoup-2.4 >= $LIBSOUP_REQS \
libsoup-gnome-2.4 >= $LIBSOUP_REQS)
@@ -409,12 +416,16 @@ fi
dnl libbrasero-media support
have_libbrasero_media=no
-AC_ARG_WITH(libbrasero-media,
+AC_ARG_WITH(libbrasero-media3,
AC_HELP_STRING([--with-libbrasero-media],
[Build with libbrasero-media support]),,
with_libbrasero_media=auto)
if test x"$with_libbrasero_media" != "xno"; then
- PKG_CHECK_MODULES(LIBBRASERO_MEDIA, [libbrasero-media >= $BRASERO_MIN_REQS] gtk+-x11-2.0, have_libbrasero_media=yes, have_libbrasero_media=no)
+ PKG_CHECK_MODULES(LIBBRASERO_MEDIA, [
+ libbrasero-media3 >= $BRASERO_MIN_REQS \
+ gtk+-x11-3.0],
+ have_libbrasero_media=yes,
+ have_libbrasero_media=no)
fi
if test "x$have_libbrasero_media" = "xyes"; then
AC_DEFINE([HAVE_LIBBRASERO_MEDIA], 1, [Have libbrasero-media])
@@ -492,12 +503,13 @@ fi
AM_CONDITIONAL(WITH_LIRC, test x"$with_lirc" = xyes)
dnl WebKit
+have_webkit=no
AC_ARG_WITH(webkit,
AC_HELP_STRING([--with-webkit],
[Use WebKit to display HTML]),,
- with_webkit_gtk=auto)
-if test "x$with_webkit_gtk" != xno; then
- PKG_CHECK_MODULES(WEBKIT, [webkit-1.0 >= $WEBKIT_MIN_REQS], have_webkit=yes, have_webkit=no)
+ with_webkit=auto)
+if test "x$with_webkit" != xno; then
+ PKG_CHECK_MODULES(WEBKIT, [webkitgtk-3.0 >= $WEBKIT_MIN_REQS], have_webkit=yes, have_webkit=no)
if test "x$have_webkit" = "xno" -a "x$with_webkit" = "xyes"; then
AC_MSG_ERROR([WebKit support explicitly requested, but WebKit could not be found])
fi
@@ -733,15 +745,19 @@ AC_ARG_ENABLE([vala],
[enable_vala=$enableval have_vala=$enableval],
[enable_vala=autodetect have_vala=yes])
AC_MSG_RESULT([$enable_vala])
+with_vala=no
if test "x$enable_vala" = "xyes"; then
AM_PROG_VALAC([$VALA_REQS])
- if test "x$VALAC" = "x"; then
- if test "x$enable_vala" = "xyes"; then
- AC_MSG_ERROR([Vala plugin support explicitly requested, but not found])
- fi
- with_vala=no
- else
+ if test "x$VALAC" != "x"; then
+ VAPIDIR=$datadir/vala/vapi
+ # what?
+ VAPIGEN=vapigen
+ AC_SUBST([VALAC])
+ AC_SUBST([VAPIDIR])
+ AC_SUBST([VAPIGEN])
with_vala=yes
+ elif test "x$enable_vala" = "xyes"; then
+ AC_MSG_ERROR([Vala plugin support explicitly requested, but not found])
fi
fi
AM_CONDITIONAL(ENABLE_VALA, test "x$with_vala" = "xyes")
@@ -977,6 +993,11 @@ if test x"$have_libnotify" = xyes; then
else
AC_MSG_NOTICE([ libnotify support is disabled])
fi
+if test x"$have_webkit" = xyes; then
+ AC_MSG_NOTICE([** WebKit support is enabled])
+else
+ AC_MSG_NOTICE([ WebKit support is disabled])
+fi
if test x"$use_gudev" = xyes; then
AC_MSG_NOTICE([** GUdev support enabled])
elif test x"$enable_hal" = xyes; then
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index dee3bd4..33c9175 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -37,7 +37,6 @@ IGNORE_HFILES= \
eggdesktopfile.h \
eggsmclient-private.h \
eggsmclient.h \
- gseal-gtk-compat.h \
md5.h \
mkdtemp.h \
rb-cut-and-paste-code.h \
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 6d787ff..a01f739 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -31,7 +31,6 @@ librb_la_SOURCES = \
eggsmclient.h \
eggsmclient-private.h \
eggsmclient-xsmp.c \
- gseal-gtk-compat.h \
rb-file-helpers.c \
rb-builder-helpers.c \
rb-stock-icons.c \
diff --git a/lib/eggsmclient-private.h b/lib/eggsmclient-private.h
index ccb10bf..e391218 100644
--- a/lib/eggsmclient-private.h
+++ b/lib/eggsmclient-private.h
@@ -20,7 +20,7 @@
#ifndef __EGG_SM_CLIENT_PRIVATE_H__
#define __EGG_SM_CLIENT_PRIVATE_H__
-#include <gdkconfig.h>
+#include <gdk/gdk.h>
#include "eggsmclient.h"
G_BEGIN_DECLS
diff --git a/lib/eggsmclient-xsmp.c b/lib/eggsmclient-xsmp.c
index 8bebfba..645da38 100644
--- a/lib/eggsmclient-xsmp.c
+++ b/lib/eggsmclient-xsmp.c
@@ -36,6 +36,7 @@
#include <X11/SM/SMlib.h>
#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
#define EGG_TYPE_SM_CLIENT_XSMP (egg_sm_client_xsmp_get_type ())
#define EGG_SM_CLIENT_XSMP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP))
@@ -367,7 +368,7 @@ sm_client_xsmp_startup (EggSMClient *client,
free (ret_client_id);
gdk_threads_enter ();
- gdk_set_sm_client_id (xsmp->client_id);
+ gdk_x11_set_sm_client_id (xsmp->client_id);
gdk_threads_leave ();
g_debug ("Got client ID \"%s\"", xsmp->client_id);
diff --git a/lib/rb-missing-plugins.c b/lib/rb-missing-plugins.c
index c273d1b..7f1c593 100644
--- a/lib/rb-missing-plugins.c
+++ b/lib/rb-missing-plugins.c
@@ -26,7 +26,6 @@
#include "rb-missing-plugins.h"
#include "rb-debug.h"
-#include "gseal-gtk-compat.h"
#include <gst/pbutils/pbutils.h>
#include <gst/pbutils/install-plugins.h>
@@ -216,7 +215,7 @@ rb_missing_plugins_install (const char **details, gboolean ignore_blacklist, GCl
if (parent_window != NULL && gtk_widget_get_realized (GTK_WIDGET (parent_window))) {
#ifdef GDK_WINDOWING_X11
gulong xid = 0;
- xid = gdk_x11_drawable_get_xid (gtk_widget_get_window (GTK_WIDGET (parent_window)));
+ xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (parent_window)));
gst_install_plugins_context_set_xid (install_ctx, xid);
#endif
}
diff --git a/lib/rb-tree-dnd.c b/lib/rb-tree-dnd.c
index 7af44fd..ed20ce8 100644
--- a/lib/rb-tree-dnd.c
+++ b/lib/rb-tree-dnd.c
@@ -25,8 +25,6 @@
#include "rb-debug.h"
-#include "gseal-gtk-compat.h"
-
#define RB_TREE_DND_STRING "RbTreeDndString"
/* must be the same value as in gtk_tree_view.c */
#define SCROLL_EDGE_SIZE 15
@@ -502,7 +500,7 @@ scroll_row_timeout (gpointer data)
}
}
- vadj = gtk_tree_view_get_vadjustment (tree_view);
+ vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (tree_view));
vadj_value = gtk_adjustment_get_value (vadj);
value = CLAMP (vadj_value + offset,
gtk_adjustment_get_lower (vadj),
diff --git a/lib/rb-util.c b/lib/rb-util.c
index ebf486a..fc170df 100644
--- a/lib/rb-util.c
+++ b/lib/rb-util.c
@@ -356,7 +356,7 @@ rb_image_new_from_stock (const gchar *stock_id, GtkIconSize size)
return NULL;
}
- pixbuf = gtk_widget_render_icon (image, stock_id, size, NULL);
+ pixbuf = gtk_widget_render_icon_pixbuf (image, stock_id, size);
g_assert (pixbuf != NULL);
@@ -1198,16 +1198,16 @@ rb_set_tree_view_column_fixed_width (GtkWidget *treeview,
int i = 0;
while (strings[i] != NULL) {
- gint width;
+ GtkRequisition natural_size;
g_object_set (renderer, "text", strings[i], NULL);
- gtk_cell_renderer_get_size (renderer,
- GTK_WIDGET (treeview),
- NULL,
- NULL, NULL,
- &width, NULL);
-
- if (width > max_width)
- max_width = width;
+ /* XXX should we use minimum size instead? */
+ gtk_cell_renderer_get_preferred_size (renderer,
+ GTK_WIDGET (treeview),
+ NULL,
+ &natural_size);
+
+ if (natural_size.width > max_width)
+ max_width = natural_size.width;
i++;
}
diff --git a/plugins/audiocd/rb-audiocd-source.c b/plugins/audiocd/rb-audiocd-source.c
index 287535b..81f36ea 100644
--- a/plugins/audiocd/rb-audiocd-source.c
+++ b/plugins/audiocd/rb-audiocd-source.c
@@ -278,20 +278,21 @@ rb_audiocd_source_dispose (GObject *object)
static inline void
force_no_spacing (GtkWidget *widget)
{
- static gboolean first_time = TRUE;
- if (first_time) {
- gtk_rc_parse_string ("\n"
- " style \"audiocd-extract-header-style\"\n"
- " {\n"
- " GtkCheckButton::indicator-spacing=0\n"
- " }\n"
- "\n"
- " widget \"*.audiocd-extract-header\" style \"audiocd-extract-header-style\"\n"
- "\n");
- first_time = FALSE;
+ static GtkCssProvider *provider = NULL;
+
+ if (provider == NULL) {
+ const char *style =
+ "GtkCheckButton {\n"
+ " -GtkCheckButton-indicator-spacing: 0\n"
+ "}\n";
+
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, style, -1, NULL);
}
- gtk_widget_set_name (widget, "audiocd-extract-header");
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
static void
@@ -366,7 +367,7 @@ rb_audiocd_source_constructed (GObject *object)
g_signal_connect_object (renderer, "toggled", G_CALLBACK (extract_toggled_cb), source, 0);
/* set column width */
- gtk_cell_renderer_get_size (renderer, GTK_WIDGET (entry_view), NULL, NULL, NULL, &toggle_width, NULL);
+ gtk_cell_renderer_get_preferred_width (renderer, GTK_WIDGET (entry_view), NULL, &toggle_width);
gtk_tree_view_column_set_sizing (extract, GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width (extract, toggle_width + 10);
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c b/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
index 14ff193..2af4846 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
@@ -32,7 +32,6 @@
#include <math.h>
#include <lib/eel-gconf-extensions.h>
-#include <lib/gseal-gtk-compat.h>
#include <lib/rb-debug.h>
#include <lib/rb-builder-helpers.h>
#include <lib/rb-file-helpers.h>
@@ -1708,11 +1707,11 @@ list_table_size_allocate_cb (GtkWidget *table,
/* find the desired width of the widest child */
child_width = 1;
for (i = children; i != NULL; i = i->next) {
- GtkRequisition child_requisition;
+ int min_width;
- gtk_widget_size_request (i->data, &child_requisition);
- if (child_requisition.width > child_width) {
- child_width = child_requisition.width;
+ gtk_widget_get_preferred_width (i->data, &min_width, NULL);
+ if (min_width > child_width) {
+ child_width = min_width;
}
}
diff --git a/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c b/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c
index 03f712d..3756c71 100644
--- a/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c
+++ b/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c
@@ -178,7 +178,7 @@ rb_disc_recorder_plugin_start_burning (RBDiscRecorderPlugin *pi,
window = gtk_widget_get_window (main_window);
if (window) {
int xid;
- xid = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window));
+ xid = gdk_x11_window_get_xid (window);
xid_str = g_strdup_printf ("%d", xid);
g_ptr_array_add (array, "-x");
g_ptr_array_add (array, xid_str);
@@ -190,7 +190,7 @@ rb_disc_recorder_plugin_start_burning (RBDiscRecorderPlugin *pi,
args = (char **) g_ptr_array_free (array, FALSE);
ret = TRUE;
- if (!gdk_spawn_on_screen (screen, NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error)) {
+ if (!g_spawn_async (NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error)) {
if (copy != FALSE) {
rb_error_dialog (GTK_WINDOW (main_window),
_("Rhythmbox could not duplicate the disc"),
diff --git a/plugins/daap/rb-dacp-pairing-page.c b/plugins/daap/rb-dacp-pairing-page.c
index 0390b5c..8ef9a0b 100644
--- a/plugins/daap/rb-dacp-pairing-page.c
+++ b/plugins/daap/rb-dacp-pairing-page.c
@@ -272,7 +272,7 @@ impl_constructed (GObject *object)
entry_name = g_strdup_printf ("passcode_entry%d", i + 1);
page->priv->entries[i] = GTK_WIDGET (gtk_builder_get_object (page->priv->builder, entry_name));
- gtk_widget_modify_font (page->priv->entries[i], font);
+ gtk_widget_override_font (page->priv->entries[i], font);
g_signal_connect_object (page->priv->entries[i],
"insert-text",
G_CALLBACK (entry_insert_text_cb),
diff --git a/plugins/fmradio/rb-fm-radio-source.c b/plugins/fmradio/rb-fm-radio-source.c
index 1df9c8e..2dad6a2 100644
--- a/plugins/fmradio/rb-fm-radio-source.c
+++ b/plugins/fmradio/rb-fm-radio-source.c
@@ -369,7 +369,7 @@ rb_fm_radio_source_cmd_new_station (GtkAction *action, RBFMRadioSource *self)
G_CALLBACK (new_station_location_added),
self, 0);
gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_object_destroy (GTK_OBJECT (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
diff --git a/plugins/power-manager/rb-power-manager-plugin.c b/plugins/power-manager/rb-power-manager-plugin.c
index 2b5f817..c25f3d3 100644
--- a/plugins/power-manager/rb-power-manager-plugin.c
+++ b/plugins/power-manager/rb-power-manager-plugin.c
@@ -187,7 +187,7 @@ inhibit (RBGPMPlugin *plugin)
rb_debug ("inhibiting");
g_object_ref (plugin);
g_object_get (plugin->shell, "window", &window, NULL);
- xid = GDK_WINDOW_XWINDOW (gtk_widget_get_window (GTK_WIDGET (window)));
+ xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (window)));
dbus_g_proxy_begin_call (plugin->proxy, "Inhibit",
(DBusGProxyCallNotify) inhibit_cb,
plugin,
diff --git a/plugins/status-icon/rb-status-icon-plugin.c b/plugins/status-icon/rb-status-icon-plugin.c
index 97d72a1..accf663 100644
--- a/plugins/status-icon/rb-status-icon-plugin.c
+++ b/plugins/status-icon/rb-status-icon-plugin.c
@@ -52,7 +52,6 @@
#include "rb-stock-icons.h"
#include "eel-gconf-extensions.h"
#include "rb-builder-helpers.h"
-#include "gseal-gtk-compat.h"
#include "rb-tray-icon-gtk.h"
@@ -1111,7 +1110,7 @@ set_icon_geometry (GdkWindow *window,
int height)
{
gulong data[4];
- Display *dpy = gdk_x11_drawable_get_xdisplay (window);
+ Display *dpy = GDK_WINDOW_XDISPLAY (window);
data[0] = x;
data[1] = y;
diff --git a/plugins/visualizer/rb-vis-widget.c b/plugins/visualizer/rb-vis-widget.c
index 7ad8730..8db5b8a 100644
--- a/plugins/visualizer/rb-vis-widget.c
+++ b/plugins/visualizer/rb-vis-widget.c
@@ -40,8 +40,6 @@
#include "rb-vis-widget.h"
#include "rb-debug.h"
-#include "gseal-gtk-compat.h"
-
enum
{
PROP_0,
@@ -64,7 +62,6 @@ static void
rb_vis_widget_realize (GtkWidget *widget)
{
GtkAllocation allocation;
- GtkStyle *style;
GdkWindowAttr attributes;
GdkWindow *window;
gint attributes_mask;
@@ -79,10 +76,9 @@ rb_vis_widget_realize (GtkWidget *widget)
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
@@ -90,10 +86,6 @@ rb_vis_widget_realize (GtkWidget *widget)
gdk_window_set_user_data (window, widget);
gdk_window_show (window);
- style = gtk_style_attach (gtk_widget_get_style (widget), window);
- gtk_widget_set_style (widget, style);
- gtk_style_set_background (style, window, GTK_STATE_NORMAL);
-
gtk_widget_set_realized (widget, TRUE);
}
@@ -125,16 +117,15 @@ rb_vis_widget_size_allocate (GtkWidget *widget,
}
static gboolean
-rb_vis_widget_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+rb_vis_widget_draw (GtkWidget *widget, cairo_t *cr)
{
GdkWindow *window;
RBVisWidget *rbvw = RB_VIS_WIDGET (widget);
window = gtk_widget_get_window (widget);
- if (rbvw->window_xid != GDK_WINDOW_XWINDOW (window)) {
- rbvw->window_xid = GDK_WINDOW_XWINDOW (window);
+ if (rbvw->window_xid != GDK_WINDOW_XID (window)) {
+ rbvw->window_xid = GDK_WINDOW_XID (window);
gdk_display_sync (gdk_window_get_display (window));
@@ -239,7 +230,7 @@ rb_vis_widget_class_init (RBVisWidgetClass *klass)
widget_class->size_allocate = rb_vis_widget_size_allocate;
widget_class->realize = rb_vis_widget_realize;
- widget_class->expose_event = rb_vis_widget_expose_event;
+ widget_class->draw = rb_vis_widget_draw;
widget_class->hide = rb_vis_widget_hide;
widget_class->show = rb_vis_widget_show;
diff --git a/plugins/visualizer/rb-visualizer-plugin.c b/plugins/visualizer/rb-visualizer-plugin.c
index 6f9b57e..c21d807 100644
--- a/plugins/visualizer/rb-visualizer-plugin.c
+++ b/plugins/visualizer/rb-visualizer-plugin.c
@@ -81,7 +81,6 @@
#include <dbus/dbus-glib.h>
#include "rb-vis-widget.h"
-#include "gseal-gtk-compat.h"
/* preferences */
#define CONF_VIS_PREFIX CONF_PREFIX "/plugins/visualizer"
@@ -815,7 +814,7 @@ actually_hide_controls (RBVisualizerPlugin *plugin)
cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
gdk_window_set_cursor (window, cursor);
- gdk_cursor_unref (cursor);
+ g_object_unref (cursor);
}
/* fall through */
case EMBEDDED:
@@ -916,7 +915,7 @@ rb_visualizer_plugin_key_release_cb (GtkWidget *vis_widget,
GdkEventKey *event,
RBVisualizerPlugin *plugin)
{
- if (event->keyval != GDK_Escape)
+ if (event->keyval != GDK_KEY_Escape)
return FALSE;
switch (plugin->mode) {
@@ -976,22 +975,22 @@ static void
vis_window_size_request_cb (GtkWidget *widget, GtkRequisition *req, RBVisualizerPlugin *plugin)
{
int quality;
+ int control_width;
float ratio;
- GtkRequisition control_req;
rb_debug ("handling size-request for vis window");
quality = eel_gconf_get_integer (CONF_VIS_QUALITY);
- gtk_widget_size_request (plugin->control_widget, &control_req);
+ gtk_widget_get_preferred_width (plugin->control_widget, &control_width, NULL);
req->width = vis_quality[quality].width;
req->height = vis_quality[quality].height;
ratio = ((float)vis_quality[quality].height) / ((float)vis_quality[quality].width);
- if ((req->width < control_req.width) || (req->height < (control_req.width * ratio))) {
- req->width = control_req.width;
- req->height = control_req.width * ratio;
+ if ((req->width < control_width) || (req->height < (control_width * ratio))) {
+ req->width = control_width;
+ req->height = control_width * ratio;
}
g_signal_handler_disconnect (plugin->vis_window, plugin->vis_window_size_request_id);
@@ -1003,7 +1002,7 @@ resize_vis_window (RBVisualizerPlugin *plugin, int quality, gboolean resize_down
{
int width;
int height;
- GtkRequisition req;
+ int control_width;
float ratio;
gboolean update = FALSE;
@@ -1030,7 +1029,7 @@ resize_vis_window (RBVisualizerPlugin *plugin, int quality, gboolean resize_down
ratio = ((float)vis_quality[quality].height) / ((float)vis_quality[quality].width);
gtk_window_get_size (GTK_WINDOW (plugin->vis_window), &width, &height);
- gtk_widget_size_request (plugin->control_widget, &req);
+ gtk_widget_get_preferred_width (plugin->control_widget, &control_width, NULL);
if (width < vis_quality[quality].width && height < vis_quality[quality].height) {
rb_debug ("resizing output window: [%d,%d] < [%d,%d]",
@@ -1056,15 +1055,15 @@ resize_vis_window (RBVisualizerPlugin *plugin, int quality, gboolean resize_down
}
}
- if (width < req.width) {
- rb_debug ("resizing output window %d < %d", width, req.width);
- width = req.width;
+ if (width < control_width) {
+ rb_debug ("resizing output window %d < %d", width, control_width);
+ width = control_width;
update = TRUE;
}
- if (height < (req.width * ratio)) {
+ if (height < (control_width * ratio)) {
rb_debug ("resizing output window: %d < %d (ratio %f)",
- height, (int)(req.width * ratio), ratio);
- height = (int)(req.width * ratio);
+ height, (int)(control_width * ratio), ratio);
+ height = (int)(control_width * ratio);
update = TRUE;
}
@@ -1116,7 +1115,7 @@ update_window (RBVisualizerPlugin *plugin, VisualizerMode mode, int screen, int
} else {
if (plugin->xoverlay != NULL) {
gst_x_overlay_set_xwindow_id (plugin->xoverlay,
- GDK_WINDOW_XWINDOW (plugin->fake_window));
+ GDK_WINDOW_XID (plugin->fake_window));
}
switch (plugin->mode) {
@@ -1246,7 +1245,7 @@ update_window (RBVisualizerPlugin *plugin, VisualizerMode mode, int screen, int
if (plugin->remote_window == 0) {
gdk_screen = get_screen (plugin, screen);
root_window = gdk_screen_get_root_window (gdk_screen);
- plugin->remote_window = GDK_WINDOW_XWINDOW (root_window);
+ plugin->remote_window = GDK_WINDOW_XID (root_window);
rb_debug ("got root window id %lu", plugin->remote_window);
}
diff --git a/podcast/rb-podcast-properties-dialog.c b/podcast/rb-podcast-properties-dialog.c
index e61e604..139d8e5 100644
--- a/podcast/rb-podcast-properties-dialog.c
+++ b/podcast/rb-podcast-properties-dialog.c
@@ -216,18 +216,21 @@ static void
set_webkit_font_from_gtk_style (WebKitWebView *view)
{
WebKitWebSettings *settings;
- GtkStyle *style;
+ const PangoFontDescription *font_desc;
+ GtkStyleContext *style;
int font_size;
const char *font_family;
- style = gtk_widget_get_style (GTK_WIDGET (view));
+ style = gtk_widget_get_style_context (GTK_WIDGET (view));
settings = webkit_web_view_get_settings (view);
- font_size = pango_font_description_get_size (style->font_desc);
- if (pango_font_description_get_size_is_absolute (style->font_desc) == FALSE)
+ font_desc = gtk_style_context_get_font (gtk_widget_get_style_context (GTK_WIDGET (view)),
+ GTK_STATE_FLAG_ACTIVE);
+ font_size = pango_font_description_get_size (font_desc);
+ if (pango_font_description_get_size_is_absolute (font_desc) == FALSE)
font_size /= PANGO_SCALE;
- font_family = pango_font_description_get_family (style->font_desc);
+ font_family = pango_font_description_get_family (font_desc);
rb_debug ("setting font settings: %s / %d", font_family, font_size);
g_object_set (settings,
diff --git a/shell/main.c b/shell/main.c
index 90cda3c..7381ad3 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -146,7 +146,7 @@ main (int argc, char **argv)
g_option_context_add_group (context, egg_sm_client_get_option_group ());
g_option_context_add_group (context, gtk_get_option_group (TRUE));
- gtk_set_locale ();
+ setlocale (LC_ALL, NULL);
rb_profile_start ("parsing command line options");
if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
diff --git a/shell/rb-plugin-manager.c b/shell/rb-plugin-manager.c
index dee908c..90387a3 100644
--- a/shell/rb-plugin-manager.c
+++ b/shell/rb-plugin-manager.c
@@ -43,8 +43,6 @@
#include "rb-debug.h"
#include "rb-builder-helpers.h"
-#include "gseal-gtk-compat.h"
-
enum
{
ACTIVE_COLUMN,
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index 07a488a..cd6941e 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -52,7 +52,6 @@
#include <X11/XF86keysym.h>
#endif /* HAVE_MMKEYS */
-#include "gseal-gtk-compat.h"
#include "rb-shell.h"
#include "rb-debug.h"
#include "rb-dialog.h"
@@ -1477,7 +1476,6 @@ construct_load_ui (RBShell *shell)
{
GtkWidget *menubar;
GtkWidget *toolbar;
- GtkWidget *hbox;
GtkToolItem *tool_item;
GError *error = NULL;
@@ -1497,12 +1495,10 @@ construct_load_ui (RBShell *shell)
gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), menubar, FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (shell->priv->main_vbox), menubar, 0);
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), hbox, FALSE, FALSE, 0);
- gtk_box_reorder_child (GTK_BOX (shell->priv->main_vbox), hbox, 1);
-
toolbar = gtk_ui_manager_get_widget (shell->priv->ui_manager, "/ToolBar");
- gtk_box_pack_start (GTK_BOX (hbox), toolbar, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), toolbar, FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (shell->priv->main_vbox), toolbar, 1);
+ gtk_widget_show (toolbar);
shell->priv->volume_button = gtk_volume_button_new ();
g_signal_connect (shell->priv->volume_button, "value-changed",
@@ -1523,8 +1519,6 @@ construct_load_ui (RBShell *shell)
gtk_widget_show_all (GTK_WIDGET (tool_item));
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, -1);
- gtk_widget_show (hbox);
-
gtk_widget_set_tooltip_text (shell->priv->volume_button,
_("Change the music volume"));
@@ -1691,8 +1685,6 @@ rb_shell_window_state_cb (GtkWidget *widget,
if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) {
gboolean maximised = ((event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0);
- gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (shell->priv->statusbar),
- !maximised);
if (!shell->priv->window_small) {
shell->priv->window_maximised = maximised;
eel_gconf_set_boolean (CONF_STATE_WINDOW_MAXIMIZED,
diff --git a/shell/rb-source-header.c b/shell/rb-source-header.c
index 7f4d3d1..14ee713 100644
--- a/shell/rb-source-header.c
+++ b/shell/rb-source-header.c
@@ -156,21 +156,21 @@ G_DEFINE_TYPE (RBSourceHeader, rb_source_header, GTK_TYPE_TABLE)
static inline void
force_no_shadow (GtkWidget *widget)
{
- gboolean first_time = TRUE;
-
- if (first_time) {
- gtk_rc_parse_string ("\n"
- " style \"search-toolbar-style\"\n"
- " {\n"
- " GtkToolbar::shadow-type=GTK_SHADOW_NONE\n"
- " }\n"
- "\n"
- " widget \"*.search-toolbar\" style \"search-toolbar-style\"\n"
- "\n");
- first_time = FALSE;
- }
-
- gtk_widget_set_name (widget, "search-toolbar");
+ static GtkCssProvider *provider = NULL;
+ if (provider == NULL) {
+ const char *style =
+ "GtkToolbar {\n"
+ " -GtkToolbar-shadow-type: none\n"
+ "}";
+
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, style, -1, NULL);
+ }
+
+ /*
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); */
}
static void
diff --git a/shell/rb-statusbar.c b/shell/rb-statusbar.c
index 82ce135..489ef91 100644
--- a/shell/rb-statusbar.c
+++ b/shell/rb-statusbar.c
@@ -180,8 +180,6 @@ rb_statusbar_init (RBStatusbar *statusbar)
RB_TYPE_STATUSBAR,
RBStatusbarPrivate);
- gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (statusbar), TRUE);
-
statusbar->priv->progress = gtk_progress_bar_new ();
gtk_widget_set_size_request (statusbar->priv->progress, -1, 10);
diff --git a/sources/rb-display-page-model.c b/sources/rb-display-page-model.c
index 930fd2a..86f33eb 100644
--- a/sources/rb-display-page-model.c
+++ b/sources/rb-display-page-model.c
@@ -44,8 +44,6 @@
#include "rb-auto-playlist-source.h"
#include "rb-static-playlist-source.h"
-#include "gseal-gtk-compat.h"
-
/**
* SECTION:rb-display-page-model
* @short_description: models backing the display page tree
diff --git a/sources/rb-display-page-tree.c b/sources/rb-display-page-tree.c
index 992f79d..88c4b08 100644
--- a/sources/rb-display-page-tree.c
+++ b/sources/rb-display-page-tree.c
@@ -147,33 +147,32 @@ set_cell_background (RBDisplayPageTree *display_page_tree,
gboolean is_group,
gboolean is_active)
{
- GdkColor color;
- GtkStyle *style;
+ GdkRGBA color;
g_return_if_fail (display_page_tree != NULL);
g_return_if_fail (cell != NULL);
- style = gtk_widget_get_style (GTK_WIDGET (display_page_tree));
+ gtk_style_context_get_color (gtk_widget_get_style_context (GTK_WIDGET (display_page_tree)),
+ GTK_STATE_SELECTED,
+ &color);
if (!is_group) {
if (is_active) {
- color = style->bg[GTK_STATE_SELECTED];
-
/* Here we take the current theme colour and add it to
* the colour for white and average the two. This
* gives a colour which is inline with the theme but
* slightly whiter.
*/
- color.red = (color.red + (style->white).red) / 2;
- color.green = (color.green + (style->white).green) / 2;
- color.blue = (color.blue + (style->white).blue) / 2;
+ color.red = (color.red + 1.0) / 2;
+ color.green = (color.green + 1.0) / 2;
+ color.blue = (color.blue + 1.0) / 2;
g_object_set (cell,
- "cell-background-gdk", &color,
+ "cell-background-rgba", &color,
NULL);
} else {
g_object_set (cell,
- "cell-background-gdk", NULL,
+ "cell-background-rgba", NULL,
NULL);
}
} else {
@@ -526,7 +525,7 @@ key_release_cb (GtkTreeView *treeview,
gboolean res;
/* F2 = rename playlist */
- if (event->keyval != GDK_F2) {
+ if (event->keyval != GDK_KEY_F2) {
return FALSE;
}
@@ -652,7 +651,6 @@ rb_display_page_tree_toggle_expanded (RBDisplayPageTree *display_page_tree,
{
GtkTreeIter iter;
GtkTreePath *path;
- gboolean expanding;
g_assert (rb_display_page_model_find_page (display_page_tree->priv->page_model,
page,
@@ -662,16 +660,19 @@ rb_display_page_tree_toggle_expanded (RBDisplayPageTree *display_page_tree,
if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (display_page_tree->priv->treeview), path)) {
rb_debug ("collapsing page %p", page);
gtk_tree_view_collapse_row (GTK_TREE_VIEW (display_page_tree->priv->treeview), path);
- expanding = FALSE;
+ g_object_set (display_page_tree->priv->expander_renderer,
+ "expander-style",
+ GTK_EXPANDER_COLLAPSED,
+ NULL);
} else {
rb_debug ("expanding page %p", page);
gtk_tree_view_expand_row (GTK_TREE_VIEW (display_page_tree->priv->treeview), path, FALSE);
- expanding = TRUE;
+ g_object_set (display_page_tree->priv->expander_renderer,
+ "expander-style",
+ GTK_EXPANDER_EXPANDED,
+ NULL);
}
- gossip_cell_renderer_expander_start_animation (GOSSIP_CELL_RENDERER_EXPANDER (display_page_tree->priv->expander_renderer),
- GTK_TREE_VIEW (display_page_tree->priv->treeview),
- path,
- expanding);
+
gtk_tree_path_free (path);
}
diff --git a/sources/rb-library-source.c b/sources/rb-library-source.c
index 9238907..7adf55e 100644
--- a/sources/rb-library-source.c
+++ b/sources/rb-library-source.c
@@ -54,8 +54,8 @@
#include "rb-track-transfer-batch.h"
#include "rb-track-transfer-queue.h"
-#include <profiles/gnome-media-profiles.h>
-#include <profiles/audio-profile-choose.h>
+#include <libgnome-media-profiles/gnome-media-profiles.h>
+#include <libgnome-media-profiles/audio-profile-choose.h>
#include "rhythmdb.h"
#include "rb-debug.h"
@@ -68,7 +68,6 @@
#include "rb-auto-playlist-source.h"
#include "rb-encoder.h"
#include "rb-missing-plugins.h"
-#include "gseal-gtk-compat.h"
static void rb_library_source_class_init (RBLibrarySourceClass *klass);
static void rb_library_source_init (RBLibrarySource *source);
diff --git a/tests/bench-rhythmdb-load.c b/tests/bench-rhythmdb-load.c
index be1f5f9..7438f0c 100644
--- a/tests/bench-rhythmdb-load.c
+++ b/tests/bench-rhythmdb-load.c
@@ -31,6 +31,7 @@
#include <gtk/gtk.h>
#include <string.h>
+#include <locale.h>
#include "rb-debug.h"
#include "rb-file-helpers.h"
@@ -100,7 +101,7 @@ main (int argc, char **argv)
g_thread_init (NULL);
rb_threads_init ();
- gtk_set_locale ();
+ setlocale (LC_ALL, NULL);
gtk_init (&argc, &argv);
rb_debug_init (FALSE);
rb_refstring_system_init ();
diff --git a/tests/test-file-helpers.c b/tests/test-file-helpers.c
index d84ecc2..c21d22e 100644
--- a/tests/test-file-helpers.c
+++ b/tests/test-file-helpers.c
@@ -31,6 +31,7 @@
#include <check.h>
#include <gtk/gtk.h>
+#include <locale.h>
#include "test-utils.h"
#include "rb-file-helpers.h"
#include "rb-util.h"
@@ -123,7 +124,7 @@ main (int argc, char **argv)
rb_profile_start ("rb-file-helpers test suite");
g_thread_init (NULL);
rb_threads_init ();
- gtk_set_locale ();
+ setlocale (LC_ALL, NULL);
rb_debug_init (TRUE);
rb_file_helpers_init (TRUE);
diff --git a/tests/test-rhythmdb-property-model.c b/tests/test-rhythmdb-property-model.c
index 7905b52..9e40912 100644
--- a/tests/test-rhythmdb-property-model.c
+++ b/tests/test-rhythmdb-property-model.c
@@ -29,6 +29,7 @@
#include <check.h>
#include <gtk/gtk.h>
+#include <locale.h>
#include "test-utils.h"
#include "rhythmdb-query-model.h"
#include "rhythmdb-property-model.h"
@@ -700,7 +701,7 @@ main (int argc, char **argv)
g_thread_init (NULL);
rb_threads_init ();
- gtk_set_locale ();
+ setlocale (LC_ALL, NULL);
rb_debug_init (TRUE);
rb_refstring_system_init ();
rb_file_helpers_init (TRUE);
diff --git a/tests/test-rhythmdb-query-model.c b/tests/test-rhythmdb-query-model.c
index 5c801b8..6fdfadd 100644
--- a/tests/test-rhythmdb-query-model.c
+++ b/tests/test-rhythmdb-query-model.c
@@ -29,6 +29,7 @@
#include <check.h>
#include <gtk/gtk.h>
+#include <locale.h>
#include "test-utils.h"
#include "rhythmdb-query-model.h"
@@ -318,7 +319,7 @@ main (int argc, char **argv)
g_thread_init (NULL);
rb_threads_init ();
- gtk_set_locale ();
+ setlocale (LC_ALL, NULL);
rb_debug_init (TRUE);
rb_refstring_system_init ();
rb_file_helpers_init (TRUE);
diff --git a/widgets/gossip-cell-renderer-expander.c b/widgets/gossip-cell-renderer-expander.c
index ce96e56..89daa1f 100644
--- a/widgets/gossip-cell-renderer-expander.c
+++ b/widgets/gossip-cell-renderer-expander.c
@@ -18,23 +18,12 @@
* Boston, MA 02111-1307, USA.
*/
-/* To do:
- * - should probably cancel animation if model changes
- * - need to handle case where node-in-animation is removed
- * - it only handles a single animation at a time; but I guess users
- * aren't fast enough to trigger two or more animations at once anyway :P
- * (could guard for this by just cancelling the "old" animation, and
- * start the new one).
- */
-
#include "config.h"
#include <gtk/gtk.h>
#include "gossip-cell-renderer-expander.h"
-#include "gseal-gtk-compat.h"
-
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_CELL_RENDERER_EXPANDER, GossipCellRendererExpanderPriv))
static void gossip_cell_renderer_expander_init (GossipCellRendererExpander *expander);
@@ -50,24 +39,23 @@ static void gossip_cell_renderer_expander_set_property (GObject
static void gossip_cell_renderer_expander_finalize (GObject *object);
static void gossip_cell_renderer_expander_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
- GdkRectangle *cell_area,
+ const GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height);
static void gossip_cell_renderer_expander_render (GtkCellRenderer *cell,
- GdkWindow *window,
+ cairo_t *cr,
GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags);
static gboolean gossip_cell_renderer_expander_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags);
/* Properties */
@@ -81,17 +69,10 @@ enum {
typedef struct _GossipCellRendererExpanderPriv GossipCellRendererExpanderPriv;
struct _GossipCellRendererExpanderPriv {
- GtkExpanderStyle expander_style;
+ GtkStateFlags style_flags;
gint expander_size;
- GtkTreeView *animation_view;
- GtkTreeRowReference *animation_node;
- GtkExpanderStyle animation_style;
- guint animation_timeout;
- GdkRectangle animation_area;
-
guint activatable : 1;
- guint animation_expanding : 1;
};
G_DEFINE_TYPE (GossipCellRendererExpander, gossip_cell_renderer_expander, GTK_TYPE_CELL_RENDERER)
@@ -103,10 +84,9 @@ gossip_cell_renderer_expander_init (GossipCellRendererExpander *expander)
priv = GET_PRIV (expander);
- priv->expander_style = GTK_EXPANDER_COLLAPSED;
+ priv->style_flags = 0;
priv->expander_size = 12;
priv->activatable = TRUE;
- priv->animation_node = NULL;
gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (expander), 2, 2);
g_object_set (expander,
@@ -176,7 +156,7 @@ gossip_cell_renderer_expander_get_property (GObject *object,
switch (param_id) {
case PROP_EXPANDER_STYLE:
- g_value_set_enum (value, priv->expander_style);
+ g_value_set_enum (value, priv->style_flags & GTK_STATE_FLAG_ACTIVE ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED);
break;
case PROP_EXPANDER_SIZE:
@@ -207,7 +187,11 @@ gossip_cell_renderer_expander_set_property (GObject *object,
switch (param_id) {
case PROP_EXPANDER_STYLE:
- priv->expander_style = g_value_get_enum (value);
+ if (g_value_get_enum (value) == GTK_EXPANDER_EXPANDED) {
+ priv->style_flags |= GTK_STATE_FLAG_ACTIVE;
+ } else {
+ priv->style_flags &= ~(GTK_STATE_FLAG_ACTIVE);
+ }
break;
case PROP_EXPANDER_SIZE:
@@ -231,15 +215,6 @@ gossip_cell_renderer_expander_finalize (GObject *object)
priv = GET_PRIV (object);
- if (priv->animation_timeout) {
- g_source_remove (priv->animation_timeout);
- priv->animation_timeout = 0;
- }
-
- if (priv->animation_node) {
- gtk_tree_row_reference_free (priv->animation_node);
- }
-
(* G_OBJECT_CLASS (gossip_cell_renderer_expander_parent_class)->finalize) (object);
}
@@ -249,10 +224,11 @@ gossip_cell_renderer_expander_new (void)
return g_object_new (GOSSIP_TYPE_CELL_RENDERER_EXPANDER, NULL);
}
+/* XXX implement preferred height/width/h-f-w/w-f-h */
static void
gossip_cell_renderer_expander_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
- GdkRectangle *cell_area,
+ const GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
@@ -297,167 +273,35 @@ gossip_cell_renderer_expander_get_size (GtkCellRenderer *cell,
static void
gossip_cell_renderer_expander_render (GtkCellRenderer *cell,
- GdkWindow *window,
+ cairo_t *cr,
GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GossipCellRendererExpander *expander;
GossipCellRendererExpanderPriv *priv;
- GtkExpanderStyle expander_style;
+ GtkStyleContext *style_context;
gint x_offset, y_offset;
gint xpad, ypad;
expander = (GossipCellRendererExpander*) cell;
priv = GET_PRIV (expander);
- if (priv->animation_node) {
- GtkTreePath *path;
- GdkRectangle rect;
-
- /* Not sure if I like this ... */
- path = gtk_tree_row_reference_get_path (priv->animation_node);
- gtk_tree_view_get_background_area (priv->animation_view, path,
- NULL, &rect);
- gtk_tree_path_free (path);
-
- if (background_area->y == rect.y)
- expander_style = priv->animation_style;
- else
- expander_style = priv->expander_style;
- } else
- expander_style = priv->expander_style;
-
gossip_cell_renderer_expander_get_size (cell, widget, cell_area,
&x_offset, &y_offset,
NULL, NULL);
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
- gtk_paint_expander (gtk_widget_get_style (widget),
- window,
- GTK_STATE_NORMAL,
- expose_area,
- widget,
- "treeview",
- cell_area->x + x_offset + xpad + priv->expander_size / 2,
- cell_area->y + y_offset + ypad + priv->expander_size / 2,
- expander_style);
-}
-
-static void
-invalidate_node (GtkTreeView *tree_view,
- GtkTreePath *path)
-{
- GtkAllocation allocation;
- GdkWindow *bin_window;
- GdkRectangle rect;
+ style_context = gtk_widget_get_style_context (widget);
+ gtk_style_context_set_state (style_context, priv->style_flags);
- bin_window = gtk_tree_view_get_bin_window (tree_view);
-
- gtk_tree_view_get_background_area (tree_view, path, NULL, &rect);
- gtk_widget_get_allocation (GTK_WIDGET (tree_view), &allocation);
-
- rect.x = 0;
- rect.width = allocation.width;
-
- gdk_window_invalidate_rect (bin_window, &rect, TRUE);
-}
-
-static gboolean
-do_animation (GossipCellRendererExpander *expander)
-{
- GossipCellRendererExpanderPriv *priv;
- GtkTreePath *path;
- gboolean done = FALSE;
-
- priv = GET_PRIV (expander);
-
- if (priv->animation_expanding) {
- if (priv->animation_style == GTK_EXPANDER_SEMI_COLLAPSED)
- priv->animation_style = GTK_EXPANDER_SEMI_EXPANDED;
- else if (priv->animation_style == GTK_EXPANDER_SEMI_EXPANDED) {
- priv->animation_style = GTK_EXPANDER_EXPANDED;
- done = TRUE;
- }
- } else {
- if (priv->animation_style == GTK_EXPANDER_SEMI_EXPANDED)
- priv->animation_style = GTK_EXPANDER_SEMI_COLLAPSED;
- else if (priv->animation_style == GTK_EXPANDER_SEMI_COLLAPSED) {
- priv->animation_style = GTK_EXPANDER_COLLAPSED;
- done = TRUE;
- }
- }
-
- path = gtk_tree_row_reference_get_path (priv->animation_node);
- invalidate_node (priv->animation_view, path);
- gtk_tree_path_free (path);
-
- if (done) {
- gtk_tree_row_reference_free (priv->animation_node);
- priv->animation_node = NULL;
- priv->animation_timeout = 0;
- }
-
- return !done;
-}
-
-static gboolean
-animation_timeout (gpointer data)
-{
- gboolean retval;
-
- GDK_THREADS_ENTER ();
-
- retval = do_animation (data);
-
- GDK_THREADS_LEAVE ();
-
- return retval;
-}
-
-void
-gossip_cell_renderer_expander_start_animation (GossipCellRendererExpander *expander,
- GtkTreeView *tree_view,
- GtkTreePath *path,
- gboolean expanding)
-{
- GossipCellRendererExpanderPriv *priv;
- GtkSettings *settings;
- gboolean animate;
-
- settings = gtk_widget_get_settings (GTK_WIDGET (tree_view));
- if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings), "gtk-enable-animations")) {
- g_object_get (settings,
- "gtk-enable-animations", &animate,
- NULL);
- } else {
- animate = FALSE;
- }
-
- if (animate == FALSE) {
- return;
- }
-
- priv = GET_PRIV (expander);
- if (expanding) {
- priv->animation_style = GTK_EXPANDER_SEMI_COLLAPSED;
- } else {
- priv->animation_style = GTK_EXPANDER_SEMI_EXPANDED;
- }
-
- invalidate_node (tree_view, path);
-
- if (priv->animation_timeout != 0) {
- g_source_remove (priv->animation_timeout);
- gtk_tree_row_reference_free (priv->animation_node);
- }
-
- priv->animation_expanding = expanding;
- priv->animation_view = tree_view;
- priv->animation_node = gtk_tree_row_reference_new (gtk_tree_view_get_model (tree_view), path);
- priv->animation_timeout = g_timeout_add (50, animation_timeout, expander);
+ gtk_render_expander (gtk_widget_get_style_context (widget),
+ cr,
+ cell_area->x + x_offset + xpad,
+ cell_area->y + y_offset + ypad,
+ priv->expander_size,
+ priv->expander_size);
}
static gboolean
@@ -465,14 +309,13 @@ gossip_cell_renderer_expander_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path_string,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GossipCellRendererExpander *expander;
GossipCellRendererExpanderPriv *priv;
GtkTreePath *path;
- gboolean expanding;
gboolean in_cell;
int mouse_x;
int mouse_y;
@@ -503,25 +346,14 @@ gossip_cell_renderer_expander_activate (GtkCellRenderer *cell,
return FALSE;
}
-#if 0
- if (gtk_tree_path_get_depth (path) > 1) {
- gtk_tree_path_free (path);
- return TRUE;
- }
-#endif
-
if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (widget), path)) {
gtk_tree_view_collapse_row (GTK_TREE_VIEW (widget), path);
- expanding = FALSE;
+ priv->style_flags &= ~(GTK_STATE_FLAG_ACTIVE);
} else {
gtk_tree_view_expand_row (GTK_TREE_VIEW (widget), path, FALSE);
- expanding = TRUE;
+ priv->style_flags |= ~(GTK_STATE_FLAG_ACTIVE);
}
- gossip_cell_renderer_expander_start_animation (expander,
- GTK_TREE_VIEW (widget),
- path,
- expanding);
gtk_tree_path_free (path);
return TRUE;
diff --git a/widgets/gossip-cell-renderer-expander.h b/widgets/gossip-cell-renderer-expander.h
index 692bffb..b512205 100644
--- a/widgets/gossip-cell-renderer-expander.h
+++ b/widgets/gossip-cell-renderer-expander.h
@@ -52,11 +52,6 @@ struct _GossipCellRendererExpanderClass {
GType gossip_cell_renderer_expander_get_type (void) G_GNUC_CONST;
GtkCellRenderer *gossip_cell_renderer_expander_new (void);
-void gossip_cell_renderer_expander_start_animation (GossipCellRendererExpander *expander,
- GtkTreeView *widget,
- GtkTreePath *path,
- gboolean expanding);
-
G_END_DECLS
#endif /* __GOSSIP_CELL_RENDERER_EXPANDER_H__ */
diff --git a/widgets/rb-cell-renderer-pixbuf.c b/widgets/rb-cell-renderer-pixbuf.c
index 52a1476..e06be67 100644
--- a/widgets/rb-cell-renderer-pixbuf.c
+++ b/widgets/rb-cell-renderer-pixbuf.c
@@ -26,7 +26,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "gseal-gtk-compat.h"
#include "rb-cell-renderer-pixbuf.h"
#include "rb-cut-and-paste-code.h"
@@ -42,24 +41,23 @@ static void rb_cell_renderer_pixbuf_init (RBCellRendererPixbuf *cellt
static void rb_cell_renderer_pixbuf_class_init (RBCellRendererPixbufClass *class);
static void rb_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
- GdkRectangle *rectangle,
+ const GdkRectangle *rectangle,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height);
static void rb_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
- GdkWindow *window,
+ cairo_t *cr,
GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
guint flags);
static gboolean rb_cell_renderer_pixbuf_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags);
enum {
@@ -198,10 +196,11 @@ rb_cell_renderer_pixbuf_new (void)
return GTK_CELL_RENDERER (g_object_new (rb_cell_renderer_pixbuf_get_type (), NULL, NULL));
}
+/* XXX implement get_preferred_width/height/height_for_width/width_for_height */
static void
rb_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
- GdkRectangle *cell_area,
+ const GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
@@ -253,11 +252,10 @@ rb_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
static void
rb_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
- GdkWindow *window,
+ cairo_t *cr,
GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
guint flags)
{
@@ -298,11 +296,9 @@ rb_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
pix_rect.height -= ypad * 2;
if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect)) {
- cairo_t *cr = gdk_cairo_create (window);
gdk_cairo_set_source_pixbuf (cr, cellpixbuf->pixbuf, pix_rect.x, pix_rect.y);
gdk_cairo_rectangle (cr, &draw_rect);
cairo_paint (cr);
- cairo_destroy (cr);
}
}
@@ -311,8 +307,8 @@ rb_cell_renderer_pixbuf_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
int mouse_x, mouse_y;
diff --git a/widgets/rb-cell-renderer-rating.c b/widgets/rb-cell-renderer-rating.c
index 005f18f..1c84ec0 100644
--- a/widgets/rb-cell-renderer-rating.c
+++ b/widgets/rb-cell-renderer-rating.c
@@ -29,7 +29,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "gseal-gtk-compat.h"
#include "rb-cell-renderer-rating.h"
#include "rb-marshal.h"
#include "rb-rating-helper.h"
@@ -46,24 +45,23 @@ static void rb_cell_renderer_rating_init (RBCellRendererRating *celltext);
static void rb_cell_renderer_rating_class_init (RBCellRendererRatingClass *class);
static void rb_cell_renderer_rating_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
- GdkRectangle *rectangle,
+ const GdkRectangle *rectangle,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height);
static void rb_cell_renderer_rating_render (GtkCellRenderer *cell,
- GdkWindow *window,
+ cairo_t *cr,
GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags);
static gboolean rb_cell_renderer_rating_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags);
static void rb_cell_renderer_rating_finalize (GObject *object);
@@ -231,10 +229,11 @@ rb_cell_renderer_rating_new ()
return GTK_CELL_RENDERER (g_object_new (rb_cell_renderer_rating_get_type (), NULL, NULL));
}
+/* XXX implement get_preferred_height/width/height_for_width/width_for_height */
static void
rb_cell_renderer_rating_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
- GdkRectangle *cell_area,
+ const GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
@@ -262,11 +261,10 @@ rb_cell_renderer_rating_get_size (GtkCellRenderer *cell,
static void
rb_cell_renderer_rating_render (GtkCellRenderer *cell,
- GdkWindow *window,
+ cairo_t *cr,
GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
@@ -295,7 +293,7 @@ rb_cell_renderer_rating_render (GtkCellRenderer *cell,
selected = (flags & GTK_CELL_RENDERER_SELECTED);
- rb_rating_render_stars (widget, window, cell_class->priv->pixbufs,
+ rb_rating_render_stars (widget, cr, cell_class->priv->pixbufs,
draw_rect.x - pix_rect.x,
draw_rect.y - pix_rect.y,
draw_rect.x, draw_rect.y,
@@ -307,8 +305,8 @@ rb_cell_renderer_rating_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
int mouse_x, mouse_y;
diff --git a/widgets/rb-entry-view.c b/widgets/rb-entry-view.c
index 15fa8b5..d0b0893 100644
--- a/widgets/rb-entry-view.c
+++ b/widgets/rb-entry-view.c
@@ -103,7 +103,6 @@
#include "eel-gconf-extensions.h"
#include "rb-shell-player.h"
#include "rb-cut-and-paste-code.h"
-#include "gseal-gtk-compat.h"
static const GtkTargetEntry rb_entry_view_drag_types[] = {
{ "application/x-rhythmbox-entry", 0, 0 },
diff --git a/widgets/rb-library-browser.c b/widgets/rb-library-browser.c
index e1a98e7..8b19bba 100644
--- a/widgets/rb-library-browser.c
+++ b/widgets/rb-library-browser.c
@@ -35,7 +35,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "gseal-gtk-compat.h"
#include "rb-library-browser.h"
#include "rb-preferences.h"
#include "eel-gconf-extensions.h"
diff --git a/widgets/rb-query-creator-properties.c b/widgets/rb-query-creator-properties.c
index 91f8526..c877835 100644
--- a/widgets/rb-query-creator-properties.c
+++ b/widgets/rb-query-creator-properties.c
@@ -35,7 +35,6 @@
#include "rhythmdb.h"
#include "rb-query-creator-private.h"
#include "rb-rating.h"
-#include "gseal-gtk-compat.h"
const RBQueryCreatorPropertyType string_property_type;
const RBQueryCreatorPropertyType escaped_string_property_type;
diff --git a/widgets/rb-query-creator.c b/widgets/rb-query-creator.c
index f7f7c26..f7bf908 100644
--- a/widgets/rb-query-creator.c
+++ b/widgets/rb-query-creator.c
@@ -41,7 +41,6 @@
#include "rb-preferences.h"
#include "rb-builder-helpers.h"
#include "rb-util.h"
-#include "gseal-gtk-compat.h"
static void rb_query_creator_class_init (RBQueryCreatorClass *klass);
static void rb_query_creator_constructed (GObject *object);
diff --git a/widgets/rb-rating-helper.c b/widgets/rb-rating-helper.c
index 530715e..182c254 100644
--- a/widgets/rb-rating-helper.c
+++ b/widgets/rb-rating-helper.c
@@ -33,7 +33,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include "gseal-gtk-compat.h"
#include "rb-cut-and-paste-code.h"
#include "rb-rating-helper.h"
#include "rb-stock-icons.h"
@@ -143,7 +142,7 @@ rb_rating_pixbufs_new (void)
/**
* rb_rating_render_stars:
* @widget: a #GtkWidget to render on behalf of
- * @window: the #GdkWindow being rendered to
+ * @cr: cairo context to render into
* @pixbufs: a #RBRatingPixbufs structure
* @x: source X coordinate within the rating pixbufs (usually 0)
* @y: source Y coordinate within the rating pixbufs (usually 0)
@@ -159,7 +158,7 @@ rb_rating_pixbufs_new (void)
*/
gboolean
rb_rating_render_stars (GtkWidget *widget,
- GdkWindow *window,
+ cairo_t *cr,
RBRatingPixbufs *pixbufs,
int x,
int y,
@@ -170,22 +169,19 @@ rb_rating_render_stars (GtkWidget *widget,
{
int i, icon_width;
gboolean rtl;
- cairo_t *cr;
g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (pixbufs != NULL, FALSE);
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, NULL);
- cr = gdk_cairo_create (window);
for (i = 0; i < RB_RATING_MAX_SCORE; i++) {
GdkPixbuf *buf;
GtkStateType state;
- GtkStyle *style;
gint star_offset;
int offset;
+ GdkRGBA color;
if (selected == TRUE) {
offset = 0;
@@ -212,11 +208,11 @@ rb_rating_render_stars (GtkWidget *widget,
return FALSE;
}
- style = gtk_widget_get_style (widget);
+ gtk_style_context_get_color (gtk_widget_get_style_context (widget), state, &color);
buf = eel_create_colorized_pixbuf (buf,
- (style->text[state].red + offset) >> 8,
- (style->text[state].green + offset) >> 8,
- (style->text[state].blue + offset) >> 8);
+ ((guint16)(color.red * G_MAXUINT16) + offset) >> 8,
+ ((guint16)(color.green * G_MAXUINT16) + offset) >> 8,
+ ((guint16)(color.blue * G_MAXUINT16) + offset) >> 8);
if (buf == NULL) {
return FALSE;
}
@@ -231,7 +227,6 @@ rb_rating_render_stars (GtkWidget *widget,
cairo_paint (cr);
g_object_unref (buf);
}
- cairo_destroy (cr);
return TRUE;
}
diff --git a/widgets/rb-rating-helper.h b/widgets/rb-rating-helper.h
index d83e13c..f49c66e 100644
--- a/widgets/rb-rating-helper.h
+++ b/widgets/rb-rating-helper.h
@@ -35,7 +35,7 @@ typedef struct _RBRatingPixbufs RBRatingPixbufs;
/* Number of stars */
#define RB_RATING_MAX_SCORE 5
-gboolean rb_rating_render_stars (GtkWidget *widget, GdkWindow *window,
+gboolean rb_rating_render_stars (GtkWidget *widget, cairo_t *cr,
RBRatingPixbufs *pixbufs,
int x, int y,
int x_offset, int y_offset,
diff --git a/widgets/rb-rating.c b/widgets/rb-rating.c
index ce0fe58..d8857d1 100644
--- a/widgets/rb-rating.c
+++ b/widgets/rb-rating.c
@@ -37,8 +37,6 @@
#include "rb-stock-icons.h"
#include "rb-cut-and-paste-code.h"
-#include "gseal-gtk-compat.h"
-
/* Offset at the beggining of the widget */
#define X_OFFSET 0
@@ -57,15 +55,14 @@ static void rb_rating_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec);
static void rb_rating_realize (GtkWidget *widget);
-static void rb_rating_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static gboolean rb_rating_expose (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean rb_rating_draw (GtkWidget *widget, cairo_t *cr);
static gboolean rb_rating_focus (GtkWidget *widget, GtkDirectionType direction);
static gboolean rb_rating_set_rating_cb (RBRating *rating, gdouble score);
static gboolean rb_rating_adjust_rating_cb (RBRating *rating, gdouble adjust);
static gboolean rb_rating_button_press_cb (GtkWidget *widget,
GdkEventButton *event);
+static void rb_rating_get_preferred_width (GtkWidget *widget, int *minimum_width, int *natural_width);
+static void rb_rating_get_preferred_height (GtkWidget *widget, int *minimum_height, int *natural_height);
struct _RBRatingPrivate
{
@@ -114,8 +111,9 @@ rb_rating_class_init (RBRatingClass *klass)
object_class->set_property = rb_rating_set_property;
widget_class->realize = rb_rating_realize;
- widget_class->expose_event = rb_rating_expose;
- widget_class->size_request = rb_rating_size_request;
+ widget_class->draw = rb_rating_draw;
+ widget_class->get_preferred_width = rb_rating_get_preferred_width;
+ widget_class->get_preferred_height = rb_rating_get_preferred_height;
widget_class->button_press_event = rb_rating_button_press_cb;
widget_class->focus = rb_rating_focus;
@@ -184,19 +182,19 @@ rb_rating_class_init (RBRatingClass *klass)
G_TYPE_DOUBLE);
binding_set = gtk_binding_set_by_class (klass);
- gtk_binding_entry_add_signal (binding_set, GDK_Home, 0, "set-rating", 1, G_TYPE_DOUBLE, 0.0);
- gtk_binding_entry_add_signal (binding_set, GDK_End, 0, "set-rating", 1, G_TYPE_DOUBLE, (double)RB_RATING_MAX_SCORE);
-
- gtk_binding_entry_add_signal (binding_set, GDK_equal, 0, "adjust-rating", 1, G_TYPE_DOUBLE, 1.0);
- gtk_binding_entry_add_signal (binding_set, GDK_plus, 0, "adjust-rating", 1, G_TYPE_DOUBLE, 1.0);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Add, 0, "adjust-rating", 1, G_TYPE_DOUBLE, 1.0);
- gtk_binding_entry_add_signal (binding_set, GDK_Right, 0, "adjust-rating", 1, G_TYPE_DOUBLE, 1.0);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Right, 0, "adjust-rating", 1, G_TYPE_DOUBLE, 1.0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Home, 0, "set-rating", 1, G_TYPE_DOUBLE, 0.0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_End, 0, "set-rating", 1, G_TYPE_DOUBLE, (double)RB_RATING_MAX_SCORE);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_equal, 0, "adjust-rating", 1, G_TYPE_DOUBLE, 1.0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_plus, 0, "adjust-rating", 1, G_TYPE_DOUBLE, 1.0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Add, 0, "adjust-rating", 1, G_TYPE_DOUBLE, 1.0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Right, 0, "adjust-rating", 1, G_TYPE_DOUBLE, 1.0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Right, 0, "adjust-rating", 1, G_TYPE_DOUBLE, 1.0);
- gtk_binding_entry_add_signal (binding_set, GDK_minus, 0, "adjust-rating", 1, G_TYPE_DOUBLE, -1.0);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Subtract, 0, "adjust-rating", 1, G_TYPE_DOUBLE, -1.0);
- gtk_binding_entry_add_signal (binding_set, GDK_Left, 0, "adjust-rating", 1, G_TYPE_DOUBLE, -1.0);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Left, 0, "adjust-rating", 1, G_TYPE_DOUBLE, -1.0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_minus, 0, "adjust-rating", 1, G_TYPE_DOUBLE, -1.0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Subtract, 0, "adjust-rating", 1, G_TYPE_DOUBLE, -1.0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Left, 0, "adjust-rating", 1, G_TYPE_DOUBLE, -1.0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Left, 0, "adjust-rating", 1, G_TYPE_DOUBLE, -1.0);
g_type_class_add_private (klass, sizeof (RBRatingPrivate));
}
@@ -210,6 +208,9 @@ rb_rating_init (RBRating *rating)
rating->priv->pixbufs = rb_rating_pixbufs_new ();
rb_rating_set_accessible_name (GTK_WIDGET (rating), 0.0);
+
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (rating)),
+ GTK_STYLE_CLASS_ENTRY);
}
static void
@@ -304,7 +305,6 @@ static void
rb_rating_realize (GtkWidget *widget)
{
GtkAllocation allocation;
- GtkStyle *style;
GdkWindowAttr attributes;
GdkWindow *window;
int attributes_mask;
@@ -321,81 +321,93 @@ rb_rating_realize (GtkWidget *widget)
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK;
attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget);
gtk_widget_set_can_focus (widget, TRUE);
-
- style = gtk_style_attach (gtk_widget_get_style (widget), window);
- gtk_widget_set_style (widget, style);
- gtk_style_set_background (style, window, GTK_STATE_ACTIVE);
}
static void
-rb_rating_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+rb_rating_get_preferred_width (GtkWidget *widget, int *minimum_width, int *natural_width)
{
int icon_size;
+ int width;
- g_return_if_fail (requisition != NULL);
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_size, NULL);
+ width = RB_RATING_MAX_SCORE * icon_size + X_OFFSET;
+ if (minimum_width != NULL)
+ *minimum_width = width;
+ if (natural_width != NULL)
+ *natural_width = width;
+}
+
+static void
+rb_rating_get_preferred_height (GtkWidget *widget, int *minimum_height, int *natural_height)
+{
+ int icon_size;
+ int height;
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_size, NULL);
- requisition->width = RB_RATING_MAX_SCORE * icon_size + X_OFFSET;
- requisition->height = icon_size + Y_OFFSET * 2;
+ height = icon_size + Y_OFFSET * 2;
+ if (minimum_height != NULL)
+ *minimum_height = height;
+ if (natural_height != NULL)
+ *natural_height = height;
}
static gboolean
-rb_rating_expose (GtkWidget *widget,
- GdkEventExpose *event)
+rb_rating_draw (GtkWidget *widget, cairo_t *cr)
{
- GdkWindow *window;
gboolean ret;
+ GdkWindow *window;
RBRating *rating;
int x = 0;
int y = 0;
int width;
int height;
- int focus_width;
g_return_val_if_fail (RB_IS_RATING (widget), FALSE);
- if (!gtk_widget_is_drawable (widget)) {
- return FALSE;
- }
ret = FALSE;
rating = RB_RATING (widget);
window = gtk_widget_get_window (widget);
-#if GTK_CHECK_VERSION(2, 23, 0)
width = gdk_window_get_width (window);
height = gdk_window_get_height (window);
-#else
- gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
-#endif
- gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
+ gtk_render_background (gtk_widget_get_style_context (widget),
+ cr,
+ x, y,
+ width, height);
+ gtk_render_frame (gtk_widget_get_style_context (widget),
+ cr,
+ x, y,
+ width, height);
+
if (gtk_widget_has_focus (widget)) {
+ int focus_width;
+ gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
+
x += focus_width;
y += focus_width;
width -= 2 * focus_width;
height -= 2 * focus_width;
- }
- gtk_paint_flat_box (gtk_widget_get_style (widget), window,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- NULL, widget, "entry_bg", x, y,
- width, height);
+ gtk_render_focus (gtk_widget_get_style_context (widget),
+ cr,
+ x, y,
+ width, height);
+ }
/* draw the stars */
if (rating->priv->pixbufs != NULL) {
ret = rb_rating_render_stars (widget,
- window,
+ cr,
rating->priv->pixbufs,
0, 0,
X_OFFSET, Y_OFFSET,
diff --git a/widgets/rb-search-entry.c b/widgets/rb-search-entry.c
index 71b1200..3aa4646 100644
--- a/widgets/rb-search-entry.c
+++ b/widgets/rb-search-entry.c
@@ -265,22 +265,36 @@ rb_search_entry_set_text (RBSearchEntry *entry, const char *text)
static void
rb_search_entry_check_style (RBSearchEntry *entry)
{
- static const GdkColor bg_colour = { 0, 0xf7f7, 0xf7f7, 0xbebe }; /* yellow-ish */
- static const GdkColor fg_colour = { 0, 0, 0, 0 }; /* black. */
+ static const GdkRGBA fallback_bg_color = { 0.9686, 0.9686, 0.7451, 1.0}; /* yellow-ish */
+ static const GdkRGBA fallback_fg_color = { 0, 0, 0, 1.0 }; /* black. */
+ GdkRGBA bg_color = {0,};
+ GdkRGBA fg_color = {0,};
const gchar* text;
if (entry->priv->is_a11y_theme)
return;
+ /* allow user style to override the colors */
+ if (gtk_style_context_lookup_color (gtk_widget_get_style_context (GTK_WIDGET (entry)),
+ "rb-search-active-bg",
+ &bg_color) == FALSE) {
+ bg_color = fallback_bg_color;
+ }
+ if (gtk_style_context_lookup_color (gtk_widget_get_style_context (GTK_WIDGET (entry)),
+ "rb-search-active-fg",
+ &fg_color) == FALSE) {
+ fg_color = fallback_fg_color;
+ }
+
text = gtk_entry_get_text (GTK_ENTRY (entry->priv->entry));
if (text && *text) {
- gtk_widget_modify_text (entry->priv->entry, GTK_STATE_NORMAL, &fg_colour);
- gtk_widget_modify_base (entry->priv->entry, GTK_STATE_NORMAL, &bg_colour);
- gtk_widget_modify_cursor (entry->priv->entry, &fg_colour, &fg_colour);
+ gtk_widget_override_color (entry->priv->entry, GTK_STATE_NORMAL, &fg_color);
+ gtk_widget_override_background_color (entry->priv->entry, GTK_STATE_NORMAL, &bg_color);
+ gtk_widget_override_cursor (entry->priv->entry, &fg_color, &fg_color);
} else {
- gtk_widget_modify_text (entry->priv->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_base (entry->priv->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_cursor (entry->priv->entry, NULL, NULL);
+ gtk_widget_override_color (entry->priv->entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_override_background_color (entry->priv->entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_override_cursor (entry->priv->entry, NULL, NULL);
}
gtk_widget_queue_draw (GTK_WIDGET (entry));
diff --git a/widgets/rb-segmented-bar.c b/widgets/rb-segmented-bar.c
index c947f62..f41c1aa 100644
--- a/widgets/rb-segmented-bar.c
+++ b/widgets/rb-segmented-bar.c
@@ -39,12 +39,9 @@
#define MINIMUM_HEIGHT 26
static void rb_segmented_bar_finalize (GObject *object);
-static void rb_segmented_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
static void rb_segmented_bar_size_allocate(GtkWidget *widget,
GtkAllocation *allocation);
-static gboolean rb_segmented_bar_expose (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean rb_segmented_bar_draw (GtkWidget *widget, cairo_t *context);
static void rb_segmented_bar_get_property (GObject *object, guint param_id,
GValue *value, GParamSpec *pspec);
static void rb_segmented_bar_set_property (GObject *object, guint param_id,
@@ -52,6 +49,12 @@ static void rb_segmented_bar_set_property (GObject *object, guint param_id,
static gchar *rb_segmented_bar_default_value_formatter (gdouble percent,
gpointer data);
+static void rb_segmented_bar_get_preferred_height (GtkWidget *widget,
+ int *minimum_height,
+ int *natural_height);
+static void rb_segmented_bar_get_preferred_width (GtkWidget *widget,
+ int *minimum_width,
+ int *natural_width);
static void compute_layout_size (RBSegmentedBar *bar);
@@ -153,8 +156,9 @@ rb_segmented_bar_class_init (RBSegmentedBarClass *klass)
object_class->get_property = rb_segmented_bar_get_property;
object_class->set_property = rb_segmented_bar_set_property;
- widget_class->expose_event = rb_segmented_bar_expose;
- widget_class->size_request = rb_segmented_bar_size_request;
+ widget_class->draw = rb_segmented_bar_draw;
+ widget_class->get_preferred_height = rb_segmented_bar_get_preferred_height;
+ widget_class->get_preferred_width = rb_segmented_bar_get_preferred_width;
widget_class->size_allocate = rb_segmented_bar_size_allocate;
widget_class->get_accessible = rb_segmented_bar_get_accessible;
@@ -271,29 +275,45 @@ rb_segmented_bar_default_value_formatter (gdouble percent,
}
static void
-rb_segmented_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+rb_segmented_bar_get_preferred_height (GtkWidget *widget, int *minimum_height, int *natural_height)
{
RBSegmentedBarPrivate *priv;
- int real_height;
+ int height;
- g_return_if_fail (requisition != NULL);
priv = RB_SEGMENTED_BAR_GET_PRIVATE (RB_SEGMENTED_BAR (widget));
-
if (priv->reflect) {
- real_height = MINIMUM_HEIGHT*1.75;
+ height = MINIMUM_HEIGHT * 1.75;
} else {
- real_height = MINIMUM_HEIGHT;
+ height = MINIMUM_HEIGHT;
}
+
if (priv->show_labels) {
compute_layout_size (RB_SEGMENTED_BAR (widget));
- requisition->height = MAX (MINIMUM_HEIGHT + priv->bar_label_spacing + priv->layout_height,
- real_height);
- } else {
- requisition->height = real_height;
+ height = MAX (MINIMUM_HEIGHT + priv->bar_label_spacing + priv->layout_height, height);
}
- requisition->width = MAX (priv->layout_width, 200);
+
+ if (minimum_height)
+ *minimum_height = height;
+ if (natural_height)
+ *natural_height = height;
+}
+
+static void
+rb_segmented_bar_get_preferred_width (GtkWidget *widget, int *minimum_width, int *natural_width)
+{
+ RBSegmentedBarPrivate *priv;
+ int width;
+
+ priv = RB_SEGMENTED_BAR_GET_PRIVATE (RB_SEGMENTED_BAR (widget));
+
+ compute_layout_size (RB_SEGMENTED_BAR (widget));
+ width = MAX (priv->layout_width, 200);
+
+ if (minimum_width)
+ *minimum_width = width;
+ if (natural_width)
+ *natural_width = width;
}
static PangoLayout *create_adapt_layout (GtkWidget *widget, PangoLayout *layout,
@@ -660,10 +680,9 @@ static void rb_segmented_bar_render_labels (RBSegmentedBar *bar,
cairo_t *context)
{
RBSegmentedBarPrivate *priv;
- GtkStyle *style;
PangoLayout *layout;
Color text_color;
- GdkColor *gdk_color;
+ GdkRGBA gdk_color;
gboolean ltr = TRUE;
int x = 0;
GList *it;
@@ -673,17 +692,18 @@ static void rb_segmented_bar_render_labels (RBSegmentedBar *bar,
if (priv->segments == NULL) {
return;
}
- style = gtk_widget_get_style (GTK_WIDGET (bar));
- gdk_color = &style->fg[gtk_widget_get_state (GTK_WIDGET (bar))];
+ gtk_style_context_get_color (gtk_widget_get_style_context (GTK_WIDGET (bar)),
+ gtk_widget_get_state (GTK_WIDGET (bar)),
+ &gdk_color);
if (gtk_widget_get_direction (GTK_WIDGET (bar)) == GTK_TEXT_DIR_RTL) {
ltr = FALSE;
x = priv->layout_width;
}
- text_color.red = gdk_color->red / 65535.0;
- text_color.green = gdk_color->green / 65535.0;
- text_color.blue = gdk_color->blue / 65535.0;
+ text_color.red = gdk_color.red;
+ text_color.green = gdk_color.green;
+ text_color.blue = gdk_color.blue;
text_color.alpha = 1.0;
layout = NULL;
for (it = priv->segments; it != NULL; it = it->next) {
@@ -758,25 +778,23 @@ static void rb_segmented_bar_render_labels (RBSegmentedBar *bar,
}
static gboolean
-rb_segmented_bar_expose (GtkWidget *widget,
- GdkEventExpose *event)
+rb_segmented_bar_draw (GtkWidget *widget, cairo_t *context)
{
RBSegmentedBar *bar;
RBSegmentedBarPrivate *priv;
GtkAllocation allocation;
- cairo_t *context;
cairo_pattern_t *bar_pattern;
g_return_val_if_fail (RB_IS_SEGMENTED_BAR (widget), FALSE);
+ /* what?
if (gtk_widget_is_drawable (widget) == FALSE) {
return FALSE;
}
+ */
bar = RB_SEGMENTED_BAR (widget);
priv = RB_SEGMENTED_BAR_GET_PRIVATE (bar);
- context = gdk_cairo_create (GDK_DRAWABLE (gtk_widget_get_window (widget)));
-
if (priv->reflect) {
cairo_push_group (context);
}
@@ -849,7 +867,6 @@ rb_segmented_bar_expose (GtkWidget *widget,
rb_segmented_bar_render_labels (bar, context);
}
cairo_pattern_destroy (bar_pattern);
- cairo_destroy (context);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]