[Xfce4-commits] <thunar:nick/gtk3> More gtk3 porting.
Nick Schermer
noreply at xfce.org
Tue May 8 19:48:01 CEST 2012
Updating branch refs/heads/nick/gtk3
to 8e9737cbbe4d9df7dcd8aa1951d6b5a15e9ea75b (commit)
from 7e71abb26054cb87af2640b9308beef4ec005a3f (commit)
commit 8e9737cbbe4d9df7dcd8aa1951d6b5a15e9ea75b
Author: Nick Schermer <nick at xfce.org>
Date: Tue May 8 19:46:17 2012 +0200
More gtk3 porting.
thunar/thunar-abstract-icon-view.c | 25 ++---
thunar/thunar-icon-renderer.c | 100 ++++++++--------
thunar/thunar-location-entry.c | 9 +-
thunar/thunar-path-entry.c | 189 +++++++++++++++++-------------
thunar/thunar-preferences-dialog.c | 60 +++++-----
thunar/thunar-properties-dialog.c | 2 +-
thunar/thunar-renamer-dialog.c | 24 ++--
thunar/thunar-session-client.c | 4 +-
thunar/thunar-shortcuts-icon-renderer.c | 11 +-
thunar/thunar-shortcuts-view.c | 6 +-
thunar/thunar-standard-view.c | 19 ++-
thunar/thunar-text-renderer.c | 2 +-
thunar/thunar-throbber.c | 69 +++++++-----
thunar/thunar-tree-view.c | 10 +-
thunar/thunar-window.c | 4 +-
15 files changed, 291 insertions(+), 243 deletions(-)
diff --git a/thunar/thunar-abstract-icon-view.c b/thunar/thunar-abstract-icon-view.c
index 2ad3ab6..50c8e2c 100644
--- a/thunar/thunar-abstract-icon-view.c
+++ b/thunar/thunar-abstract-icon-view.c
@@ -75,8 +75,8 @@ static gboolean thunar_abstract_icon_view_button_press_event (ExoIconView
static gboolean thunar_abstract_icon_view_button_release_event (ExoIconView *view,
GdkEventButton *event,
ThunarAbstractIconView *abstract_icon_view);
-static gboolean thunar_abstract_icon_view_expose_event (ExoIconView *view,
- GdkEventExpose *event,
+static gboolean thunar_abstract_icon_view_draw (ExoIconView *view,
+ cairo_t *cr,
ThunarAbstractIconView *abstract_icon_view);
static gboolean thunar_abstract_icon_view_key_press_event (ExoIconView *view,
GdkEventKey *event,
@@ -548,8 +548,8 @@ thunar_abstract_icon_view_button_press_event (ExoIconView *view,
{
abstract_icon_view->priv->gesture_start_x = abstract_icon_view->priv->gesture_current_x = event->x;
abstract_icon_view->priv->gesture_start_y = abstract_icon_view->priv->gesture_current_y = event->y;
- abstract_icon_view->priv->gesture_expose_id = g_signal_connect_after (G_OBJECT (view), "expose-event",
- G_CALLBACK (thunar_abstract_icon_view_expose_event),
+ abstract_icon_view->priv->gesture_expose_id = g_signal_connect_after (G_OBJECT (view), "draw",
+ G_CALLBACK (thunar_abstract_icon_view_draw),
G_OBJECT (abstract_icon_view));
abstract_icon_view->priv->gesture_motion_id = g_signal_connect (G_OBJECT (view), "motion-notify-event",
G_CALLBACK (thunar_abstract_icon_view_motion_notify_event),
@@ -607,18 +607,14 @@ thunar_abstract_icon_view_button_release_event (ExoIconView *view,
static gboolean
-thunar_abstract_icon_view_expose_event (ExoIconView *view,
- GdkEventExpose *event,
- ThunarAbstractIconView *abstract_icon_view)
+thunar_abstract_icon_view_draw (ExoIconView *view,
+ cairo_t *cr,
+ ThunarAbstractIconView *abstract_icon_view)
{
GtkIconSet *stock_icon_set;
GtkAction *action = NULL;
-#if 0
- GdkPixbuf *stock_icon = NULL;
-#endif
gchar *stock_id;
GdkColor bg;
- cairo_t *cr;
_thunar_return_val_if_fail (EXO_IS_ICON_VIEW (view), FALSE);
_thunar_return_val_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view), FALSE);
@@ -627,15 +623,10 @@ thunar_abstract_icon_view_expose_event (ExoIconView *view,
_thunar_return_val_if_fail (abstract_icon_view->priv->gesture_release_id > 0, FALSE);
/* shade the abstract_icon view content while performing mouse gestures */
- cr = gdk_cairo_create (event->window);
-#if 0
- bg = GTK_WIDGET (view)->style->base[GTK_STATE_NORMAL];
-#endif
cairo_set_source_rgba (cr, bg.red / 65535.0, bg.green / 65535.0, bg.blue / 65535.0, 0.7);
- cairo_rectangle (cr, event->area.x, event->area.y, event->area.width, event->area.height);
+ /*TODO cairo_rectangle (cr, event->area.x, event->area.y, event->area.width, event->area.height); */
cairo_clip (cr);
cairo_paint (cr);
- cairo_destroy (cr);
/* determine the gesture action */
action = thunar_abstract_icon_view_gesture_action (abstract_icon_view);
diff --git a/thunar/thunar-icon-renderer.c b/thunar/thunar-icon-renderer.c
index a42ed77..530f992 100644
--- a/thunar/thunar-icon-renderer.c
+++ b/thunar/thunar-icon-renderer.c
@@ -50,19 +50,18 @@ static void thunar_icon_renderer_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
-static void thunar_icon_renderer_get_size (GtkCellRenderer *renderer,
+static void thunar_icon_renderer_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
- GdkRectangle *rectangle,
+ const GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height);
-static void thunar_icon_renderer_render (GtkCellRenderer *renderer,
- GdkWindow *window,
+static void thunar_icon_renderer_render (GtkCellRenderer *cell,
+ cairo_t *cr,
GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags);
@@ -160,8 +159,7 @@ static void
thunar_icon_renderer_init (ThunarIconRenderer *icon_renderer)
{
/* use 1px padding */
- GTK_CELL_RENDERER (icon_renderer)->xpad = 1;
- GTK_CELL_RENDERER (icon_renderer)->ypad = 1;
+ gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (icon_renderer), 1, 1);
}
@@ -262,31 +260,35 @@ thunar_icon_renderer_set_property (GObject *object,
-
static void
-thunar_icon_renderer_get_size (GtkCellRenderer *renderer,
- GtkWidget *widget,
- GdkRectangle *rectangle,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height)
+thunar_icon_renderer_get_size (GtkCellRenderer *renderer,
+ GtkWidget *widget,
+ const GdkRectangle *rectangle,
+ gint *x_offset,
+ gint *y_offset,
+ gint *width,
+ gint *height)
{
ThunarIconRenderer *icon_renderer = THUNAR_ICON_RENDERER (renderer);
+ gint xpad, ypad;
+ gfloat xalign, yalign;
if (rectangle != NULL)
{
+ gtk_cell_renderer_get_padding (renderer, &xpad, &ypad);
+ gtk_cell_renderer_get_alignment (renderer, &xalign, &yalign);
+
if (x_offset != NULL)
{
- *x_offset = ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? 1.0 - renderer->xalign : renderer->xalign)
+ *x_offset = ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? 1.0 - xalign : xalign)
* (rectangle->width - icon_renderer->size);
- *x_offset = MAX (*x_offset, 0) + renderer->xpad;
+ *x_offset = MAX (*x_offset, 0) + xpad;
}
if (y_offset != NULL)
{
- *y_offset = renderer->yalign * (rectangle->height - icon_renderer->size);
- *y_offset = MAX (*y_offset, 0) + renderer->ypad;
+ *y_offset = yalign * (rectangle->height - icon_renderer->size);
+ *y_offset = MAX (*y_offset, 0) + ypad;
}
}
else
@@ -299,22 +301,21 @@ thunar_icon_renderer_get_size (GtkCellRenderer *renderer,
}
if (G_LIKELY (width != NULL))
- *width = (gint) renderer->xpad * 2 + icon_renderer->size;
+ *width = xpad * 2 + icon_renderer->size;
if (G_LIKELY (height != NULL))
- *height = (gint) renderer->ypad * 2 + icon_renderer->size;
+ *height = ypad * 2 + icon_renderer->size;
}
-static void
-thunar_icon_renderer_render (GtkCellRenderer *renderer,
- GdkWindow *window,
- GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
- GtkCellRendererState flags)
+static void
+thunar_icon_renderer_render (GtkCellRenderer *renderer,
+ cairo_t *cr,
+ GtkWidget *widget,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
+ GtkCellRendererState flags)
{
ThunarClipboardManager *clipboard;
ThunarFileIconState icon_state;
@@ -325,7 +326,6 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer,
GdkRectangle emblem_area;
GdkRectangle icon_area;
GdkRectangle draw_area;
- GtkStateType state;
GdkPixbuf *emblem;
GdkPixbuf *icon;
GdkPixbuf *temp;
@@ -333,19 +333,22 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer,
GList *lp;
gint max_emblems;
gint position;
+ gboolean is_expanded;
+ GtkStyleContext *style_context;
if (G_UNLIKELY (icon_renderer->file == NULL))
return;
/* determine the icon state */
+ g_object_get (icon_renderer, "is-expanded", &is_expanded, NULL);
icon_state = (icon_renderer->drop_file != icon_renderer->file)
- ? renderer->is_expanded
+ ? is_expanded
? THUNAR_FILE_ICON_STATE_OPEN
: THUNAR_FILE_ICON_STATE_DEFAULT
: THUNAR_FILE_ICON_STATE_DROP;
/* load the main icon */
- icon_theme = gtk_icon_theme_get_for_screen (gdk_drawable_get_screen (window));
+ icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
icon_factory = thunar_icon_factory_get_for_icon_theme (icon_theme);
icon = thunar_icon_factory_load_file_icon (icon_factory, icon_renderer->file, icon_state, icon_renderer->size);
if (G_UNLIKELY (icon == NULL))
@@ -378,8 +381,11 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer,
icon_area.x = cell_area->x + (cell_area->width - icon_area.width) / 2;
icon_area.y = cell_area->y + (cell_area->height - icon_area.height) / 2;
+ style_context = gtk_widget_get_style_context (widget);
+ gtk_style_context_save (style_context);
+
/* check whether the icon is affected by the expose event */
- if (gdk_rectangle_intersect (expose_area, &icon_area, &draw_area))
+ if (gdk_rectangle_intersect (cell_area, &icon_area, &draw_area))
{
/* use a translucent icon to represent cutted and hidden files to the user */
clipboard = thunar_clipboard_manager_get_for_display (gtk_widget_get_display (widget));
@@ -404,10 +410,10 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer,
{
if ((flags & GTK_CELL_RENDERER_SELECTED) != 0)
{
- state = gtk_widget_has_focus (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE;
+ /* TODO state = gtk_widget_has_focus (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE;
temp = exo_gdk_pixbuf_colorize (icon, &widget->style->base[state]);
g_object_unref (G_OBJECT (icon));
- icon = temp;
+ icon = temp; */
}
if ((flags & GTK_CELL_RENDERER_PRELIT) != 0)
@@ -419,7 +425,8 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer,
}
/* check if we should render an insensitive icon */
- if (G_UNLIKELY (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !renderer->sensitive))
+ if (G_UNLIKELY (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE
+ || !gtk_cell_renderer_get_sensitive (renderer)))
{
/* allocate an icon source */
icon_source = gtk_icon_source_new ();
@@ -428,8 +435,7 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer,
gtk_icon_source_set_size (icon_source, GTK_ICON_SIZE_SMALL_TOOLBAR);
/* render the insensitive icon */
- temp = gtk_style_render_icon (widget->style, icon_source, gtk_widget_get_direction (widget),
- GTK_STATE_INSENSITIVE, -1, widget, "gtkcellrendererpixbuf");
+ temp = gtk_render_icon_pixbuf (style_context, icon_source, -1);
g_object_unref (G_OBJECT (icon));
icon = temp;
@@ -438,10 +444,7 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer,
}
/* render the invalid parts of the icon */
- gdk_draw_pixbuf (window, widget->style->black_gc, icon,
- draw_area.x - icon_area.x, draw_area.y - icon_area.y,
- draw_area.x, draw_area.y, draw_area.width, draw_area.height,
- GDK_RGB_DITHER_NORMAL, 0, 0);
+ gtk_render_icon (style_context, cr, icon, icon_area.x, icon_area.y);
}
/* release the file's icon */
@@ -518,12 +521,9 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer,
}
/* render the emblem */
- if (gdk_rectangle_intersect (expose_area, &emblem_area, &draw_area))
+ if (gdk_rectangle_intersect (cell_area, &emblem_area, &draw_area))
{
- gdk_draw_pixbuf (window, widget->style->black_gc, emblem,
- draw_area.x - emblem_area.x, draw_area.y - emblem_area.y,
- draw_area.x, draw_area.y, draw_area.width, draw_area.height,
- GDK_RGB_DITHER_NORMAL, 0, 0);
+ gtk_render_icon (style_context, cr, emblem, emblem_area.x, emblem_area.y);
}
/* release the emblem */
@@ -538,6 +538,8 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer,
}
}
+ gtk_style_context_restore (style_context);
+
/* release our reference on the icon factory */
g_object_unref (G_OBJECT (icon_factory));
}
diff --git a/thunar/thunar-location-entry.c b/thunar/thunar-location-entry.c
index 060107c..6212953 100644
--- a/thunar/thunar-location-entry.c
+++ b/thunar/thunar-location-entry.c
@@ -483,7 +483,7 @@ menu_position (GtkMenu *menu,
gtk_widget_get_preferred_size (GTK_WIDGET (entry), &entry_request, NULL);
gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_request, NULL);
- gdk_window_get_position (GTK_WIDGET (entry)->window, x, y);
+ gdk_window_get_position (gtk_widget_get_window (GTK_WIDGET (entry)), x, y);
*x += x0 + gtk_container_get_border_width (GTK_CONTAINER (entry));
*y += y0 + (entry_request.height - gtk_container_get_border_width (GTK_CONTAINER (entry)));
@@ -521,6 +521,7 @@ thunar_location_entry_button_clicked (GtkWidget *button,
gchar *volume_name;
gint icon_size;
gint width;
+ GtkAllocation alloc;
_thunar_return_if_fail (THUNAR_IS_LOCATION_ENTRY (location_entry));
_thunar_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
@@ -593,8 +594,10 @@ thunar_location_entry_button_clicked (GtkWidget *button,
}
/* make sure the menu has atleast the same width as the location entry */
- width = GTK_WIDGET (location_entry)->allocation.width - 2 * gtk_container_get_border_width (GTK_CONTAINER (location_entry));
- if (G_LIKELY (menu->allocation.width < width))
+ gtk_widget_get_allocation (GTK_WIDGET (location_entry), &alloc);
+ width = alloc.width - 2 * gtk_container_get_border_width (GTK_CONTAINER (location_entry));
+ gtk_widget_get_allocation (menu, &alloc);
+ if (G_LIKELY (alloc.width < width))
gtk_widget_set_size_request (menu, width, -1);
/* select the first visible or selectable item in the menu */
diff --git a/thunar/thunar-path-entry.c b/thunar/thunar-path-entry.c
index f9e77c4..ad935e9 100644
--- a/thunar/thunar-path-entry.c
+++ b/thunar/thunar-path-entry.c
@@ -60,7 +60,7 @@ enum
-static void thunar_path_entry_editable_init (GtkEditableClass *iface);
+static void thunar_path_entry_editable_init (GtkEditableInterface *iface);
static void thunar_path_entry_finalize (GObject *object);
static void thunar_path_entry_get_property (GObject *object,
guint prop_id,
@@ -70,16 +70,20 @@ static void thunar_path_entry_set_property (GObject
guint prop_id,
const GValue *value,
GParamSpec *pspec);
-static void thunar_path_entry_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+static void thunar_path_entry_get_preferred_width (GtkWidget *widget,
+ gint *normal_width,
+ gint *minimal_width);
+static void thunar_path_entry_get_preferred_height (GtkWidget *widget,
+ gint *normal_height,
+ gint *minimal_height);
static void thunar_path_entry_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void thunar_path_entry_realize (GtkWidget *widget);
static void thunar_path_entry_unrealize (GtkWidget *widget);
static gboolean thunar_path_entry_focus (GtkWidget *widget,
GtkDirectionType direction);
-static gboolean thunar_path_entry_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean thunar_path_entry_draw (GtkWidget *widget,
+ cairo_t *cr);
static gboolean thunar_path_entry_button_press_event (GtkWidget *widget,
GdkEventButton *event);
static gboolean thunar_path_entry_button_release_event (GtkWidget *widget,
@@ -165,7 +169,7 @@ static const GtkTargetEntry drag_targets[] =
-static GtkEditableClass *thunar_path_entry_editable_parent_iface;
+static GtkEditableInterface *thunar_path_entry_editable_parent_iface;
@@ -187,12 +191,13 @@ thunar_path_entry_class_init (ThunarPathEntryClass *klass)
gobject_class->set_property = thunar_path_entry_set_property;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->size_request = thunar_path_entry_size_request;
+ gtkwidget_class->get_preferred_width = thunar_path_entry_get_preferred_width;
+ gtkwidget_class->get_preferred_height = thunar_path_entry_get_preferred_height;
gtkwidget_class->size_allocate = thunar_path_entry_size_allocate;
gtkwidget_class->realize = thunar_path_entry_realize;
gtkwidget_class->unrealize = thunar_path_entry_unrealize;
gtkwidget_class->focus = thunar_path_entry_focus;
- gtkwidget_class->expose_event = thunar_path_entry_expose_event;
+ gtkwidget_class->draw = thunar_path_entry_draw;
gtkwidget_class->button_press_event = thunar_path_entry_button_press_event;
gtkwidget_class->button_release_event = thunar_path_entry_button_release_event;
gtkwidget_class->motion_notify_event = thunar_path_entry_motion_notify_event;
@@ -229,9 +234,9 @@ thunar_path_entry_class_init (ThunarPathEntryClass *klass)
static void
-thunar_path_entry_editable_init (GtkEditableClass *iface)
+thunar_path_entry_editable_init (GtkEditableInterface *iface)
{
- thunar_path_entry_editable_parent_iface = g_type_interface_peek_parent (iface);
+ thunar_path_entry_editable_parent_iface = iface;
iface->changed = thunar_path_entry_changed;
iface->do_insert_text = thunar_path_entry_do_insert_text;
@@ -364,26 +369,51 @@ thunar_path_entry_set_property (GObject *object,
-static void
-thunar_path_entry_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+static void
+thunar_path_entry_get_preferred_width (GtkWidget *widget,
+ gint *normal_width,
+ gint *minimal_width)
{
ThunarPathEntry *path_entry = THUNAR_PATH_ENTRY (widget);
- gint text_height;
gint icon_size;
gint xborder;
+ gint extra;
+
+ gtk_widget_style_get (GTK_WIDGET (widget),
+ "icon-size", &icon_size,
+ NULL);
+
+ (*GTK_WIDGET_CLASS (thunar_path_entry_parent_class)->get_preferred_height) (widget, normal_width, minimal_width);
+
+ thunar_path_entry_get_text_area_size (path_entry, &xborder, NULL, NULL, NULL);
+
+ extra = icon_size + xborder + 2 * ICON_MARGIN;
+
+ *normal_width += extra;
+ *minimal_width += extra;
+}
+
+
+
+static void
+thunar_path_entry_get_preferred_height (GtkWidget *widget,
+ gint *normal_height,
+ gint *minimal_height)
+{
+ ThunarPathEntry *path_entry = THUNAR_PATH_ENTRY (widget);
+ gint text_height;
+ gint icon_size;
gint yborder;
gtk_widget_style_get (GTK_WIDGET (widget),
"icon-size", &icon_size,
NULL);
- (*GTK_WIDGET_CLASS (thunar_path_entry_parent_class)->size_request) (widget, requisition);
+ (*GTK_WIDGET_CLASS (thunar_path_entry_parent_class)->get_preferred_height) (widget, normal_height, minimal_height);
- thunar_path_entry_get_text_area_size (path_entry, &xborder, &yborder, NULL, &text_height);
+ thunar_path_entry_get_text_area_size (path_entry, NULL, &yborder, NULL, &text_height);
- requisition->width += icon_size + xborder + 2 * ICON_MARGIN;
- requisition->height = 2 * yborder + MAX (icon_size + 2 * ICON_MARGIN, text_height);
+ *normal_height = *minimal_height = 2 * yborder + MAX (icon_size + 2 * ICON_MARGIN, text_height);
}
@@ -431,17 +461,17 @@ thunar_path_entry_size_allocate (GtkWidget *widget,
if (gtk_widget_get_realized (widget))
{
- gdk_window_move_resize (GTK_ENTRY (path_entry)->text_area,
+ /*gdk_window_move_resize (,
text_allocation.x,
text_allocation.y,
text_allocation.width,
text_allocation.height);
- gdk_window_move_resize (path_entry->icon_area,
+ gdk_window_move_resize (,
icon_allocation.x,
icon_allocation.y,
icon_allocation.width,
- icon_allocation.height);
+ icon_allocation.height);*/
}
}
@@ -457,7 +487,7 @@ thunar_path_entry_realize (GtkWidget *widget)
gint text_height;
gint icon_size;
gint spacing;
- GtkWidget allocation;
+ GtkAllocation allocation;
GtkRequisition requisition;
/* query the proper icon factory */
@@ -470,16 +500,15 @@ thunar_path_entry_realize (GtkWidget *widget)
(*GTK_WIDGET_CLASS (thunar_path_entry_parent_class)->realize) (widget);
- thunar_path_entry_get_text_area_size (path_entry, NULL, NULL, NULL, &text_height);
- spacing = widget->requisition.height -text_height;
-
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_get_preferred_size (widget, &requisition, NULL);
+ thunar_path_entry_get_text_area_size (path_entry, NULL, NULL, NULL, &text_height);
+ spacing = requisition.height -text_height;
+
attributes.window_type = GDK_WINDOW_CHILD;
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)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
@@ -491,11 +520,11 @@ thunar_path_entry_realize (GtkWidget *widget)
attributes.y = allocation.y + (allocation.height - requisition.height) / 2;
attributes.width = icon_size + spacing;
attributes.height = requisition.height;
- 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;
- path_entry->icon_area = gdk_window_new (widget->window, &attributes, attributes_mask);
+ path_entry->icon_area = gdk_window_new (gtk_widget_get_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (path_entry->icon_area, widget);
- gdk_window_set_background (path_entry->icon_area, &widget->style->base[gtk_widget_get_state (widget)]);
+ /* TODO gdk_window_set_background (path_entry->icon_area, &widget->style->base[gtk_widget_get_state (widget)]); */
gdk_window_show (path_entry->icon_area);
gtk_widget_queue_resize (widget);
@@ -538,11 +567,11 @@ thunar_path_entry_focus (GtkWidget *widget,
if ((direction == GTK_DIR_TAB_FORWARD) && (gtk_widget_has_focus (widget)) && !control_pressed)
{
/* if we don't have a completion and the cursor is at the end of the line, we just insert the common prefix */
- if (!path_entry->has_completion && gtk_editable_get_position (GTK_EDITABLE (path_entry)) == GTK_ENTRY (path_entry)->text_length)
+ if (!path_entry->has_completion && gtk_editable_get_position (GTK_EDITABLE (path_entry)) == gtk_entry_get_text_length (GTK_ENTRY (path_entry)))
thunar_path_entry_common_prefix_append (path_entry, FALSE);
/* place the cursor at the end */
- gtk_editable_set_position (GTK_EDITABLE (path_entry), GTK_ENTRY (path_entry)->text_length);
+ gtk_editable_set_position (GTK_EDITABLE (path_entry), -1);
return TRUE;
}
@@ -553,29 +582,33 @@ thunar_path_entry_focus (GtkWidget *widget,
static gboolean
-thunar_path_entry_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+thunar_path_entry_draw (GtkWidget *widget,
+ cairo_t *cr)
{
ThunarPathEntry *path_entry = THUNAR_PATH_ENTRY (widget);
GdkPixbuf *icon;
- gint icon_height;
- gint icon_width;
gint icon_size;
gint height;
gint width;
+ GtkStyleContext *style_context;
- if (event->window == path_entry->icon_area)
+ if (gtk_cairo_should_draw_window (cr,path_entry->icon_area))
{
+ style_context = gtk_widget_get_style_context (widget);
+ gtk_style_context_save (style_context);
+
gtk_widget_style_get (GTK_WIDGET (widget),
"icon-size", &icon_size,
NULL);
- gdk_drawable_get_size (GDK_DRAWABLE (path_entry->icon_area), &width, &height);
+ width = gdk_window_get_width (GDK_WINDOW (path_entry->icon_area));
+ height = gdk_window_get_height (GDK_WINDOW (path_entry->icon_area));
+
+ cairo_save (cr);
- gtk_paint_flat_box (widget->style, path_entry->icon_area,
- gtk_widget_get_state (widget), GTK_SHADOW_NONE,
- NULL, widget, "entry_bg",
- 0, 0, width, height);
+ gtk_render_background (style_context, cr, 0, 0, width, height);
+
+ cairo_restore (cr);
if (G_UNLIKELY (path_entry->current_file != NULL))
icon = thunar_icon_factory_load_file_icon (path_entry->icon_factory, path_entry->current_file, THUNAR_FILE_ICON_STATE_DEFAULT, icon_size);
@@ -586,23 +619,15 @@ thunar_path_entry_expose_event (GtkWidget *widget,
if (G_LIKELY (icon != NULL))
{
- icon_width = gdk_pixbuf_get_width (icon);
- icon_height = gdk_pixbuf_get_height (icon);
-
- gdk_draw_pixbuf (path_entry->icon_area,
- widget->style->black_gc,
- icon, 0, 0,
- (width - icon_width) / 2,
- (height - icon_height) / 2,
- icon_width, icon_height,
- GDK_RGB_DITHER_NORMAL, 0, 0);
-
+ gtk_render_icon (style_context, cr, icon, 0, 0);
g_object_unref (G_OBJECT (icon));
}
+
+ gtk_style_context_restore (style_context);
}
else
{
- return (*GTK_WIDGET_CLASS (thunar_path_entry_parent_class)->expose_event) (widget, event);
+ return (*GTK_WIDGET_CLASS (thunar_path_entry_parent_class)->draw) (widget, cr);
}
return TRUE;
@@ -693,14 +718,14 @@ thunar_path_entry_key_press_event (GtkWidget *widget,
ThunarPathEntry *path_entry = THUNAR_PATH_ENTRY (widget);
/* check if we have a tab key press here and control is not pressed */
- if (G_UNLIKELY (event->keyval == GDK_Tab && (event->state & GDK_CONTROL_MASK) == 0))
+ if (G_UNLIKELY (event->keyval == GDK_KEY_Tab && (event->state & GDK_CONTROL_MASK) == 0))
{
/* if we don't have a completion and the cursor is at the end of the line, we just insert the common prefix */
- if (!path_entry->has_completion && gtk_editable_get_position (GTK_EDITABLE (path_entry)) == GTK_ENTRY (path_entry)->text_length)
+ if (!path_entry->has_completion && gtk_editable_get_position (GTK_EDITABLE (path_entry)) == gtk_entry_get_text_length (GTK_ENTRY (path_entry)))
thunar_path_entry_common_prefix_append (path_entry, FALSE);
/* place the cursor at the end */
- gtk_editable_set_position (GTK_EDITABLE (path_entry), GTK_ENTRY (path_entry)->text_length);
+ gtk_editable_set_position (GTK_EDITABLE (path_entry), -1);
/* emit "changed", so the completion window is popped up */
g_signal_emit_by_name (G_OBJECT (path_entry), "changed", 0);
@@ -900,30 +925,30 @@ thunar_path_entry_get_borders (ThunarPathEntry *path_entry,
gint *xborder,
gint *yborder)
{
- gboolean interior_focus;
- gint focus_width;
+ gboolean interior_focus;
+ gint focus_width;
- gtk_widget_style_get (GTK_WIDGET (path_entry),
+ gtk_widget_style_get (GTK_WIDGET (path_entry),
"focus-line-width", &focus_width,
"interior-focus", &interior_focus,
NULL);
- if (gtk_entry_get_has_frame (GTK_ENTRY (path_entry)))
+ if (gtk_entry_get_has_frame (GTK_ENTRY (path_entry)))
{
- *xborder = GTK_WIDGET (path_entry)->style->xthickness;
- *yborder = GTK_WIDGET (path_entry)->style->ythickness;
- }
- else
- {
- *xborder = 0;
- *yborder = 0;
- }
-
- if (!interior_focus)
- {
- *xborder += focus_width;
- *yborder += focus_width;
- }
+ *xborder = 2; /* TODO GTK_WIDGET (path_entry)->style->xthickness; */
+ *yborder = 2; /* TODO GTK_WIDGET (path_entry)->style->ythickness; */
+ }
+ else
+ {
+ *xborder = 0;
+ *yborder = 0;
+ }
+
+ if (!interior_focus)
+ {
+ *xborder += focus_width;
+ *yborder += focus_width;
+ }
}
@@ -935,19 +960,19 @@ thunar_path_entry_get_text_area_size (ThunarPathEntry *path_entry,
gint *width,
gint *height)
{
- GtkRequisition requisition;
- GtkWidget *widget = GTK_WIDGET (path_entry);
- gint xborder;
+ GtkRequisition requisition;
+ GtkWidget *widget = GTK_WIDGET (path_entry);
+ gint xborder;
gint yborder;
- gtk_widget_get_child_requisition (widget, &requisition);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
thunar_path_entry_get_borders (path_entry, &xborder, &yborder);
- if (x != NULL) *x = xborder;
- if (y != NULL) *y = yborder;
- if (width != NULL) *width = widget->allocation.width - xborder * 2;
- if (height != NULL) *height = requisition.height - yborder * 2;
+ if (x != NULL) *x = xborder;
+ if (y != NULL) *y = yborder;
+ if (width != NULL) *width = gtk_widget_get_allocated_width (widget) - xborder * 2;
+ if (height != NULL) *height = requisition.height - yborder * 2;
}
diff --git a/thunar/thunar-preferences-dialog.c b/thunar/thunar-preferences-dialog.c
index a395840..b38f614 100644
--- a/thunar/thunar-preferences-dialog.c
+++ b/thunar/thunar-preferences-dialog.c
@@ -231,11 +231,11 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
- combo = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Icon View"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Detailed List View"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Compact List View"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Last Active View"));
+ combo = gtk_combo_box_text_new ();
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Icon View"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Detailed List View"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Compact List View"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Last Active View"));
exo_mutual_binding_new_full (G_OBJECT (dialog->preferences), "default-view", G_OBJECT (combo), "active",
transform_view_string_to_index, transform_view_index_to_string, NULL, NULL);
gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
@@ -299,11 +299,11 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
- combo = gtk_combo_box_new_text ();
+ combo = gtk_combo_box_text_new ();
for (date_style = THUNAR_DATE_STYLE_SIMPLE; date_style <= THUNAR_DATE_STYLE_ISO; ++date_style)
{
date = thunar_util_humanize_file_time (time (NULL), date_style);
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), date);
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, date);
g_free (date);
}
exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-date-style", G_OBJECT (combo), "active");
@@ -342,14 +342,14 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
- combo = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Very Small"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Smaller"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Small"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Normal"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Large"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Larger"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Very Large"));
+ combo = gtk_combo_box_text_new ();
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Very Small"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Smaller"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Small"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Normal"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Large"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Larger"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Very Large"));
exo_mutual_binding_new_full (G_OBJECT (dialog->preferences), "shortcuts-icon-size", G_OBJECT (combo), "active",
transform_icon_size_to_index, transform_index_to_icon_size, NULL, NULL);
gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
@@ -384,14 +384,14 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
- combo = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Very Small"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Smaller"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Small"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Normal"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Large"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Larger"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Very Large"));
+ combo = gtk_combo_box_text_new ();
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Very Small"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Smaller"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Small"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Normal"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Large"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Larger"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Very Large"));
exo_mutual_binding_new_full (G_OBJECT (dialog->preferences), "tree-icon-size", G_OBJECT (combo), "active",
transform_icon_size_to_index, transform_index_to_icon_size, NULL, NULL);
gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
@@ -462,7 +462,7 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
gtk_box_pack_start (GTK_BOX (ibox), align, FALSE, FALSE, 0);
gtk_widget_show (align);
- range = gtk_hscale_new_with_range (0.0, 2000.0, 100.0);
+ range = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0.0, 2000.0, 100.0);
gtk_scale_set_draw_value (GTK_SCALE (range), FALSE);
gtk_widget_set_tooltip_text (range, _("When single-click activation is enabled, pausing the mouse pointer over an item "
"will automatically select that item after the chosen delay. You can disable this "
@@ -478,7 +478,7 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
adjustment = gtk_range_get_adjustment (GTK_RANGE (range));
exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-single-click-timeout", G_OBJECT (adjustment), "value");
- hbox = gtk_hbox_new (TRUE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (ibox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
@@ -539,10 +539,10 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
- combo = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Ask everytime"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Apply to Folder Only"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Apply to Folder and Contents"));
+ combo = gtk_combo_box_text_new ();
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Ask everytime"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Apply to Folder Only"));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), NULL, _("Apply to Folder and Contents"));
exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-recursive-permissions", G_OBJECT (combo), "active");
gtk_table_attach (GTK_TABLE (table), combo, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), combo);
@@ -636,7 +636,7 @@ thunar_preferences_dialog_configure (ThunarPreferencesDialog *dialog)
/* invoke the configuration interface of thunar-volman */
/* TODO use xfce_spawn */
- if (!gdk_spawn_on_screen (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &err))
+ if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &err))
{
/* tell the user that we failed to come up with the thunar-volman configuration dialog */
thunar_dialogs_show_error (dialog, err, _("Failed to display the volume management settings"));
diff --git a/thunar/thunar-properties-dialog.c b/thunar/thunar-properties-dialog.c
index 7bd973a..ab58fc4 100644
--- a/thunar/thunar-properties-dialog.c
+++ b/thunar/thunar-properties-dialog.c
@@ -677,7 +677,7 @@ thunar_properties_dialog_activate (GtkWidget *entry,
gchar *new_name;
/* check if we still have a valid file and if the user is allowed to rename */
- if (G_UNLIKELY (dialog->file == NULL || !GTK_WIDGET_SENSITIVE (dialog->name_entry)))
+ if (G_UNLIKELY (dialog->file == NULL || !gtk_widget_get_sensitive (dialog->name_entry)))
return;
/* determine new and old name */
diff --git a/thunar/thunar-renamer-dialog.c b/thunar/thunar-renamer-dialog.c
index 16b822a..0d2f4aa 100644
--- a/thunar/thunar-renamer-dialog.c
+++ b/thunar/thunar-renamer-dialog.c
@@ -446,7 +446,7 @@ thunar_renamer_dialog_init (ThunarRenamerDialog *renamer_dialog)
gtk_widget_show (vbox);
/* create the hbox for the renamer selection */
- rbox = gtk_hbox_new (FALSE, 3);
+ rbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_pack_start (GTK_BOX (vbox), rbox, FALSE, FALSE, 0);
gtk_widget_show (rbox);
@@ -481,9 +481,9 @@ thunar_renamer_dialog_init (ThunarRenamerDialog *renamer_dialog)
xfce_rc_set_group (rc, "Configuration");
/* create the renamer combo box for the renamer selection */
- rcombo = gtk_combo_box_new_text ();
+ rcombo = gtk_combo_box_text_new ();
for (lp = renamers; lp != NULL; lp = lp->next)
- gtk_combo_box_append_text (GTK_COMBO_BOX (rcombo), thunarx_renamer_get_name (lp->data));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (rcombo), NULL, thunarx_renamer_get_name (lp->data));
gtk_box_pack_start (GTK_BOX (rbox), rcombo, FALSE, FALSE, 0);
gtk_widget_show (rcombo);
@@ -499,14 +499,14 @@ thunar_renamer_dialog_init (ThunarRenamerDialog *renamer_dialog)
gtk_widget_show (image);
/* create the name/suffix/both combo box */
- mcombo = gtk_combo_box_new_text ();
+ mcombo = gtk_combo_box_text_new ();
klass = g_type_class_ref (THUNAR_TYPE_RENAMER_MODE);
active_str = xfce_rc_read_entry_untranslated (rc, "LastActiveMode", "");
for (active = 0, n = 0; n < klass->n_values; ++n)
{
if (exo_str_is_equal (active_str, klass->values[n].value_name))
active = n;
- gtk_combo_box_append_text (GTK_COMBO_BOX (mcombo), _(klass->values[n].value_nick));
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (mcombo), NULL, _(klass->values[n].value_nick));
}
exo_mutual_binding_new (G_OBJECT (renamer_dialog->model), "mode", G_OBJECT (mcombo), "active");
gtk_box_pack_end (GTK_BOX (rbox), mcombo, FALSE, FALSE, 0);
@@ -587,7 +587,7 @@ thunar_renamer_dialog_init (ThunarRenamerDialog *renamer_dialog)
gtk_widget_set_sensitive (swin, FALSE);
/* display an error to the user */
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
@@ -1310,7 +1310,9 @@ thunar_renamer_dialog_drag_data_received (GtkWidget *tree_view,
_thunar_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
/* we only accept text/uri-list drops with format 8 and atleast one byte of data */
- if (info == TARGET_TEXT_URI_LIST && selection_data->format == 8 && selection_data->length > 0)
+ if (info == TARGET_TEXT_URI_LIST
+ && gtk_selection_data_get_format (selection_data) == 8
+ && gtk_selection_data_get_length (selection_data) > 0)
{
/* determine the renamer model */
model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
@@ -1332,7 +1334,7 @@ thunar_renamer_dialog_drag_data_received (GtkWidget *tree_view,
}
/* determine the file list from the selection_data */
- file_list = thunar_g_file_list_new_from_string ((const gchar *) selection_data->data);
+ file_list = thunar_g_file_list_new_from_string ((const gchar *) gtk_selection_data_get_data (selection_data));
/* add all paths to the model */
for (lp = file_list; lp != NULL; lp = lp->next)
@@ -1384,7 +1386,7 @@ thunar_renamer_dialog_drag_leave (GtkWidget *tree_view,
/* we use the tree view parent (the scrolled window),
* as the drag_highlight doesn't work for tree views.
*/
- gtk_drag_unhighlight (tree_view->parent);
+ gtk_drag_unhighlight (gtk_widget_get_parent (tree_view));
renamer_dialog->drag_highlighted = FALSE;
}
}
@@ -1428,7 +1430,7 @@ thunar_renamer_dialog_drag_motion (GtkWidget *tree_view,
/* we use the tree view parent (the scrolled window),
* as the drag_highlight doesn't work for tree views.
*/
- gtk_drag_unhighlight (tree_view->parent);
+ gtk_drag_unhighlight (gtk_widget_get_parent (tree_view));
renamer_dialog->drag_highlighted = FALSE;
}
@@ -1468,7 +1470,7 @@ thunar_renamer_dialog_drag_motion (GtkWidget *tree_view,
else if (!renamer_dialog->drag_highlighted)
{
/* highlight the parent */
- gtk_drag_highlight (tree_view->parent);
+ gtk_drag_highlight (gtk_widget_get_parent (tree_view));
renamer_dialog->drag_highlighted = TRUE;
}
diff --git a/thunar/thunar-session-client.c b/thunar/thunar-session-client.c
index addc600..cbb3336 100644
--- a/thunar/thunar-session-client.c
+++ b/thunar/thunar-session-client.c
@@ -36,6 +36,8 @@
#include <X11/SM/SMlib.h>
#endif
+#include <gdk/gdkx.h>
+
#include <thunar/thunar-application.h>
#include <thunar/thunar-ice.h>
#include <thunar/thunar-private.h>
@@ -166,7 +168,7 @@ thunar_session_client_connect (ThunarSessionClient *session_client,
return FALSE;
/* tell GDK about our new session id */
- gdk_set_sm_client_id (id);
+ gdk_x11_set_sm_client_id (id);
/* remember the returned client id */
if (g_mem_is_system_malloc ())
diff --git a/thunar/thunar-shortcuts-icon-renderer.c b/thunar/thunar-shortcuts-icon-renderer.c
index 13c110b..28fa0ed 100644
--- a/thunar/thunar-shortcuts-icon-renderer.c
+++ b/thunar/thunar-shortcuts-icon-renderer.c
@@ -110,8 +110,7 @@ static void
thunar_shortcuts_icon_renderer_init (ThunarShortcutsIconRenderer *shortcuts_icon_renderer)
{
/* no padding please */
- GTK_CELL_RENDERER (shortcuts_icon_renderer)->xpad = 0;
- GTK_CELL_RENDERER (shortcuts_icon_renderer)->ypad = 0;
+ gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (shortcuts_icon_renderer), 0, 0);
}
@@ -193,6 +192,7 @@ thunar_shortcuts_icon_renderer_render (GtkCellRenderer *renderer,
GdkPixbuf *icon = NULL;
GdkPixbuf *temp;
GIcon *gicon;
+ GtkStyleContext *style_context;
/* check if we have a volume set */
if (G_UNLIKELY (shortcuts_icon_renderer->volume != NULL))
@@ -206,6 +206,8 @@ thunar_shortcuts_icon_renderer_render (GtkCellRenderer *renderer,
GTK_ICON_LOOKUP_USE_BUILTIN);
g_object_unref (gicon);
+ style_context = gtk_widget_get_style_context (widget);
+
/* try to load the icon */
if (G_LIKELY (icon_info != NULL))
{
@@ -248,10 +250,7 @@ thunar_shortcuts_icon_renderer_render (GtkCellRenderer *renderer,
if (gdk_rectangle_intersect (expose_area, &icon_area, &draw_area))
{
/* render the invalid parts of the icon */
- gdk_draw_pixbuf (window, widget->style->black_gc, icon,
- draw_area.x - icon_area.x, draw_area.y - icon_area.y,
- draw_area.x, draw_area.y, draw_area.width, draw_area.height,
- GDK_RGB_DITHER_NORMAL, 0, 0);
+ gtk_render_icon (style_context, cr, icon, icon_area.x, icon_area.y);
}
/* cleanup */
diff --git a/thunar/thunar-shortcuts-view.c b/thunar/thunar-shortcuts-view.c
index f7d91d1..1a89c7b 100644
--- a/thunar/thunar-shortcuts-view.c
+++ b/thunar/thunar-shortcuts-view.c
@@ -481,8 +481,10 @@ thunar_shortcuts_view_drag_data_received (GtkWidget *widget,
if (G_LIKELY (!view->drop_data_ready))
{
/* extract the URI list from the selection data (if valid) */
- if (info == TEXT_URI_LIST && selection_data->format == 8 && selection_data->length > 0)
- view->drop_file_list = thunar_g_file_list_new_from_string ((const gchar *) selection_data->data);
+ if (info == TEXT_URI_LIST
+ && gtk_selection_data_get_format (selection_data) == 8
+ && gtk_selection_data_get_length (selection_data) > 0)
+ view->drop_file_list = thunar_g_file_list_new_from_string ((const gchar *) gtk_selection_data_get_data (selection_data));
/* reset the state */
view->drop_data_ready = TRUE;
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index ee1578c..0696f22 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -2709,8 +2709,10 @@ thunar_standard_view_drag_data_received (GtkWidget *view,
if (G_LIKELY (!standard_view->priv->drop_data_ready))
{
/* extract the URI list from the selection data (if valid) */
- if (info == TARGET_TEXT_URI_LIST && selection_data->format == 8 && selection_data->length > 0)
- standard_view->priv->drop_file_list = thunar_g_file_list_new_from_string ((gchar *) selection_data->data);
+ if (info == TARGET_TEXT_URI_LIST
+ && gtk_selection_data_get_format (selection_data) == 8
+ && gtk_selection_data_get_length (selection_data) > 0)
+ standard_view->priv->drop_file_list = thunar_g_file_list_new_from_string ((gchar *) gtk_selection_data_get_data (selection_data));
/* reset the state */
standard_view->priv->drop_data_ready = TRUE;
@@ -2726,7 +2728,9 @@ thunar_standard_view_drag_data_received (GtkWidget *view,
if (G_UNLIKELY (info == TARGET_XDND_DIRECT_SAVE0))
{
/* we don't handle XdndDirectSave stage (3), result "F" yet */
- if (G_UNLIKELY (selection_data->format == 8 && selection_data->length == 1 && selection_data->data[0] == 'F'))
+ if (G_UNLIKELY (gtk_selection_data_get_format (selection_data) == 8
+ && gtk_selection_data_get_length (selection_data) == 1
+ && gtk_selection_data_get_data (selection_data)[0] == 'F'))
{
/* indicate that we don't provide "F" fallback */
gdk_property_change (GDK_DRAWABLE (context->source_window),
@@ -2734,7 +2738,9 @@ thunar_standard_view_drag_data_received (GtkWidget *view,
gdk_atom_intern_static_string ("text/plain"), 8,
GDK_PROP_MODE_REPLACE, (const guchar *) "", 0);
}
- else if (G_LIKELY (selection_data->format == 8 && selection_data->length == 1 && selection_data->data[0] == 'S'))
+ else if (G_LIKELY (gtk_selection_data_get_format (selection_data) == 8
+ && gtk_selection_data_get_length (selection_data)
+ && gtk_selection_data_get_data (selection_data)[0] == 'S'))
{
/* XDS was successfull, so determine the file for the drop position */
file = thunar_standard_view_get_drop_file (standard_view, x, y, NULL);
@@ -2760,10 +2766,11 @@ thunar_standard_view_drag_data_received (GtkWidget *view,
else if (G_UNLIKELY (info == TARGET_NETSCAPE_URL))
{
/* check if the format is valid and we have any data */
- if (G_LIKELY (selection_data->format == 8 && selection_data->length > 0))
+ if (G_LIKELY (gtk_selection_data_get_format (selection_data) == 8
+ && gtk_selection_data_get_length (selection_data) > 0))
{
/* _NETSCAPE_URL looks like this: "$URL\n$TITLE" */
- bits = g_strsplit ((const gchar *) selection_data->data, "\n", -1);
+ bits = g_strsplit ((const gchar *) gtk_selection_data_get_data (selection_data), "\n", -1);
if (G_LIKELY (g_strv_length (bits) == 2))
{
/* determine the file for the drop position */
diff --git a/thunar/thunar-text-renderer.c b/thunar/thunar-text-renderer.c
index 5f41f19..fd86624 100644
--- a/thunar/thunar-text-renderer.c
+++ b/thunar/thunar-text-renderer.c
@@ -548,7 +548,7 @@ thunar_text_renderer_render (GtkCellRenderer *renderer,
cairo_curve_to (cr, x0 + 5, y1, x0, y1, x0, y1 - 5);
cairo_line_to (cr, x0, y0 + 5);
cairo_curve_to (cr, x0, y0 + 5, x0, y0, x0 + 5, y0);
- gdk_cairo_set_source_color (cr, &widget->style->base[state]);
+ /* TODO gdk_cairo_set_source_color (cr, &widget->style->base[state]); */
cairo_fill (cr);
cairo_destroy (cr);
}
diff --git a/thunar/thunar-throbber.c b/thunar/thunar-throbber.c
index 9d210e1..83a6157 100644
--- a/thunar/thunar-throbber.c
+++ b/thunar/thunar-throbber.c
@@ -39,23 +39,27 @@ enum
-static void thunar_throbber_dispose (GObject *object);
-static void thunar_throbber_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void thunar_throbber_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void thunar_throbber_realize (GtkWidget *widget);
-static void thunar_throbber_unrealize (GtkWidget *widget);
-static void thunar_throbber_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static gboolean thunar_throbber_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-static gboolean thunar_throbber_timer (gpointer user_data);
-static void thunar_throbber_timer_destroy (gpointer user_data);
+static void thunar_throbber_dispose (GObject *object);
+static void thunar_throbber_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void thunar_throbber_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void thunar_throbber_realize (GtkWidget *widget);
+static void thunar_throbber_unrealize (GtkWidget *widget);
+static void thunar_throbber_get_preferred_width (GtkWidget *widget,
+ gint *normal_width,
+ gint *minimal_width);
+static void thunar_throbber_get_preferred_heigh (GtkWidget *widget,
+ gint *normal_height,
+ gint *minimal_height);
+static gboolean thunar_throbber_draw (GtkWidget *widget,
+ cairo_t *cr);
+static gboolean thunar_throbber_timer (gpointer user_data);
+static void thunar_throbber_timer_destroy (gpointer user_data);
@@ -97,7 +101,7 @@ thunar_throbber_class_init (ThunarThrobberClass *klass)
gtkwidget_class->realize = thunar_throbber_realize;
gtkwidget_class->unrealize = thunar_throbber_unrealize;
gtkwidget_class->size_request = thunar_throbber_size_request;
- gtkwidget_class->expose_event = thunar_throbber_expose_event;
+ gtkwidget_class->draw = thunar_throbber_draw;
/**
* ThunarThrobber:animated:
@@ -223,19 +227,29 @@ thunar_throbber_unrealize (GtkWidget *widget)
-static void
-thunar_throbber_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+static void
+thunar_throbber_get_preferred_width (GtkWidget *widget,
+ gint *normal_width,
+ gint *minimal_width)
+{
+ *normal_width = *minimal_width = 16;
+}
+
+
+
+static void
+thunar_throbber_get_preferred_height (GtkWidget *widget,
+ gint *normal_height,
+ gint *minimal_height)
{
- requisition->width = 16;
- requisition->height = 16;
+ *normal_height = *minimal_height = 16;
}
static gboolean
-thunar_throbber_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+thunar_throbber_draw (GtkWidget *widget,
+ cairo_t *cr)
{
ThunarThrobber *throbber = THUNAR_THROBBER (widget);
gint icon_index;
@@ -266,9 +280,8 @@ thunar_throbber_expose_event (GtkWidget *widget,
icon_y = (icon_index / icon_cols) * 16;
/* render the given part of the icon */
- gdk_draw_pixbuf (event->window, NULL, throbber->icon, icon_x, icon_y,
- widget->allocation.x, widget->allocation.y,
- 16, 16, GDK_RGB_DITHER_NONE, 0, 0);
+ gtk_render_icon_pixbuf (gtk_widget_get_style_context (widget),
+ cr, throbber->icon, icon_x, icon_y);
}
}
diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index 7abead6..e8eb09e 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -766,8 +766,10 @@ thunar_tree_view_drag_data_received (GtkWidget *widget,
if (G_LIKELY (!view->drop_data_ready))
{
/* extract the URI list from the selection data (if valid) */
- if (info == TARGET_TEXT_URI_LIST && selection_data->format == 8 && selection_data->length > 0)
- view->drop_file_list = thunar_g_file_list_new_from_string ((const gchar *) selection_data->data);
+ if (info == TARGET_TEXT_URI_LIST
+ && gtk_selection_data_get_format (selection_data) == 8
+ && gtk_selection_data_get_length (selection_data)> 0)
+ view->drop_file_list = thunar_g_file_list_new_from_string ((const gchar *) gtk_selection_data_get_data (selection_data));
/* reset the state */
view->drop_data_ready = TRUE;
@@ -2349,8 +2351,8 @@ thunar_tree_view_drag_scroll_timer (gpointer user_data)
if (gtk_widget_get_realized (view))
{
/* determine pointer location and window geometry */
- gdk_window_get_pointer (GTK_WIDGET (view)->window, NULL, &y, NULL);
- gdk_window_get_geometry (GTK_WIDGET (view)->window, NULL, NULL, NULL, &h, NULL);
+ gdk_window_get_pointer (gtk_widget_get_window (GTK_WIDGET (view)), NULL, &y, NULL);
+ gdk_window_get_geometry (gtk_widget_get_window (GTK_WIDGET (view)), NULL, NULL, NULL, &h, NULL);
/* check if we are near the edge */
offset = y - (2 * 20);
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 3afdce1..348b6a1 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -2184,7 +2184,7 @@ thunar_window_action_open_templates (GtkAction *action,
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
@@ -2684,7 +2684,7 @@ thunar_window_save_geometry_timer (gpointer user_data)
if (gtk_widget_get_visible (window))
{
/* determine the current state of the window */
- state = gdk_window_get_state (GTK_WIDGET (window)->window);
+ state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));
/* don't save geometry for maximized or fullscreen windows */
if ((state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) == 0)
More information about the Xfce4-commits
mailing list