[gedit] Add offset to popup search.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Add offset to popup search.
- Date: Sun, 10 Oct 2010 14:40:11 +0000 (UTC)
commit 65be74471b99ca194783b9bce56d80e523823843
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sun Oct 10 16:39:48 2010 +0200
Add offset to popup search.
gedit/gedit-overlay.c | 17 +++++++++++------
gedit/gedit-overlay.h | 3 ++-
gedit/gedit-view-frame.c | 4 +++-
tests/test-overlay.c | 2 +-
4 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/gedit/gedit-overlay.c b/gedit/gedit-overlay.c
index 9478d26..a2c9902 100644
--- a/gedit/gedit-overlay.c
+++ b/gedit/gedit-overlay.c
@@ -33,6 +33,7 @@ typedef struct _OverlayChild
{
GtkWidget *child;
GdkGravity gravity;
+ guint offset;
guint fixed_position : 1;
guint is_animated : 1;
@@ -79,7 +80,8 @@ add_toplevel_widget (GeditOverlay *overlay,
GtkWidget *widget,
gboolean fixed_position,
gboolean is_animated,
- GdkGravity gravity)
+ GdkGravity gravity,
+ guint offset)
{
OverlayChild *child = g_slice_new (OverlayChild);
@@ -87,6 +89,7 @@ add_toplevel_widget (GeditOverlay *overlay,
child->gravity = gravity;
child->fixed_position = fixed_position;
child->is_animated = is_animated;
+ child->offset = offset;
gtk_widget_set_parent (widget, GTK_WIDGET (overlay));
@@ -166,7 +169,8 @@ gedit_overlay_set_property (GObject *object,
overlay->priv->main_widget = g_value_get_object (value);
add_toplevel_widget (overlay,
overlay->priv->main_widget,
- TRUE, FALSE, GDK_GRAVITY_STATIC);
+ TRUE, FALSE, GDK_GRAVITY_STATIC,
+ 0);
break;
}
default:
@@ -230,7 +234,7 @@ set_children_positions (GeditOverlay *overlay)
{
/* The gravity is the inverse of the place we want */
case GDK_GRAVITY_SOUTH_WEST:
- alloc.x = overlay->priv->main_alloc.width - req.width;
+ alloc.x = overlay->priv->main_alloc.width - req.width - child->offset;
alloc.y = 0;
break;
default:
@@ -274,7 +278,7 @@ gedit_overlay_add (GtkContainer *overlay,
GtkWidget *widget)
{
add_toplevel_widget (GEDIT_OVERLAY (overlay), widget,
- FALSE, FALSE, GDK_GRAVITY_STATIC);
+ FALSE, FALSE, GDK_GRAVITY_STATIC, 0);
}
static void
@@ -551,7 +555,8 @@ gedit_overlay_add_animated_widget (GeditOverlay *overlay,
GeditTheatricsChoreographerEasing easing,
GeditTheatricsChoreographerBlocking blocking,
GtkOrientation orientation,
- GdkGravity gravity)
+ GdkGravity gravity,
+ guint offset)
{
GeditTheatricsAnimatedWidget *anim_widget;
GeditTheatricsActor *actor;
@@ -577,5 +582,5 @@ gedit_overlay_add_animated_widget (GeditOverlay *overlay,
duration);
add_toplevel_widget (overlay, GTK_WIDGET (anim_widget), TRUE,
- TRUE, gravity);
+ TRUE, gravity, offset);
}
diff --git a/gedit/gedit-overlay.h b/gedit/gedit-overlay.h
index ce0fb0f..c12cd27 100644
--- a/gedit/gedit-overlay.h
+++ b/gedit/gedit-overlay.h
@@ -67,7 +67,8 @@ void gedit_overlay_add_animated_widget (GeditOverlay *ov
GeditTheatricsChoreographerEasing easing,
GeditTheatricsChoreographerBlocking blocking,
GtkOrientation orientation,
- GdkGravity gravity);
+ GdkGravity gravity,
+ guint offset);
G_END_DECLS
diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c
index cf66655..3fb6bd2 100644
--- a/gedit/gedit-view-frame.c
+++ b/gedit/gedit-view-frame.c
@@ -34,6 +34,7 @@
#define GEDIT_VIEW_FRAME_SEARCH_DIALOG_TIMEOUT (30*1000) /* 30 seconds */
#define MIN_SEARCH_COMPLETION_KEY_LEN 3
+#define SEARCH_POPUP_OFFSET 12
#define GEDIT_VIEW_FRAME_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_TYPE_VIEW_FRAME, GeditViewFramePrivate))
@@ -1302,7 +1303,8 @@ start_interactive_search_real (GeditViewFrame *frame)
GEDIT_THEATRICS_CHOREOGRAPHER_EASING_EXPONENTIAL_IN_OUT,
GEDIT_THEATRICS_CHOREOGRAPHER_BLOCKING_DOWNSTAGE,
GTK_ORIENTATION_VERTICAL,
- GDK_GRAVITY_SOUTH_WEST);
+ GDK_GRAVITY_SOUTH_WEST,
+ SEARCH_POPUP_OFFSET);
init_search_entry (frame);
diff --git a/tests/test-overlay.c b/tests/test-overlay.c
index 951e3f0..6d3d395 100644
--- a/tests/test-overlay.c
+++ b/tests/test-overlay.c
@@ -46,7 +46,7 @@ main ()
GEDIT_THEATRICS_CHOREOGRAPHER_EASING_EXPONENTIAL_IN_OUT,
GEDIT_THEATRICS_CHOREOGRAPHER_BLOCKING_DOWNSTAGE,
GTK_ORIENTATION_VERTICAL,
- GDK_GRAVITY_STATIC);
+ GDK_GRAVITY_STATIC, 0);
button = gtk_button_new_with_label ("Hide");
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]