mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-24 18:25:50 +00:00
eel: remove unused code
Additionally, this commit makes some unused public functions static.
This commit is contained in:
parent
e3777b5410
commit
d48db627fc
|
@ -64,7 +64,7 @@ get_quark_gobject (void)
|
|||
*
|
||||
* Return value: the accessible's associated GObject
|
||||
**/
|
||||
gpointer
|
||||
static gpointer
|
||||
eel_accessibility_get_gobject (AtkObject *object)
|
||||
{
|
||||
return g_object_get_qdata (G_OBJECT (object), get_quark_gobject ());
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
|
||||
void eel_accessibility_set_up_label_widget_relation (GtkWidget *label, GtkWidget *widget);
|
||||
|
||||
gpointer eel_accessibility_get_gobject (AtkObject *object);
|
||||
|
||||
char* eel_accessibility_text_get_text (AtkText *text,
|
||||
gint start_pos,
|
||||
gint end_pos);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
const EelDRect eel_drect_empty = { 0.0, 0.0, 0.0, 0.0 };
|
||||
const EelIRect eel_irect_empty = { 0, 0, 0, 0 };
|
||||
|
||||
void
|
||||
static void
|
||||
eel_irect_copy (EelIRect *dest,
|
||||
const EelIRect *src)
|
||||
{
|
||||
|
@ -39,6 +39,13 @@ eel_irect_copy (EelIRect *dest,
|
|||
dest->y1 = src->y1;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
eel_irect_is_empty (const EelIRect *src)
|
||||
{
|
||||
return (src->x1 <= src->x0 ||
|
||||
src->y1 <= src->y0);
|
||||
}
|
||||
|
||||
void
|
||||
eel_irect_union (EelIRect *dest,
|
||||
const EelIRect *src1,
|
||||
|
@ -61,7 +68,7 @@ eel_irect_union (EelIRect *dest,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
eel_irect_intersect (EelIRect *dest,
|
||||
const EelIRect *src1,
|
||||
const EelIRect *src2)
|
||||
|
@ -72,13 +79,6 @@ eel_irect_intersect (EelIRect *dest,
|
|||
dest->y1 = MIN (src1->y1, src2->y1);
|
||||
}
|
||||
|
||||
gboolean
|
||||
eel_irect_is_empty (const EelIRect *src)
|
||||
{
|
||||
return (src->x1 <= src->x0 ||
|
||||
src->y1 <= src->y0);
|
||||
}
|
||||
|
||||
/**
|
||||
* eel_irect_get_width:
|
||||
*
|
||||
|
@ -146,29 +146,6 @@ eel_drect_union (EelDRect *dest,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* eel_irect_contains_point:
|
||||
*
|
||||
* @rectangle: An EelIRect.
|
||||
* @x: X coordinate to test.
|
||||
* @y: Y coordinate to test.
|
||||
*
|
||||
* Returns: A boolean value indicating whether the rectangle
|
||||
* contains the x,y coordinate.
|
||||
*
|
||||
*/
|
||||
gboolean
|
||||
eel_irect_contains_point (EelIRect rectangle,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
return x >= rectangle.x0
|
||||
&& x <= rectangle.x1
|
||||
&& y >= rectangle.y0
|
||||
&& y <= rectangle.y1;
|
||||
}
|
||||
|
||||
gboolean
|
||||
eel_irect_hits_irect (EelIRect rectangle_a,
|
||||
EelIRect rectangle_b)
|
||||
|
|
|
@ -40,14 +40,9 @@ typedef struct {
|
|||
extern const EelDRect eel_drect_empty;
|
||||
extern const EelIRect eel_irect_empty;
|
||||
|
||||
void eel_irect_copy (EelIRect *dest,
|
||||
const EelIRect *src);
|
||||
void eel_irect_union (EelIRect *dest,
|
||||
const EelIRect *src1,
|
||||
const EelIRect *src2);
|
||||
void eel_irect_intersect (EelIRect *dest,
|
||||
const EelIRect *src1,
|
||||
const EelIRect *src2);
|
||||
gboolean eel_irect_equal (EelIRect rectangle_a,
|
||||
EelIRect rectangle_b);
|
||||
gboolean eel_irect_hits_irect (EelIRect rectangle_a,
|
||||
|
@ -57,10 +52,6 @@ EelIRect eel_irect_offset_by (EelIRect rectangle,
|
|||
int y);
|
||||
EelIRect eel_irect_scale_by (EelIRect rectangle,
|
||||
double scale);
|
||||
gboolean eel_irect_is_empty (const EelIRect *rectangle);
|
||||
gboolean eel_irect_contains_point (EelIRect outer_rectangle,
|
||||
int x,
|
||||
int y);
|
||||
int eel_irect_get_width (EelIRect rectangle);
|
||||
int eel_irect_get_height (EelIRect rectangle);
|
||||
|
||||
|
|
284
eel/eel-canvas.c
284
eel/eel-canvas.c
|
@ -37,10 +37,6 @@
|
|||
*
|
||||
* - Allow to specify whether EelCanvasImage sizes are in units or pixels (scale or don't scale).
|
||||
*
|
||||
* - Implement a flag for eel_canvas_item_reparent() that tells the function to keep the item
|
||||
* visually in the same place, that is, to keep it in the same place with respect to the canvas
|
||||
* origin.
|
||||
*
|
||||
* - GC put functions for items.
|
||||
*
|
||||
* - Widget item (finish it).
|
||||
|
@ -81,12 +77,10 @@ static void redraw_and_repick_if_mapped (EelCanvasItem *item);
|
|||
|
||||
/* Some convenience stuff */
|
||||
#define GCI_UPDATE_MASK (EEL_CANVAS_UPDATE_REQUESTED | EEL_CANVAS_UPDATE_DEEP)
|
||||
#define GCI_EPSILON 1e-18
|
||||
|
||||
enum
|
||||
{
|
||||
ITEM_PROP_0,
|
||||
ITEM_PROP_PARENT,
|
||||
ITEM_PROP_VISIBLE
|
||||
};
|
||||
|
||||
|
@ -154,6 +148,17 @@ eel_canvas_item_init (EelCanvasItem *item)
|
|||
item->flags |= EEL_CANVAS_ITEM_VISIBLE;
|
||||
}
|
||||
|
||||
/* Performs post-creation operations on a canvas item (adding it to its parent
|
||||
* group, etc.)
|
||||
*/
|
||||
static void
|
||||
item_post_create_setup (EelCanvasItem *item)
|
||||
{
|
||||
group_add (EEL_CANVAS_GROUP (item->parent), item);
|
||||
|
||||
redraw_and_repick_if_mapped (item);
|
||||
}
|
||||
|
||||
/**
|
||||
* eel_canvas_item_new:
|
||||
* @parent: The parent group for the new item.
|
||||
|
@ -185,25 +190,18 @@ eel_canvas_item_new (EelCanvasGroup *parent,
|
|||
|
||||
item = EEL_CANVAS_ITEM (g_object_new (type, NULL));
|
||||
|
||||
item->parent = EEL_CANVAS_ITEM (parent);
|
||||
item->canvas = item->parent->canvas;
|
||||
|
||||
va_start (args, first_arg_name);
|
||||
eel_canvas_item_construct (item, parent, first_arg_name, args);
|
||||
g_object_set_valist (G_OBJECT (item), first_arg_name, args);
|
||||
va_end (args);
|
||||
|
||||
item_post_create_setup (item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
/* Performs post-creation operations on a canvas item (adding it to its parent
|
||||
* group, etc.)
|
||||
*/
|
||||
static void
|
||||
item_post_create_setup (EelCanvasItem *item)
|
||||
{
|
||||
group_add (EEL_CANVAS_GROUP (item->parent), item);
|
||||
|
||||
redraw_and_repick_if_mapped (item);
|
||||
}
|
||||
|
||||
/* Set_property handler for canvas items */
|
||||
static void
|
||||
eel_canvas_item_set_property (GObject *gobject,
|
||||
|
@ -219,22 +217,6 @@ eel_canvas_item_set_property (GObject *gobject,
|
|||
|
||||
switch (param_id)
|
||||
{
|
||||
case ITEM_PROP_PARENT:
|
||||
{
|
||||
if (item->parent != NULL)
|
||||
{
|
||||
g_warning ("Cannot set `parent' argument after item has "
|
||||
"already been constructed.");
|
||||
}
|
||||
else if (g_value_get_object (value))
|
||||
{
|
||||
item->parent = EEL_CANVAS_ITEM (g_value_get_object (value));
|
||||
item->canvas = item->parent->canvas;
|
||||
item_post_create_setup (item);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_PROP_VISIBLE:
|
||||
{
|
||||
if (g_value_get_boolean (value))
|
||||
|
@ -285,33 +267,6 @@ eel_canvas_item_get_property (GObject *gobject,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* eel_canvas_item_construct:
|
||||
* @item: An unconstructed canvas item.
|
||||
* @parent: The parent group for the item.
|
||||
* @first_arg_name: The name of the first argument for configuring the item.
|
||||
* @args: The list of arguments used to configure the item.
|
||||
*
|
||||
* Constructs a canvas item; meant for use only by item implementations.
|
||||
**/
|
||||
void
|
||||
eel_canvas_item_construct (EelCanvasItem *item,
|
||||
EelCanvasGroup *parent,
|
||||
const gchar *first_arg_name,
|
||||
va_list args)
|
||||
{
|
||||
g_return_if_fail (EEL_IS_CANVAS_GROUP (parent));
|
||||
g_return_if_fail (EEL_IS_CANVAS_ITEM (item));
|
||||
|
||||
item->parent = EEL_CANVAS_ITEM (parent);
|
||||
item->canvas = item->parent->canvas;
|
||||
|
||||
g_object_set_valist (G_OBJECT (item), first_arg_name, args);
|
||||
|
||||
item_post_create_setup (item);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
redraw_and_repick_if_mapped (EelCanvasItem *item)
|
||||
{
|
||||
|
@ -539,33 +494,12 @@ eel_canvas_item_set (EelCanvasItem *item,
|
|||
va_list args;
|
||||
|
||||
va_start (args, first_arg_name);
|
||||
eel_canvas_item_set_valist (item, first_arg_name, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* eel_canvas_item_set_valist:
|
||||
* @item: A canvas item.
|
||||
* @first_arg_name: The name of the first argument used to configure the item.
|
||||
* @args: The list of object argument name/value pairs used to configure the item.
|
||||
*
|
||||
* Configures a canvas item. The arguments in the item are set to the specified
|
||||
* values, and the item is repainted as appropriate.
|
||||
**/
|
||||
void
|
||||
eel_canvas_item_set_valist (EelCanvasItem *item,
|
||||
const gchar *first_arg_name,
|
||||
va_list args)
|
||||
{
|
||||
g_return_if_fail (EEL_IS_CANVAS_ITEM (item));
|
||||
|
||||
g_object_set_valist (G_OBJECT (item), first_arg_name, args);
|
||||
va_end (args);
|
||||
|
||||
item->canvas->need_repick = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* eel_canvas_item_move:
|
||||
* @item: A canvas item.
|
||||
|
@ -1078,38 +1012,6 @@ eel_canvas_item_ungrab (EelCanvasItem *item)
|
|||
gdk_seat_ungrab (seat);
|
||||
}
|
||||
|
||||
/**
|
||||
* eel_canvas_item_w2i:
|
||||
* @item: A canvas item.
|
||||
* @x: X coordinate to convert (input/output value).
|
||||
* @y: Y coordinate to convert (input/output value).
|
||||
*
|
||||
* Converts a coordinate pair from world coordinates to item-relative
|
||||
* coordinates.
|
||||
**/
|
||||
void
|
||||
eel_canvas_item_w2i (EelCanvasItem *item,
|
||||
double *x,
|
||||
double *y)
|
||||
{
|
||||
g_return_if_fail (EEL_IS_CANVAS_ITEM (item));
|
||||
g_return_if_fail (x != NULL);
|
||||
g_return_if_fail (y != NULL);
|
||||
|
||||
item = item->parent;
|
||||
while (item)
|
||||
{
|
||||
if (EEL_IS_CANVAS_GROUP (item))
|
||||
{
|
||||
*x -= EEL_CANVAS_GROUP (item)->xpos;
|
||||
*y -= EEL_CANVAS_GROUP (item)->ypos;
|
||||
}
|
||||
|
||||
item = item->parent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* eel_canvas_item_i2w:
|
||||
* @item: A canvas item.
|
||||
|
@ -1157,48 +1059,6 @@ is_descendant (EelCanvasItem *item,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* eel_canvas_item_reparent:
|
||||
* @item: A canvas item.
|
||||
* @new_group: A canvas group.
|
||||
*
|
||||
* Changes the parent of the specified item to be the new group. The item keeps
|
||||
* its group-relative coordinates as for its old parent, so the item may change
|
||||
* its absolute position within the canvas.
|
||||
**/
|
||||
void
|
||||
eel_canvas_item_reparent (EelCanvasItem *item,
|
||||
EelCanvasGroup *new_group)
|
||||
{
|
||||
g_return_if_fail (EEL_IS_CANVAS_ITEM (item));
|
||||
g_return_if_fail (EEL_IS_CANVAS_GROUP (new_group));
|
||||
|
||||
/* Both items need to be in the same canvas */
|
||||
g_return_if_fail (item->canvas == EEL_CANVAS_ITEM (new_group)->canvas);
|
||||
|
||||
/* The group cannot be an inferior of the item or be the item itself --
|
||||
* this also takes care of the case where the item is the root item of
|
||||
* the canvas. */
|
||||
g_return_if_fail (!is_descendant (EEL_CANVAS_ITEM (new_group), item));
|
||||
|
||||
/* Everything is ok, now actually reparent the item */
|
||||
|
||||
g_object_ref (G_OBJECT (item)); /* protect it from the unref in group_remove */
|
||||
|
||||
eel_canvas_item_request_redraw (item);
|
||||
|
||||
group_remove (EEL_CANVAS_GROUP (item->parent), item);
|
||||
item->parent = EEL_CANVAS_ITEM (new_group);
|
||||
/* item->canvas is unchanged. */
|
||||
group_add (new_group, item);
|
||||
|
||||
/* Redraw and repick */
|
||||
|
||||
redraw_and_repick_if_mapped (item);
|
||||
|
||||
g_object_unref (G_OBJECT (item));
|
||||
}
|
||||
|
||||
/**
|
||||
* eel_canvas_item_grab_focus:
|
||||
* @item: A canvas item.
|
||||
|
@ -1207,7 +1067,7 @@ eel_canvas_item_reparent (EelCanvasItem *item,
|
|||
* be sent to it. If the canvas widget itself did not have the focus, it grabs
|
||||
* it as well.
|
||||
**/
|
||||
void
|
||||
static void
|
||||
eel_canvas_item_grab_focus (EelCanvasItem *item)
|
||||
{
|
||||
EelCanvasItem *focused_item;
|
||||
|
@ -1850,7 +1710,7 @@ eel_canvas_group_point (EelCanvasItem *item,
|
|||
return best;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
eel_canvas_group_translate (EelCanvasItem *item,
|
||||
double dx,
|
||||
double dy)
|
||||
|
@ -3555,25 +3415,6 @@ eel_canvas_get_scroll_region (EelCanvas *canvas,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
eel_canvas_set_center_scroll_region (EelCanvas *canvas,
|
||||
gboolean center_scroll_region)
|
||||
{
|
||||
GtkAdjustment *vadjustment, *hadjustment;
|
||||
|
||||
g_return_if_fail (EEL_IS_CANVAS (canvas));
|
||||
|
||||
canvas->center_scroll_region = center_scroll_region != 0;
|
||||
|
||||
hadjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (&canvas->layout));
|
||||
vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (&canvas->layout));
|
||||
|
||||
scroll_to (canvas,
|
||||
gtk_adjustment_get_value (hadjustment),
|
||||
gtk_adjustment_get_value (vadjustment));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* eel_canvas_set_pixels_per_unit:
|
||||
* @canvas: A canvas.
|
||||
|
@ -3668,27 +3509,6 @@ eel_canvas_set_pixels_per_unit (EelCanvas *canvas,
|
|||
canvas->need_repick = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* eel_canvas_scroll_to:
|
||||
* @canvas: A canvas.
|
||||
* @cx: Horizontal scrolling offset in canvas pixel units.
|
||||
* @cy: Vertical scrolling offset in canvas pixel units.
|
||||
*
|
||||
* Makes a canvas scroll to the specified offsets, given in canvas pixel units.
|
||||
* The canvas will adjust the view so that it is not outside the scrolling
|
||||
* region. This function is typically not used, as it is better to hook
|
||||
* scrollbars to the canvas layout's scrolling adjusments.
|
||||
**/
|
||||
void
|
||||
eel_canvas_scroll_to (EelCanvas *canvas,
|
||||
int cx,
|
||||
int cy)
|
||||
{
|
||||
g_return_if_fail (EEL_IS_CANVAS (canvas));
|
||||
|
||||
scroll_to (canvas, cx, cy);
|
||||
}
|
||||
|
||||
/**
|
||||
* eel_canvas_get_scroll_offsets:
|
||||
* @canvas: A canvas.
|
||||
|
@ -3721,64 +3541,6 @@ eel_canvas_get_scroll_offsets (EelCanvas *canvas,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* eel_canvas_update_now:
|
||||
* @canvas: A canvas.
|
||||
*
|
||||
* Forces an immediate update and redraw of a canvas. If the canvas does not
|
||||
* have any pending update or redraw requests, then no action is taken. This is
|
||||
* typically only used by applications that need explicit control of when the
|
||||
* display is updated, like games. It is not needed by normal applications.
|
||||
*/
|
||||
void
|
||||
eel_canvas_update_now (EelCanvas *canvas)
|
||||
{
|
||||
g_return_if_fail (EEL_IS_CANVAS (canvas));
|
||||
|
||||
if (!(canvas->need_update || canvas->need_redraw))
|
||||
{
|
||||
return;
|
||||
}
|
||||
remove_idle (canvas);
|
||||
do_update (canvas);
|
||||
}
|
||||
|
||||
/**
|
||||
* eel_canvas_get_item_at:
|
||||
* @canvas: A canvas.
|
||||
* @x: X position in world coordinates.
|
||||
* @y: Y position in world coordinates.
|
||||
*
|
||||
* Looks for the item that is under the specified position, which must be
|
||||
* specified in world coordinates.
|
||||
*
|
||||
* Return value: The sought item, or NULL if no item is at the specified
|
||||
* coordinates.
|
||||
**/
|
||||
EelCanvasItem *
|
||||
eel_canvas_get_item_at (EelCanvas *canvas,
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
EelCanvasItem *item;
|
||||
double dist;
|
||||
int cx, cy;
|
||||
|
||||
g_return_val_if_fail (EEL_IS_CANVAS (canvas), NULL);
|
||||
|
||||
eel_canvas_w2c (canvas, x, y, &cx, &cy);
|
||||
|
||||
dist = eel_canvas_item_invoke_point (canvas->root, x, y, cx, cy, &item);
|
||||
if ((int) (dist * canvas->pixels_per_unit + 0.5) <= canvas->close_enough)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Queues an update of the canvas */
|
||||
static void
|
||||
eel_canvas_request_update (EelCanvas *canvas)
|
||||
|
@ -4355,12 +4117,6 @@ eel_canvas_item_class_init (EelCanvasItemClass *klass)
|
|||
gobject_class->get_property = eel_canvas_item_get_property;
|
||||
gobject_class->dispose = eel_canvas_item_dispose;
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class, ITEM_PROP_PARENT,
|
||||
g_param_spec_object ("parent", NULL, NULL,
|
||||
EEL_TYPE_CANVAS_ITEM,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class, ITEM_PROP_VISIBLE,
|
||||
g_param_spec_boolean ("visible", NULL, NULL,
|
||||
|
|
|
@ -192,19 +192,11 @@ EelCanvasItem *eel_canvas_item_new (EelCanvasGroup *parent, GType type,
|
|||
|
||||
void eel_canvas_item_destroy (EelCanvasItem *item);
|
||||
|
||||
/* Constructors for use in derived classes and language wrappers */
|
||||
void eel_canvas_item_construct (EelCanvasItem *item, EelCanvasGroup *parent,
|
||||
const gchar *first_arg_name, va_list args);
|
||||
|
||||
/* Configure an item using the standard Gtk argument mechanism. The last
|
||||
* argument must be a NULL pointer.
|
||||
*/
|
||||
void eel_canvas_item_set (EelCanvasItem *item, const gchar *first_arg_name, ...);
|
||||
|
||||
/* Used only for language wrappers and the like */
|
||||
void eel_canvas_item_set_valist (EelCanvasItem *item,
|
||||
const gchar *first_arg_name, va_list args);
|
||||
|
||||
/* Move an item by the specified amount */
|
||||
void eel_canvas_item_move (EelCanvasItem *item, double dx, double dy);
|
||||
|
||||
|
@ -256,25 +248,8 @@ void eel_canvas_item_ungrab (EelCanvasItem *item);
|
|||
/* These functions convert from a coordinate system to another. "w" is world
|
||||
* coordinates and "i" is item coordinates.
|
||||
*/
|
||||
void eel_canvas_item_w2i (EelCanvasItem *item, double *x, double *y);
|
||||
void eel_canvas_item_i2w (EelCanvasItem *item, double *x, double *y);
|
||||
|
||||
/* Remove the item from its parent group and make the new group its parent. The
|
||||
* item will be put on top of all the items in the new group. The item's
|
||||
* coordinates relative to its new parent to *not* change -- this means that the
|
||||
* item could potentially move on the screen.
|
||||
*
|
||||
* The item and the group must be in the same canvas. An item cannot be
|
||||
* reparented to a group that is the item itself or that is an inferior of the
|
||||
* item.
|
||||
*/
|
||||
void eel_canvas_item_reparent (EelCanvasItem *item, EelCanvasGroup *new_group);
|
||||
|
||||
/* Used to send all of the keystroke events to a specific item as well as
|
||||
* GDK_FOCUS_CHANGE events.
|
||||
*/
|
||||
void eel_canvas_item_grab_focus (EelCanvasItem *item);
|
||||
|
||||
/* Fetch the bounding box of the item. The bounding box may not be exactly
|
||||
* tight, but the canvas items will do the best they can. The returned bounding
|
||||
* box is in the coordinate system of the item's parent.
|
||||
|
@ -455,28 +430,12 @@ void eel_canvas_get_scroll_region (EelCanvas *canvas,
|
|||
/* Sets the number of pixels that correspond to one unit in world coordinates */
|
||||
void eel_canvas_set_pixels_per_unit (EelCanvas *canvas, double n);
|
||||
|
||||
/* Wether the canvas centers the scroll region if it is smaller than the window */
|
||||
void eel_canvas_set_center_scroll_region (EelCanvas *canvas, gboolean center_scroll_region);
|
||||
|
||||
/* Scrolls the canvas to the specified offsets, given in canvas pixel coordinates */
|
||||
void eel_canvas_scroll_to (EelCanvas *canvas, int cx, int cy);
|
||||
|
||||
/* Returns the scroll offsets of the canvas in canvas pixel coordinates. You
|
||||
* can specify NULL for any of the values, in which case that value will not be
|
||||
* queried.
|
||||
*/
|
||||
void eel_canvas_get_scroll_offsets (EelCanvas *canvas, int *cx, int *cy);
|
||||
|
||||
/* Requests that the canvas be repainted immediately instead of in the idle
|
||||
* loop.
|
||||
*/
|
||||
void eel_canvas_update_now (EelCanvas *canvas);
|
||||
|
||||
/* Returns the item that is at the specified position in world coordinates, or
|
||||
* NULL if no item is there.
|
||||
*/
|
||||
EelCanvasItem *eel_canvas_get_item_at (EelCanvas *canvas, double x, double y);
|
||||
|
||||
/* For use only by item type implementations. Request that the canvas
|
||||
* eventually redraw the specified region, specified in canvas pixel
|
||||
* coordinates. The region contains (x1, y1) but not (x2, y2).
|
||||
|
|
|
@ -100,52 +100,6 @@ eel_g_lists_sort_and_check_for_intersection (GList **list_1,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GList *keys;
|
||||
GList *values;
|
||||
} FlattenedHashTable;
|
||||
|
||||
static void
|
||||
flatten_hash_table_element (gpointer key,
|
||||
gpointer value,
|
||||
gpointer callback_data)
|
||||
{
|
||||
FlattenedHashTable *flattened_table;
|
||||
|
||||
flattened_table = callback_data;
|
||||
flattened_table->keys = g_list_prepend
|
||||
(flattened_table->keys, key);
|
||||
flattened_table->values = g_list_prepend
|
||||
(flattened_table->values, value);
|
||||
}
|
||||
|
||||
void
|
||||
eel_g_hash_table_safe_for_each (GHashTable *hash_table,
|
||||
GHFunc callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
FlattenedHashTable flattened;
|
||||
GList *p, *q;
|
||||
|
||||
flattened.keys = NULL;
|
||||
flattened.values = NULL;
|
||||
|
||||
g_hash_table_foreach (hash_table,
|
||||
flatten_hash_table_element,
|
||||
&flattened);
|
||||
|
||||
for (p = flattened.keys, q = flattened.values;
|
||||
p != NULL;
|
||||
p = p->next, q = q->next)
|
||||
{
|
||||
(*callback)(p->data, q->data, callback_data);
|
||||
}
|
||||
|
||||
g_list_free (flattened.keys);
|
||||
g_list_free (flattened.values);
|
||||
}
|
||||
|
||||
#if !defined (EEL_OMIT_SELF_CHECK)
|
||||
|
||||
#endif /* !EEL_OMIT_SELF_CHECK */
|
||||
|
|
|
@ -26,22 +26,13 @@
|
|||
#define EEL_GLIB_EXTENSIONS_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
/* A gboolean variant for bit fields. */
|
||||
typedef guint eel_boolean_bit;
|
||||
|
||||
/* Predicate. */
|
||||
typedef gboolean (* EelPredicateFunction) (gpointer data,
|
||||
gpointer callback_data);
|
||||
|
||||
/* GList functions. */
|
||||
gboolean eel_g_lists_sort_and_check_for_intersection (GList **list_a,
|
||||
GList **list_b);
|
||||
/* GHashTable functions */
|
||||
void eel_g_hash_table_safe_for_each (GHashTable *hash_table,
|
||||
GHFunc callback,
|
||||
gpointer callback_data);
|
||||
|
||||
/* NULL terminated string arrays (strv). */
|
||||
gboolean eel_g_strv_equal (char **a,
|
||||
|
|
|
@ -67,48 +67,6 @@ eel_uri_is_other_locations (const char *uri)
|
|||
return g_str_has_prefix (uri, "other-locations:");
|
||||
}
|
||||
|
||||
char *
|
||||
eel_make_valid_utf8 (const char *name)
|
||||
{
|
||||
GString *string;
|
||||
const char *remainder, *invalid;
|
||||
int remaining_bytes, valid_bytes;
|
||||
|
||||
string = NULL;
|
||||
remainder = name;
|
||||
remaining_bytes = strlen (name);
|
||||
|
||||
while (remaining_bytes != 0)
|
||||
{
|
||||
if (g_utf8_validate (remainder, remaining_bytes, &invalid))
|
||||
{
|
||||
break;
|
||||
}
|
||||
valid_bytes = invalid - remainder;
|
||||
|
||||
if (string == NULL)
|
||||
{
|
||||
string = g_string_sized_new (remaining_bytes);
|
||||
}
|
||||
g_string_append_len (string, remainder, valid_bytes);
|
||||
g_string_append_c (string, '?');
|
||||
|
||||
remaining_bytes -= valid_bytes + 1;
|
||||
remainder = invalid + 1;
|
||||
}
|
||||
|
||||
if (string == NULL)
|
||||
{
|
||||
return g_strdup (name);
|
||||
}
|
||||
|
||||
g_string_append (string, remainder);
|
||||
g_string_append (string, _(" (invalid Unicode)"));
|
||||
g_assert (g_utf8_validate (string->str, -1, NULL));
|
||||
|
||||
return g_string_free (string, FALSE);
|
||||
}
|
||||
|
||||
char *
|
||||
eel_filename_get_extension_offset (const char *filename)
|
||||
{
|
||||
|
|
|
@ -42,8 +42,6 @@ gboolean eel_uri_is_search (const char *
|
|||
gboolean eel_uri_is_other_locations (const char *uri);
|
||||
gboolean eel_uri_is_recent (const char *uri);
|
||||
|
||||
char * eel_make_valid_utf8 (const char *name);
|
||||
|
||||
char * eel_filename_strip_extension (const char *filename);
|
||||
void eel_filename_get_rename_region (const char *filename,
|
||||
int *start_offset,
|
||||
|
|
Loading…
Reference in a new issue