aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hildon/hildon-animation-actor.c40
-rw-r--r--hildon/hildon-app-menu.c36
-rw-r--r--hildon/hildon-banner.c42
-rw-r--r--hildon/hildon-caption.c114
-rw-r--r--hildon/hildon-date-selector.c13
-rw-r--r--hildon/hildon-defines.h22
-rw-r--r--hildon/hildon-edit-toolbar.c24
-rw-r--r--hildon/hildon-find-toolbar-private.h2
-rw-r--r--hildon/hildon-find-toolbar.c16
-rw-r--r--hildon/hildon-gtk.c10
-rw-r--r--hildon/hildon-helper.c17
-rw-r--r--hildon/hildon-live-search.c8
-rw-r--r--hildon/hildon-note.c64
-rw-r--r--hildon/hildon-pannable-area.c615
-rw-r--r--hildon/hildon-picker-button.c4
-rw-r--r--hildon/hildon-picker-dialog.c96
-rw-r--r--hildon/hildon-picker-dialog.h5
-rw-r--r--hildon/hildon-program.c24
-rw-r--r--hildon/hildon-remote-texture.c50
-rw-r--r--hildon/hildon-sound.c3
-rw-r--r--hildon/hildon-stackable-window.c4
-rw-r--r--hildon/hildon-time-selector.c10
-rw-r--r--hildon/hildon-touch-selector-entry.c6
-rw-r--r--hildon/hildon-touch-selector.c72
-rw-r--r--hildon/hildon-touch-selector.h3
-rw-r--r--hildon/hildon-window-stack.c8
-rw-r--r--hildon/hildon-window.c341
-rw-r--r--hildon/hildon-wizard-dialog.c20
28 files changed, 805 insertions, 864 deletions
diff --git a/hildon/hildon-animation-actor.c b/hildon/hildon-animation-actor.c
index bce8765..15bb486 100644
--- a/hildon/hildon-animation-actor.c
+++ b/hildon/hildon-animation-actor.c
@@ -192,12 +192,12 @@ hildon_animation_actor_realize (GtkWidget *widget)
/* Set animation actor window type. */
- display = gdk_drawable_get_display (widget->window);
+ display = gdk_window_get_display (gtk_widget_get_window (widget));
wm_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE");
applet_type = gdk_x11_get_xatom_by_name_for_display (display, "_HILDON_WM_WINDOW_TYPE_ANIMATION_ACTOR");
- XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (widget->window), wm_type,
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (gtk_widget_get_window (widget)), wm_type,
XA_ATOM, 32, PropModeReplace,
(unsigned char *) &applet_type, 1);
@@ -243,7 +243,7 @@ hildon_animation_actor_realize (GtkWidget *widget)
/* Wait for a ready message */
- gdk_window_add_filter (widget->window,
+ gdk_window_add_filter (gtk_widget_get_window (widget),
hildon_animation_actor_event_filter,
widget);
}
@@ -251,7 +251,7 @@ hildon_animation_actor_realize (GtkWidget *widget)
static void
hildon_animation_actor_unrealize (GtkWidget *widget)
{
- gdk_window_remove_filter (widget->window,
+ gdk_window_remove_filter (gtk_widget_get_window (widget),
hildon_animation_actor_event_filter,
widget);
@@ -382,8 +382,8 @@ hildon_animation_actor_update_ready (HildonAnimationActor *self)
HildonAnimationActorPrivate
*priv = HILDON_ANIMATION_ACTOR_GET_PRIVATE (self);
GtkWidget *widget = GTK_WIDGET (self);
- Display *display = GDK_WINDOW_XDISPLAY (widget->window);
- Window window = GDK_WINDOW_XID (widget->window);
+ Display *display = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (widget));
+ Window window = GDK_WINDOW_XID (gtk_widget_get_window (widget));
int status;
gint xerror;
@@ -432,7 +432,7 @@ hildon_animation_actor_update_ready (HildonAnimationActor *self)
G_CALLBACK(hildon_animation_actor_map_event),
self);
- if (GTK_WIDGET_MAPPED (GTK_WIDGET (self)))
+ if (gtk_widget_get_mapped (GTK_WIDGET (self)))
{
gtk_widget_unmap (GTK_WIDGET (self));
gtk_widget_map (GTK_WIDGET (self));
@@ -558,8 +558,8 @@ hildon_animation_actor_send_message (HildonAnimationActor *self,
guint32 l4)
{
GtkWidget *widget = GTK_WIDGET (self);
- Display *display = GDK_WINDOW_XDISPLAY (widget->window);
- Window window = GDK_WINDOW_XID (widget->window);
+ Display *display = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (widget));
+ Window window = GDK_WINDOW_XID (gtk_widget_get_window (widget));
#if 0
XClientMessageEvent event;
@@ -641,12 +641,12 @@ hildon_animation_actor_set_show_full (HildonAnimationActor *self,
priv->opacity = opacity;
priv->set_show = 1;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
/* Defer show messages until the animation actor is parented
* and the parent window is mapped */
- if (!priv->parent || !GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!priv->parent || !gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
return;
hildon_animation_actor_send_message (self,
@@ -751,7 +751,7 @@ hildon_animation_actor_set_position_full (HildonAnimationActor *self,
priv->depth = depth;
priv->set_position = 1;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
hildon_animation_actor_send_message (self,
position_atom,
@@ -831,7 +831,7 @@ hildon_animation_actor_set_scalex (HildonAnimationActor *self,
priv->scale_y = y_scale;
priv->set_scale = 1;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
hildon_animation_actor_send_message (self,
scale_atom,
@@ -925,7 +925,7 @@ hildon_animation_actor_set_rotationx (HildonAnimationActor *self,
priv->set_rotation |= mask;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
hildon_animation_actor_send_message (self,
rotation_atom,
@@ -998,7 +998,7 @@ hildon_animation_actor_set_anchor (HildonAnimationActor *self,
priv->anchor_y = y;
priv->set_anchor = 1;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
hildon_animation_actor_send_message (self,
anchor_atom,
@@ -1035,7 +1035,7 @@ hildon_animation_actor_set_anchor_from_gravity (HildonAnimationActor *self,
priv->gravity = gravity;
priv->set_anchor = 1;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
hildon_animation_actor_send_message (self,
anchor_atom,
@@ -1162,14 +1162,14 @@ hildon_animation_actor_set_parent (HildonAnimationActor *self,
}
}
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
Window win = 0;
/* If the animation actor is being unparented or parented to an
* unmapped widget, force its visibility to "hidden". */
- if (!priv->parent || !GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!priv->parent || !gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
{
hildon_animation_actor_send_message (self,
show_atom,
@@ -1184,10 +1184,10 @@ hildon_animation_actor_set_parent (HildonAnimationActor *self,
if (priv->parent)
{
- if (!GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
return;
- GdkWindow *gdk = GTK_WIDGET (parent)->window;
+ GdkWindow *gdk = gtk_widget_get_window (GTK_WIDGET (parent));
win = GDK_WINDOW_XID (gdk);
}
diff --git a/hildon/hildon-app-menu.c b/hildon/hildon-app-menu.c
index 751f2b1..95dd3c9 100644
--- a/hildon/hildon-app-menu.c
+++ b/hildon/hildon-app-menu.c
@@ -194,7 +194,7 @@ hildon_app_menu_insert (HildonAppMenu *menu,
/* Add the item to the menu */
g_object_ref_sink (item);
priv->buttons = g_list_insert (priv->buttons, item, position);
- if (GTK_WIDGET_VISIBLE (item))
+ if (gtk_widget_get_visible (item))
hildon_app_menu_repack_items (menu, position);
/* Enable accelerators */
@@ -304,7 +304,7 @@ hildon_app_menu_add_filter (HildonAppMenu *menu,
/* Add the filter to the menu */
g_object_ref_sink (filter);
priv->filters = g_list_append (priv->filters, filter);
- if (GTK_WIDGET_VISIBLE (filter))
+ if (gtk_widget_get_visible (filter))
hildon_app_menu_repack_filters (menu);
/* Enable accelerators */
@@ -379,7 +379,7 @@ hildon_app_menu_set_parent_window (HildonAppMenu *self,
priv->parent_window = parent_window;
- if (parent_window == NULL && GTK_WIDGET_VISIBLE (self))
+ if (parent_window == NULL && gtk_widget_get_visible (self))
gtk_widget_hide (GTK_WIDGET (self));
}
@@ -413,7 +413,7 @@ can_activate_accel (GtkWidget *widget,
guint signal_id,
gpointer user_data)
{
- return GTK_WIDGET_VISIBLE (widget);
+ return gtk_widget_get_visible (widget);
}
static void
@@ -508,13 +508,13 @@ hildon_app_menu_find_intruder (gpointer data)
gboolean intruder_found = FALSE;
GdkScreen *screen = gtk_widget_get_screen (widget);
GList *stack = gdk_screen_get_window_stack (screen);
- GList *parent_pos = g_list_find (stack, GTK_WIDGET (priv->parent_window)->window);
+ GList *parent_pos = g_list_find (stack, gtk_widget_get_window (GTK_WIDGET (priv->parent_window)));
GList *toplevels = gtk_window_list_toplevels ();
GList *i;
for (i = toplevels; i != NULL && !intruder_found; i = i->next) {
if (i->data != widget && i->data != priv->parent_window) {
- if (g_list_find (parent_pos, GTK_WIDGET (i->data)->window)) {
+ if (g_list_find (parent_pos, gtk_widget_get_window (GTK_WIDGET (i->data)))) {
/* HildonBanners are not closed automatically when
* a new window appears, so we must close them by
* hand to make the AppMenu work as expected.
@@ -559,7 +559,7 @@ hildon_app_menu_grab_notify (GtkWidget *widget,
if (GTK_WIDGET_CLASS (hildon_app_menu_parent_class)->grab_notify)
GTK_WIDGET_CLASS (hildon_app_menu_parent_class)->grab_notify (widget, was_grabbed);
- if (!was_grabbed && GTK_WIDGET_VISIBLE (widget))
+ if (!was_grabbed && gtk_widget_get_visible (widget))
gtk_widget_hide (widget);
}
@@ -660,14 +660,14 @@ hildon_app_menu_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (hildon_app_menu_parent_class)->realize (widget);
- gdk_window_set_decorations (widget->window, GDK_DECOR_BORDER);
+ gdk_window_set_decorations (gtk_widget_get_window (widget), GDK_DECOR_BORDER);
- gdkdisplay = gdk_drawable_get_display (widget->window);
- xdisplay = GDK_WINDOW_XDISPLAY (widget->window);
+ gdkdisplay = gdk_window_get_display (gtk_widget_get_window (widget));
+ xdisplay = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (widget));
property = gdk_x11_get_xatom_by_name_for_display (gdkdisplay, "_NET_WM_WINDOW_TYPE");
window_type = XInternAtom (xdisplay, "_HILDON_WM_WINDOW_TYPE_APP_MENU", False);
- XChangeProperty (xdisplay, GDK_WINDOW_XID (widget->window), property,
+ XChangeProperty (xdisplay, GDK_WINDOW_XID (gtk_widget_get_window (widget)), property,
XA_ATOM, 32, PropModeReplace, (guchar *) &window_type, 1);
/* Detect any screen changes */
@@ -726,8 +726,8 @@ hildon_app_menu_apply_style (GtkWidget *widget)
}
priv->width_request = gdk_screen_get_width (screen) - external_border * 2;
- if (widget->window)
- gdk_window_move_resize (widget->window,
+ if (gtk_widget_get_window (widget))
+ gdk_window_move_resize (gtk_widget_get_window (widget),
external_border, 0, 1, 1);
gtk_widget_queue_resize (widget);
@@ -760,7 +760,7 @@ hildon_app_menu_repack_filters (HildonAppMenu *menu)
for (iter = priv->filters; iter != NULL; iter = iter->next) {
GtkWidget *filter = GTK_WIDGET (iter->data);
- if (GTK_WIDGET_VISIBLE (filter)) {
+ if (gtk_widget_get_visible (filter)) {
gtk_box_pack_start (GTK_BOX (priv->filters_hbox), filter, TRUE, TRUE, 0);
g_object_unref (filter);
/* GtkButton must be realized for accelerators to work */
@@ -787,7 +787,7 @@ hildon_app_menu_repack_items (HildonAppMenu *menu,
i = nvisible = 0;
for (iter = priv->buttons; iter != NULL; iter = iter->next) {
/* Count number of visible items */
- if (GTK_WIDGET_VISIBLE (iter->data))
+ if (gtk_widget_get_visible (iter->data))
nvisible++;
/* Remove buttons from their parent */
if (start_from != -1 && i >= start_from) {
@@ -813,7 +813,7 @@ hildon_app_menu_repack_items (HildonAppMenu *menu,
row = col = 0;
for (iter = priv->buttons; iter != NULL; iter = iter->next) {
GtkWidget *item = GTK_WIDGET (iter->data);
- if (GTK_WIDGET_VISIBLE (item)) {
+ if (gtk_widget_get_visible (item)) {
/* Don't add an item to the table if it's already there */
if (gtk_widget_get_parent (item) == NULL) {
gtk_table_attach_defaults (priv->table, item, col, col + 1, row, row + 1);
@@ -854,10 +854,10 @@ hildon_app_menu_has_visible_children (HildonAppMenu *menu)
/* Don't show menu if it doesn't contain visible items */
for (i = priv->buttons; i && !show_menu; i = i->next)
- show_menu = GTK_WIDGET_VISIBLE (i->data);
+ show_menu = gtk_widget_get_visible (i->data);
for (i = priv->filters; i && !show_menu; i = i->next)
- show_menu = GTK_WIDGET_VISIBLE (i->data);
+ show_menu = gtk_widget_get_visible (i->data);
return show_menu;
}
diff --git a/hildon/hildon-banner.c b/hildon/hildon-banner.c
index 8339866..305d46c 100644
--- a/hildon/hildon-banner.c
+++ b/hildon/hildon-banner.c
@@ -144,8 +144,8 @@ hildon_banner_get_property (GObject *object,
GParamSpec *pspec);
static void
-hildon_banner_destroy (GtkObject *object);
-
+hildon_banner_destroy (GtkWidget *object);
+
static GObject*
hildon_banner_real_get_instance (GObject *window,
gboolean timed);
@@ -261,10 +261,10 @@ simulate_close (GtkWidget* widget)
we simulate clicking the close button of the window.
This allows applications to reuse the banner by prevent
closing it etc */
- if (GTK_WIDGET_DRAWABLE (widget))
+ if (gtk_widget_is_drawable (widget))
{
GdkEvent *event = gdk_event_new (GDK_DELETE);
- event->any.window = g_object_ref (widget->window);
+ event->any.window = g_object_ref (gtk_widget_get_window (widget));
event->any.send_event = FALSE;
result = gtk_widget_event (widget, event);
gdk_event_free (event);
@@ -274,11 +274,12 @@ simulate_close (GtkWidget* widget)
}
static void
-hildon_banner_size_request (GtkWidget *self,
- GtkRequisition *req)
+hildon_banner_get_preferred_width (GtkWidget *self,
+ gint *minimal_width,
+ gint *natural_width)
{
- GTK_WIDGET_CLASS (hildon_banner_parent_class)->size_request (self, req);
- req->width = gdk_screen_get_width (gtk_widget_get_screen (self));
+ GTK_WIDGET_CLASS (hildon_banner_parent_class)->get_preferred_width (self, minimal_width, natural_width);
+ *natural_width = gdk_screen_get_width (gtk_widget_get_screen (self));
}
static gboolean
@@ -406,7 +407,7 @@ hildon_banner_get_property (GObject *object,
}
static void
-hildon_banner_destroy (GtkObject *object)
+hildon_banner_destroy (GtkWidget *object)
{
HildonBannerPrivate *priv = HILDON_BANNER_GET_PRIVATE (object);
g_assert (priv);
@@ -434,8 +435,8 @@ hildon_banner_destroy (GtkObject *object)
(void) hildon_banner_clear_timeout (self);
- if (GTK_OBJECT_CLASS (hildon_banner_parent_class)->destroy)
- GTK_OBJECT_CLASS (hildon_banner_parent_class)->destroy (object);
+ if (GTK_WIDGET_CLASS (hildon_banner_parent_class)->destroy)
+ GTK_WIDGET_CLASS (hildon_banner_parent_class)->destroy (object);
}
/* Search a previous banner instance */
@@ -644,7 +645,7 @@ screen_size_changed (GdkScreen *screen,
{
HildonBanner *hbanner = HILDON_BANNER (banner);
banner_set_label_size_request (hbanner);
- if (GTK_WIDGET_VISIBLE (banner)) {
+ if (gtk_widget_get_visible (GTK_WIDGET (banner))) {
hildon_banner_bind_style (hbanner);
reshow_banner (hbanner);
}
@@ -661,15 +662,15 @@ hildon_banner_realize (GtkWidget *widget)
HildonBannerPrivate *priv = HILDON_BANNER_GET_PRIVATE (widget);
g_assert (priv);
- /* We let the parent to init widget->window before we need it */
+ /* We let the parent to init gtk_widget_get_window (widget) before we need it */
if (GTK_WIDGET_CLASS (hildon_banner_parent_class)->realize)
GTK_WIDGET_CLASS (hildon_banner_parent_class)->realize (widget);
/* We use special hint to turn the banner into information notification. */
- gdk_window_set_type_hint (widget->window, GDK_WINDOW_TYPE_HINT_NOTIFICATION);
+ gdk_window_set_type_hint (gtk_widget_get_window (widget), GDK_WINDOW_TYPE_HINT_NOTIFICATION);
gtk_window_set_transient_for (GTK_WINDOW (widget), (GtkWindow *) priv->parent);
- gdkwin = widget->window;
+ gdkwin = gtk_widget_get_window (widget);
/* Set the _HILDON_NOTIFICATION_TYPE property so Matchbox places the window correctly */
atom = gdk_atom_intern ("_HILDON_NOTIFICATION_TYPE", FALSE);
@@ -721,12 +722,13 @@ hildon_banner_class_init (HildonBannerClass *klass)
object_class->finalize = hildon_banner_finalize;
object_class->set_property = hildon_banner_set_property;
object_class->get_property = hildon_banner_get_property;
- GTK_OBJECT_CLASS (klass)->destroy = hildon_banner_destroy;
- widget_class->size_request = hildon_banner_size_request;
+
+ widget_class->get_preferred_width = hildon_banner_get_preferred_width;
widget_class->map_event = hildon_banner_map_event;
widget_class->realize = hildon_banner_realize;
widget_class->unrealize = hildon_banner_unrealize;
widget_class->button_press_event = hildon_banner_button_press_event;
+ widget_class->destroy = hildon_banner_destroy;
/* Install properties.
We need construct properties for singleton purposes */
@@ -868,7 +870,7 @@ hildon_banner_set_override_flag (HildonBanner *banner)
{
guint32 state = 1;
- gdk_property_change (GTK_WIDGET (banner)->window,
+ gdk_property_change (gtk_widget_get_window (GTK_WIDGET (banner)),
gdk_atom_intern_static_string ("_HILDON_DO_NOT_DISTURB_OVERRIDE"),
gdk_x11_xatom_to_atom (XA_INTEGER),
32,
@@ -1081,7 +1083,7 @@ hildon_banner_set_text (HildonBanner *self,
banner_do_set_text (self, text, FALSE);
- if (GTK_WIDGET_VISIBLE (self))
+ if (gtk_widget_get_visible (GTK_WIDGET (self)))
reshow_banner (self);
}
@@ -1101,7 +1103,7 @@ hildon_banner_set_markup (HildonBanner *self,
banner_do_set_text (self, markup, TRUE);
- if (GTK_WIDGET_VISIBLE (self))
+ if (gtk_widget_get_visible (GTK_WIDGET (self)))
reshow_banner (self);
}
diff --git a/hildon/hildon-caption.c b/hildon/hildon-caption.c
index ed01355..9f6bda6 100644
--- a/hildon/hildon-caption.c
+++ b/hildon/hildon-caption.c
@@ -57,9 +57,15 @@ hildon_caption_class_init (HildonCaptionClass *caption_cla
static void
hildon_caption_init (HildonCaption *caption);
-static void
-hildon_caption_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+static void
+hildon_caption_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width);
+
+static void
+hildon_caption_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height);
static void
hildon_caption_size_allocate (GtkWidget *widget,
@@ -99,7 +105,7 @@ hildon_caption_get_property (GObject *object,
GParamSpec *pspec);
static void
-hildon_caption_destroy (GtkObject *self);
+hildon_caption_destroy (GtkWidget *self);
static gboolean
hildon_caption_button_press (GtkWidget *widget,
@@ -190,17 +196,18 @@ hildon_caption_class_init (HildonCaptionClass *caption_cla
gobject_class->get_property = hildon_caption_get_property;
gobject_class->set_property = hildon_caption_set_property;
caption_class->activate = (gpointer) hildon_caption_activate;
- GTK_OBJECT_CLASS(caption_class)->destroy = hildon_caption_destroy;
container_class->forall = hildon_caption_forall;
container_class->set_child_property = hildon_caption_set_child_property;
container_class->get_child_property = hildon_caption_get_child_property;
widget_class->hierarchy_changed = hildon_caption_hierarchy_changed;
- widget_class->size_request = hildon_caption_size_request;
+ widget_class->get_preferred_width = hildon_caption_get_preferred_width;
+ widget_class->get_preferred_height = hildon_caption_get_preferred_height;
widget_class->size_allocate = hildon_caption_size_allocate;
widget_class->button_press_event = hildon_caption_button_press;
widget_class->grab_focus = hildon_caption_grab_focus;
+ widget_class->destroy = hildon_caption_destroy;
/* Create new signals and properties */
widget_class->activate_signal = g_signal_new ("activate",
@@ -305,7 +312,7 @@ hildon_caption_class_init (HildonCaptionClass *caption_cla
/* Destroy can be called multiple times, remember to set pointers to NULL */
static void
-hildon_caption_destroy (GtkObject *self)
+hildon_caption_destroy (GtkWidget *self)
{
HildonCaptionPrivate *priv = HILDON_CAPTION_GET_PRIVATE (self);
@@ -330,8 +337,8 @@ hildon_caption_destroy (GtkObject *self)
}
/* Parent classes destroy takes care of user packed contents */
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- GTK_OBJECT_CLASS (parent_class)->destroy (self);
+ if (GTK_WIDGET_CLASS (parent_class)->destroy)
+ GTK_WIDGET_CLASS (parent_class)->destroy (self);
}
static void
@@ -510,8 +517,8 @@ static gboolean
hildon_caption_button_press (GtkWidget *widget,
GdkEventButton *event)
{
- gtk_widget_grab_focus (GTK_BIN (widget)->child);
-
+ gtk_widget_grab_focus (gtk_bin_get_child (GTK_BIN (widget)));
+
/* we'll update our focused state in set-focus when/if the child receives
* focus */
@@ -618,26 +625,53 @@ hildon_caption_hierarchy_changed (GtkWidget *widget,
G_CALLBACK (hildon_caption_set_focus), widget );
}
-static void
-hildon_caption_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+static void
+hildon_caption_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
{
- GtkRequisition req;
+ gint caption_minimal, caption_natural;
HildonCaptionPrivate *priv = NULL;
+ GtkStyle *style;
g_return_if_fail (HILDON_IS_CAPTION(widget));
priv = HILDON_CAPTION_GET_PRIVATE (widget);
- /* Use the same size requisition for the main box of the caption */
- gtk_widget_size_request (priv->caption_area, &req);
+ /* Use the height for the main box of the caption */
+ gtk_widget_get_preferred_height (priv->caption_area, &caption_minimal, &caption_natural);
+
+ if (GTK_WIDGET_CLASS (parent_class)->get_preferred_height)
+ GTK_WIDGET_CLASS (parent_class)->get_preferred_height (widget, minimal_height, natural_height);
- if (GTK_WIDGET_CLASS (parent_class)->size_request)
- GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
+ g_object_get (widget, "style", &style, NULL);
- requisition->width += req.width + HILDON_CAPTION_SPACING * 3;
+ if ((caption_minimal + (2 * style->ythickness)) > *minimal_height)
+ *minimal_height = caption_minimal + (2 * style->ythickness);
+ if ((caption_natural + (2 * style->ythickness)) > *natural_height)
+ *natural_height = caption_natural + (2 * style->ythickness);
- if ((req.height + (2 * widget->style->ythickness)) > requisition->height)
- requisition->height = req.height + (2 * widget->style->ythickness);
+ g_object_unref (style);
+}
+
+static void
+hildon_caption_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ gint caption_minimal, caption_natural;
+ HildonCaptionPrivate *priv = NULL;
+ g_return_if_fail (HILDON_IS_CAPTION(widget));
+
+ priv = HILDON_CAPTION_GET_PRIVATE (widget);
+
+ /* Use the width for the main box of the caption */
+ gtk_widget_get_preferred_width (priv->caption_area, &caption_minimal, &caption_natural);
+
+ if (GTK_WIDGET_CLASS (parent_class)->get_preferred_width)
+ GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, minimal_width, natural_width);
+
+ *minimal_width += caption_minimal + HILDON_CAPTION_SPACING * 3;
+ *natural_width += caption_natural + HILDON_CAPTION_SPACING * 3;
}
/* We use HILDON_CAPTION_SPACING to make it look a bit nicer */
@@ -651,6 +685,7 @@ hildon_caption_size_allocate (GtkWidget *widget,
GtkWidget *child = NULL;
HildonCaptionPrivate *priv = NULL;
gboolean rtl;
+ guint border_width;
g_assert (HILDON_IS_CAPTION (widget));
priv = HILDON_CAPTION_GET_PRIVATE (widget);
@@ -659,18 +694,21 @@ hildon_caption_size_allocate (GtkWidget *widget,
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
/* Position the caption to its allocated location */
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x + GTK_CONTAINER (widget)->border_width,
- allocation->y + GTK_CONTAINER (widget)->border_width,
- MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0),
- MAX (allocation->height - GTK_CONTAINER (widget)->border_width * 2, 0));
-
- child = GTK_BIN (widget)->child;
+ if (gtk_widget_get_realized (widget))
+ {
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+ gdk_window_move_resize (gtk_widget_get_window (widget),
+ allocation->x + border_width,
+ allocation->y + border_width,
+ MAX (allocation->width - border_width * 2, 0),
+ MAX (allocation->height - border_width * 2, 0));
+ }
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
if (child)
gtk_widget_get_child_requisition (child, &child_req);
- widget->allocation = *allocation;
+ gtk_widget_size_allocate (widget, allocation);
gtk_widget_get_child_requisition (priv->caption_area, &req);
child_alloc.height = caption_alloc.height = allocation->height;
@@ -702,13 +740,13 @@ hildon_caption_size_allocate (GtkWidget *widget,
}
/* Give the child at least its minimum requisition, unless it is expandable */
- if (! priv->expand && child && GTK_WIDGET_VISIBLE(child))
+ if (! priv->expand && child && gtk_widget_get_visible (child))
{
child_alloc.width = MIN (child_alloc.width, child_req.width);
child_alloc.height = MIN (child_alloc.height, child_req.height);
/* Center the child */
child_alloc.y = (allocation->height - child_alloc.height -
- 2 * GTK_CONTAINER (widget)->border_width)/2;
+ 2 * gtk_container_get_border_width (GTK_CONTAINER (widget)))/2;
}
/* Ensure there are no negative dimensions */
@@ -725,7 +763,7 @@ hildon_caption_size_allocate (GtkWidget *widget,
child_alloc.height = MAX (child_alloc.height, 0);
caption_alloc.height = MAX (caption_alloc.height, 0);
- if (child && GTK_WIDGET_VISIBLE(child) )
+ if (child && gtk_widget_get_visible (child) )
gtk_widget_size_allocate (child, &child_alloc );
gtk_widget_size_allocate (priv->caption_area, &caption_alloc);
@@ -1072,14 +1110,14 @@ hildon_caption_get_separator (const HildonCaption *caption)
static void
hildon_caption_activate (GtkWidget *widget)
{
- GtkWidget *child = GTK_BIN (widget)->child;
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
gtk_widget_grab_focus (child);
}
static void
hildon_caption_grab_focus (GtkWidget *widget)
{
- gtk_widget_grab_focus (GTK_BIN (widget)->child);
+ gtk_widget_grab_focus (gtk_bin_get_child (GTK_BIN (widget)));
}
/**
@@ -1104,13 +1142,13 @@ hildon_caption_set_child_expand (HildonCaption *caption,
return;
priv->expand = expand;
- child = GTK_BIN (caption)->child;
+ child = gtk_bin_get_child (GTK_BIN (caption));
/* We do not have a child, nothing to do */
if (! GTK_IS_WIDGET (child))
return;
- if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (caption))
+ if (gtk_widget_get_visible (child) && gtk_widget_get_visible (GTK_WIDGET (caption)))
gtk_widget_queue_resize (child);
gtk_widget_child_notify (child, "expand");
diff --git a/hildon/hildon-date-selector.c b/hildon/hildon-date-selector.c
index bdcef93..a530214 100644
--- a/hildon/hildon-date-selector.c
+++ b/hildon/hildon-date-selector.c
@@ -248,14 +248,8 @@ static void
hildon_date_selector_class_init (HildonDateSelectorClass * class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
/* GObject */
gobject_class->finalize = hildon_date_selector_finalize;
@@ -295,7 +289,7 @@ hildon_date_selector_class_init (HildonDateSelectorClass * class)
/* signals */
- g_type_class_add_private (object_class, sizeof (HildonDateSelectorPrivate));
+ g_type_class_add_private (class, sizeof (HildonDateSelectorPrivate));
}
static void
@@ -369,7 +363,7 @@ hildon_date_selector_init (HildonDateSelector * selector)
{
selector->priv = HILDON_DATE_SELECTOR_GET_PRIVATE (selector);
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (selector), GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (selector), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (selector), FALSE);
hildon_touch_selector_set_print_func (HILDON_TOUCH_SELECTOR (selector),
@@ -558,14 +552,11 @@ static GtkTreeModel *
_create_year_model (HildonDateSelector * selector)
{
GtkListStore *store_years = NULL;
- gint real_year = 0;
gint i = 0;
static gchar label[255];
struct tm tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
GtkTreeIter iter;
- real_year = selector->priv->creation_year;
-
store_years = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
for (i = selector->priv->min_year; i < selector->priv->max_year + 1; i++) {
tm.tm_year = i - 1900;
diff --git a/hildon/hildon-defines.h b/hildon/hildon-defines.h
index 30547e8..9625b24 100644
--- a/hildon/hildon-defines.h
+++ b/hildon/hildon-defines.h
@@ -239,77 +239,77 @@ G_BEGIN_DECLS
*
* Key definition for the Up hardkey.
*/
-#define HILDON_HARDKEY_UP GDK_Up
+#define HILDON_HARDKEY_UP GDK_KEY_Up
/**
* HILDON_HARDKEY_LEFT:
*
* Key definition for the Left hardkey.
*/
-#define HILDON_HARDKEY_LEFT GDK_Left
+#define HILDON_HARDKEY_LEFT GDK_KEY_Left
/**
* HILDON_HARDKEY_RIGHT:
*
* Key definition for the Right hardkey.
*/
-#define HILDON_HARDKEY_RIGHT GDK_Right
+#define HILDON_HARDKEY_RIGHT GDK_KEY_Right
/**
* HILDON_HARDKEY_DOWN:
*
* Key definition for the Down hardkey.
*/
-#define HILDON_HARDKEY_DOWN GDK_Down
+#define HILDON_HARDKEY_DOWN GDK_KEY_Down
/**
* HILDON_HARDKEY_SELECT:
*
* Key definition for the Select hardkey.
*/
-#define HILDON_HARDKEY_SELECT GDK_Return
+#define HILDON_HARDKEY_SELECT GDK_KEY_Return
/**
* HILDON_HARDKEY_Menu:
*
* Key definition for the Menu hardkey.
*/
-#define HILDON_HARDKEY_MENU GDK_F4
+#define HILDON_HARDKEY_MENU GDK_KEY_F4
/**
* HILDON_HARDKEY_HOME:
*
* Key definition for the Home hardkey.
*/
-#define HILDON_HARDKEY_HOME GDK_F5
+#define HILDON_HARDKEY_HOME GDK_KEY_F5
/**
* HILDON_HARDKEY_ESC:
*
* Key definition for the Esc hardkey.
*/
-#define HILDON_HARDKEY_ESC GDK_Escape
+#define HILDON_HARDKEY_ESC GDK_KEY_Escape
/**
* HILDON_HARDKEY_FULLSCREEN:
*
* Key definition for the Fullscreen hardkey.
*/
-#define HILDON_HARDKEY_FULLSCREEN GDK_F6
+#define HILDON_HARDKEY_FULLSCREEN GDK_KEY_F6
/**
* HILDON_HARDKEY_INCREASE:
*
* Key definition for the Increase hardkey.
*/
-#define HILDON_HARDKEY_INCREASE GDK_F7
+#define HILDON_HARDKEY_INCREASE GDK_KEY_F7
/**
* HILDON_HARDKEY_DECREASE:
*
* Key definition for the Decrease hardkey.
*/
-#define HILDON_HARDKEY_DECREASE GDK_F8
+#define HILDON_HARDKEY_DECREASE GDK_KEY_F8
gint
hildon_get_icon_pixel_size (GtkIconSize size);
diff --git a/hildon/hildon-edit-toolbar.c b/hildon/hildon-edit-toolbar.c
index 7db0ecc..b2aab93 100644
--- a/hildon/hildon-edit-toolbar.c
+++ b/hildon/hildon-edit-toolbar.c
@@ -118,21 +118,17 @@ hildon_edit_toolbar_style_set (GtkWidget *widget,
}
static gboolean
-hildon_edit_toolbar_expose (GtkWidget *widget,
- GdkEventExpose *event)
+hildon_edit_toolbar_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- if (GTK_WIDGET_DRAWABLE (widget)) {
- gtk_paint_flat_box (widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- GTK_SHADOW_NONE,
- &event->area, widget, "edit-toolbar",
- widget->allocation.x, widget->allocation.y,
- widget->allocation.width, widget->allocation.height);
- }
+ gtk_render_background (gtk_widget_get_style_context (widget),
+ cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
- if (GTK_WIDGET_CLASS (hildon_edit_toolbar_parent_class)->expose_event)
- return GTK_WIDGET_CLASS (hildon_edit_toolbar_parent_class)->expose_event (widget, event);
+ if (GTK_WIDGET_CLASS (hildon_edit_toolbar_parent_class)->draw)
+ return GTK_WIDGET_CLASS (hildon_edit_toolbar_parent_class)->draw (widget, cr);
return FALSE;
}
@@ -144,7 +140,7 @@ hildon_edit_toolbar_class_init (HildonEditToolbarClass *klass)
GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
widget_class->style_set = hildon_edit_toolbar_style_set;
- widget_class->expose_event = hildon_edit_toolbar_expose;
+ widget_class->draw = hildon_edit_toolbar_draw;
g_type_class_add_private (klass, sizeof (HildonEditToolbarPrivate));
diff --git a/hildon/hildon-find-toolbar-private.h b/hildon/hildon-find-toolbar-private.h
index 0a49845..dc28fd9 100644
--- a/hildon/hildon-find-toolbar-private.h
+++ b/hildon/hildon-find-toolbar-private.h
@@ -32,7 +32,7 @@ typedef struct _HildonFindToolbarPrivate Hildon
struct _HildonFindToolbarPrivate
{
GtkWidget* label;
- GtkComboBoxEntry* entry_combo_box;
+ GtkComboBox* entry_combo_box;
GtkToolItem* separator;
GtkToolItem* close_button;
diff --git a/hildon/hildon-find-toolbar.c b/hildon/hildon-find-toolbar.c
index 23e5a87..c45a35b 100644
--- a/hildon/hildon-find-toolbar.c
+++ b/hildon/hildon-find-toolbar.c
@@ -259,7 +259,7 @@ hildon_find_toolbar_get_property (GObject *object,
break;
case PROP_COLUMN:
- c_n = gtk_combo_box_entry_get_text_column (priv->entry_combo_box);
+ c_n = gtk_combo_box_get_entry_text_column (priv->entry_combo_box);
g_value_set_int (value, c_n);
break;
@@ -309,7 +309,7 @@ hildon_find_toolbar_set_property (GObject *object,
break;
case PROP_COLUMN:
- gtk_combo_box_entry_set_text_column (priv->entry_combo_box,
+ gtk_combo_box_set_entry_text_column (priv->entry_combo_box,
g_value_get_int (value));
break;
@@ -329,12 +329,12 @@ hildon_find_toolbar_set_property (GObject *object,
combobox popup arrow, so we'll just recreate the filter. */
hildon_find_toolbar_apply_filter (self, model);
- if (gtk_combo_box_entry_get_text_column (priv->entry_combo_box) == -1)
+ if (gtk_combo_box_get_entry_text_column (priv->entry_combo_box) == -1)
{
/* FIXME: This is only for backwards compatibility, although
probably nothing actually relies on it. The behavior was only
an accidental side effect of original code */
- gtk_combo_box_entry_set_text_column (priv->entry_combo_box, 0);
+ gtk_combo_box_set_entry_text_column (priv->entry_combo_box, 0);
}
}
break;
@@ -653,7 +653,7 @@ hildon_find_toolbar_init (HildonFindToolbar *self)
gtk_toolbar_insert (GTK_TOOLBAR (self), label_container, -1);
/* ComboBoxEntry for search prefix string / history list */
- priv->entry_combo_box = GTK_COMBO_BOX_ENTRY (gtk_combo_box_entry_new ());
+ priv->entry_combo_box = GTK_COMBO_BOX (gtk_combo_box_new_with_entry ());
entry_combo_box_container = gtk_tool_item_new ();
alignment = GTK_ALIGNMENT (gtk_alignment_new (0, 0.5, 1, 0));
@@ -684,9 +684,9 @@ hildon_find_toolbar_init (HildonFindToolbar *self)
G_CALLBACK(hildon_find_toolbar_emit_close), self);
gtk_widget_show_all(GTK_WIDGET(priv->close_button));
gtk_toolbar_insert (GTK_TOOLBAR(self), priv->close_button, -1);
- if ( GTK_WIDGET_CAN_FOCUS( GTK_BIN(priv->close_button)->child) )
- GTK_WIDGET_UNSET_FLAGS(
- GTK_BIN(priv->close_button)->child, GTK_CAN_FOCUS);
+ if ( gtk_widget_get_can_focus ( gtk_bin_get_child (GTK_BIN (priv->close_button)) ) )
+ gtk_widget_set_can_focus (
+ gtk_bin_get_child (GTK_BIN (priv->close_button)), FALSE);
}
/**
diff --git a/hildon/hildon-gtk.c b/hildon/hildon-gtk.c
index 747a27c..3b06bbe 100644
--- a/hildon/hildon-gtk.c
+++ b/hildon/hildon-gtk.c
@@ -36,7 +36,7 @@ image_visible_changed_cb (GtkWidget *image,
GParamSpec *arg1,
gpointer oldparent)
{
- if (!GTK_WIDGET_VISIBLE (image))
+ if (!gtk_widget_get_visible (image))
gtk_widget_show (image);
}
@@ -372,7 +372,7 @@ hildon_gtk_window_take_screenshot (GtkWindow *window,
XEvent xev = { 0 };
g_return_if_fail (GTK_IS_WINDOW (window));
- g_return_if_fail (GTK_WIDGET_MAPPED (window));
+ g_return_if_fail (gtk_widget_get_mapped (window));
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
@@ -382,7 +382,7 @@ hildon_gtk_window_take_screenshot (GtkWindow *window,
xev.xclient.message_type = XInternAtom (xev.xclient.display, "_HILDON_LOADING_SCREENSHOT", False);
xev.xclient.format = 32;
xev.xclient.data.l[0] = take ? 0 : 1;
- xev.xclient.data.l[1] = GDK_WINDOW_XID (GTK_WIDGET (window)->window);
+ xev.xclient.data.l[1] = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window)));
XSendEvent (xev.xclient.display,
xev.xclient.window,
@@ -403,7 +403,7 @@ screenshot_done (Display *dpy, const XEvent *event, GtkWindow *window)
&& event->xclient.message_type == XInternAtom (dpy,
"_HILDON_LOADING_SCREENSHOT",
False)
- && event->xclient.window == GDK_WINDOW_XID (GTK_WIDGET (window)->window);
+ && event->xclient.window == GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window)));
}
/**
@@ -424,7 +424,7 @@ hildon_gtk_window_take_screenshot_sync (GtkWindow *window,
XEvent foo;
GdkWindow *win;
- win = GTK_WIDGET (window)->window;
+ win = gtk_widget_get_window (GTK_WIDGET (window));
hildon_gtk_window_take_screenshot (window, take);
XIfEvent (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (window))),
&foo, (void *)screenshot_done, (XPointer)window);
diff --git a/hildon/hildon-helper.c b/hildon/hildon-helper.c
index f07355b..9410907 100644
--- a/hildon/hildon-helper.c
+++ b/hildon/hildon-helper.c
@@ -218,12 +218,13 @@ hildon_change_style_recursive_from_list (GtkWidget *widget,
HildonLogicalElement *element = (HildonLogicalElement *) iterator->data;
if (element->is_color == TRUE) {
-
+ GtkStyle *style;
/* Changing logical color */
GdkColor color;
gtk_widget_ensure_style (widget);
- if (gtk_style_lookup_color (widget->style, element->logical_color_name, &color) == TRUE) {
-
+ g_object_get (widget, "style", &style, NULL);
+ if (gtk_style_lookup_color (style, element->logical_color_name, &color) == TRUE) {
+
switch (element->rc_flags)
{
case GTK_RC_FG:
@@ -243,6 +244,7 @@ hildon_change_style_recursive_from_list (GtkWidget *widget,
break;
}
}
+ g_object_unref (style);
} else {
/* Changing logical font */
@@ -404,13 +406,16 @@ hildon_helper_set_logical_color (GtkWidget *widget,
* Finger-Sized scrollbar should always be used together with finger-sized content.
**/
void
-hildon_helper_set_thumb_scrollbar (GtkScrolledWindow *win,
+hildon_helper_set_thumb_scrollbar (GtkScrolledWindow *win,
gboolean thumb)
{
+ GtkWidget *vscrollbar;
+
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (win));
- if (win->vscrollbar)
- gtk_widget_set_name (win->vscrollbar, (thumb) ? "hildon-thumb-scrollbar" : NULL);
+ vscrollbar = gtk_scrolled_window_get_vscrollbar (win);
+ if (vscrollbar)
+ gtk_widget_set_name (vscrollbar, (thumb) ? "hildon-thumb-scrollbar" : NULL);
}
/**
diff --git a/hildon/hildon-live-search.c b/hildon/hildon-live-search.c
index c626b62..aae7d43 100644
--- a/hildon/hildon-live-search.c
+++ b/hildon/hildon-live-search.c
@@ -554,12 +554,12 @@ on_key_press_event (GtkWidget *widget,
g_return_val_if_fail (HILDON_IS_LIVE_SEARCH (live_search), FALSE);
priv = live_search->priv;
- if (GTK_WIDGET_VISIBLE (priv->kb_focus_widget)) {
+ if (gtk_widget_get_visible (priv->kb_focus_widget)) {
/* If the live search is hidden, Ctrl+whatever is always
* passed to the focus widget, with the exception of
* Ctrl + Space, which is given to the entry, so that the input method
* is allowed to switch the keyboard layout. */
- if (GTK_WIDGET_VISIBLE (live_search) ||
+ if (gtk_widget_get_visible (live_search) ||
!(event->state & GDK_CONTROL_MASK ||
event->keyval == GDK_Control_L ||
event->keyval == GDK_Control_R) ||
@@ -818,7 +818,7 @@ hildon_live_search_init (HildonLiveSearch *self)
HILDON_ICON_SIZE_FINGER);
gtk_misc_set_padding (GTK_MISC (close), 0, 0);
close_button = gtk_tool_button_new (close, NULL);
- GTK_WIDGET_UNSET_FLAGS (close_button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (close_button, FALSE);
close_button_alignment = gtk_alignment_new (0.0f, 0.0f, 1.0f, 1.0f);
gtk_alignment_set_padding (GTK_ALIGNMENT (close_button_alignment),
@@ -1005,7 +1005,7 @@ hildon_live_search_set_text_column (HildonLiveSearch *livesearch,
}
static void
-on_widget_destroy (GtkObject *object,
+on_widget_destroy (GtkWidget *object,
gpointer user_data)
{
hildon_live_search_widget_unhook (HILDON_LIVE_SEARCH (user_data));
diff --git a/hildon/hildon-note.c b/hildon/hildon-note.c
index ac74028..b845027 100644
--- a/hildon/hildon-note.c
+++ b/hildon/hildon-note.c
@@ -131,8 +131,9 @@ static void
hildon_note_unrealize (GtkWidget *widget);
static void
-hildon_note_size_request (GtkWidget *note,
- GtkRequisition *req);
+hildon_note_get_preferred_width (GtkWidget *note,
+ gint *minimal_width,
+ gint *natural_width);
static void
label_size_request (GtkWidget *label,
@@ -243,8 +244,7 @@ hildon_note_set_property (GObject *object,
if (widget)
{
- g_object_ref (widget);
- gtk_object_sink (GTK_OBJECT (widget));
+ g_object_ref_sink (G_OBJECT (widget));
}
hildon_note_rebuild (note);
@@ -343,7 +343,7 @@ hildon_note_class_init (HildonNoteClass *class)
object_class->get_property = hildon_note_get_property;
widget_class->realize = hildon_note_realize;
widget_class->unrealize = hildon_note_unrealize;
- widget_class->size_request = hildon_note_size_request;
+ widget_class->get_preferred_width = hildon_note_get_preferred_width;
/**
* HildonNote:type:
@@ -421,7 +421,6 @@ hildon_note_init (HildonNote *dialog)
g_object_ref_sink (priv->event_box);
g_object_ref_sink (priv->label);
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
/* We use special hint to turn the note into information notification. */
@@ -494,36 +493,37 @@ hildon_note_orientation_update (HildonNote *note, GdkScreen *screen)
gint button_width, padding;
gboolean portrait = gdk_screen_get_width (screen) < gdk_screen_get_height (screen);
- g_object_ref (dialog->action_area);
- unpack_widget (dialog->action_area);
+ g_object_ref (gtk_dialog_get_action_area (dialog));
+ unpack_widget (gtk_dialog_get_action_area (dialog));
if (portrait) {
- parent = dialog->vbox;
+ parent = gtk_dialog_get_content_area (dialog);
button_width = gdk_screen_get_width (screen) - HILDON_MARGIN_DOUBLE * 2;
padding = HILDON_MARGIN_DOUBLE;
} else {
- parent = gtk_widget_get_parent (dialog->vbox);
+ parent = gtk_widget_get_parent (gtk_dialog_get_content_area (dialog));
button_width = priv->button_width;
padding = 0;
}
- gtk_box_pack_end (GTK_BOX (parent), dialog->action_area,
+ gtk_box_pack_end (GTK_BOX (parent), gtk_dialog_get_action_area (dialog),
portrait, TRUE, 0);
- gtk_box_reorder_child (GTK_BOX (parent), dialog->action_area, 0);
- gtk_container_foreach (GTK_CONTAINER (dialog->action_area),
+ gtk_box_reorder_child (GTK_BOX (parent), gtk_dialog_get_action_area (dialog), 0);
+ gtk_container_foreach (GTK_CONTAINER (gtk_dialog_get_action_area (dialog)),
(GtkCallback) resize_button,
GINT_TO_POINTER (button_width));
- g_object_unref (dialog->action_area);
+ g_object_unref (gtk_dialog_get_action_area (dialog));
gtk_container_child_set (GTK_CONTAINER (priv->box), priv->label,
"padding", padding, NULL);
}
static void
-hildon_note_size_request (GtkWidget *note,
- GtkRequisition *req)
+hildon_note_get_preferred_width (GtkWidget *note,
+ gint *minimal_width,
+ gint *natural_width)
{
- GTK_WIDGET_CLASS (parent_class)->size_request (note, req);
- req->width = gdk_screen_get_width (gtk_widget_get_screen (note));
+ GTK_WIDGET_CLASS (parent_class)->get_preferred_width (note, minimal_width, natural_width);
+ *natural_width = gdk_screen_get_width (gtk_widget_get_screen (note));
}
static void
@@ -555,14 +555,14 @@ hildon_note_realize (GtkWidget *widget)
HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE (widget);
g_assert (priv);
- /* Make widget->window accessible */
+ /* Make widget window accessible */
GTK_WIDGET_CLASS (parent_class)->realize (widget);
/* Border only, no titlebar */
- gdk_window_set_decorations (widget->window, GDK_DECOR_BORDER);
+ gdk_window_set_decorations (gtk_widget_get_window (widget), GDK_DECOR_BORDER);
/* Set the _HILDON_NOTIFICATION_TYPE property so Matchbox places the window correctly */
- display = gdk_drawable_get_display (widget->window);
+ display = gdk_window_get_display (gtk_widget_get_window (widget));
atom = gdk_x11_get_xatom_by_name_for_display (display, "_HILDON_NOTIFICATION_TYPE");
if (priv->note_n == HILDON_NOTE_TYPE_INFORMATION) {
@@ -572,7 +572,7 @@ hildon_note_realize (GtkWidget *widget)
notification_type = "_HILDON_NOTIFICATION_TYPE_CONFIRMATION";
}
- XChangeProperty (GDK_WINDOW_XDISPLAY (widget->window), GDK_WINDOW_XID (widget->window),
+ XChangeProperty (GDK_WINDOW_XDISPLAY (gtk_widget_get_window (widget)), GDK_WINDOW_XID (gtk_widget_get_window (widget)),
atom, XA_STRING, 8, PropModeReplace, (guchar *) notification_type,
strlen (notification_type));
@@ -608,8 +608,8 @@ unpack_widget (GtkWidget *widget)
{
g_assert (widget == NULL || GTK_IS_WIDGET (widget));
- if (widget && widget->parent)
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+ if (widget && gtk_widget_get_parent (widget))
+ gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)), widget);
}
/*
@@ -710,11 +710,11 @@ hildon_note_rebuild (HildonNote *note)
* left
*/
if (is_info_note) {
- gtk_widget_hide (dialog->action_area);
+ gtk_widget_hide (gtk_dialog_get_action_area (dialog));
} else {
- gtk_widget_show (dialog->action_area);
+ gtk_widget_show (gtk_dialog_get_action_area (dialog));
}
- gtk_widget_set_no_show_all (dialog->action_area, is_info_note);
+ gtk_widget_set_no_show_all (gtk_dialog_get_action_area (dialog), is_info_note);
/* Pack label vertically. Spacing is only necessary for the progressbar note. */
priv->box = gtk_vbox_new (FALSE, 0);
@@ -731,7 +731,7 @@ hildon_note_rebuild (HildonNote *note)
gtk_alignment_set_padding (GTK_ALIGNMENT (priv->align), 0, 0, 0, 0);
}
- gtk_container_add (GTK_CONTAINER (dialog->vbox), priv->event_box);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (dialog)), priv->event_box);
gtk_widget_show_all (priv->event_box);
}
@@ -743,7 +743,7 @@ hildon_note_rebuild (HildonNote *note)
* important so that the window manager could handle the windows
* correctly.
* In GTK the X window ID can be checked using
- * GDK_WINDOW_XID(GTK_WIDGET(parent)->window).
+ * GDK_WINDOW_XID(gtk_widget_get_window (GTK_WIDGET (parent))).
* @description: the message to confirm
* @Varargs: arguments pairs for new buttons(label and return value).
* Terminate the list with %NULL value.
@@ -813,7 +813,7 @@ hildon_note_new_confirmation_add_buttons (GtkWindow *parent,
* has to be the same as the X window ID of the application. This is
* important so that the window manager could handle the windows
* correctly. In GTK the X window ID can be checked using
- * GDK_WINDOW_XID(GTK_WIDGET(parent)->window).
+ * GDK_WINDOW_XID(gtk_widget_get_window (GTK_WIDGET (parent))).
* @description: the message to confirm.
*
* Create a new confirmation note. Confirmation note has a text (description)
@@ -846,7 +846,7 @@ hildon_note_new_confirmation (GtkWindow *parent,
* has to be the same as the X window ID of the application. This is
* important so that the window manager could handle the windows
* correctly. In GTK the X window ID can be checked using
- * GDK_WINDOW_XID(GTK_WIDGET(parent)->window).
+ * GDK_WINDOW_XID(gtk_widget_get_window (GTK_WIDGET (parent))).
* @description: the message to confirm.
*
* Create a new information note. Information note has text (a description)
@@ -881,7 +881,7 @@ hildon_note_new_information (GtkWindow *parent,
* has to be the same as the X window ID of the application. This is
* important so that the window manager could handle the windows
* correctly. In GTK the X window ID can be checked using
- * GDK_WINDOW_XID(GTK_WIDGET(parent)->window).
+ * GDK_WINDOW_XID(gtk_widget_get_window (GTK_WIDGET (parent))).
* @description: the action to cancel.
* @progressbar: a pointer to #GtkProgressBar to be filled with the
* progressbar assigned to this note. Use this to set the fraction of
diff --git a/hildon/hildon-pannable-area.c b/hildon/hildon-pannable-area.c
index 6db7a46..2b8943d 100644
--- a/hildon/hildon-pannable-area.c
+++ b/hildon/hildon-pannable-area.c
@@ -46,17 +46,13 @@
*/
#include <math.h>
-#if USE_CAIRO_SCROLLBARS == 1
#include <cairo.h>
-#endif
-#include <gdk/gdkx.h>
+#include <gdk/gdk.h>
#include "hildon-pannable-area.h"
#include "hildon-marshalers.h"
#include "hildon-enum-types.h"
-#define USE_CAIRO_SCROLLBARS 0
-
#define SCROLL_BAR_MIN_SIZE 5
#define RATIO_TOLERANCE 0.000001
#define SCROLL_FADE_IN_TIMEOUT 50
@@ -155,7 +151,6 @@ struct _HildonPannableAreaPrivate {
GtkPolicyType vscrollbar_policy;
GtkPolicyType hscrollbar_policy;
- GdkGC *scrollbars_gc;
GdkColor scroll_color;
gboolean center_on_child_focus;
@@ -219,8 +214,12 @@ static void hildon_pannable_area_remove_timeouts (GtkWidget * widget);
static void hildon_pannable_area_dispose (GObject * object);
static void hildon_pannable_area_realize (GtkWidget * widget);
static void hildon_pannable_area_unrealize (GtkWidget * widget);
-static void hildon_pannable_area_size_request (GtkWidget * widget,
- GtkRequisition * requisition);
+static void hildon_pannable_area_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static void hildon_pannable_area_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
static void hildon_pannable_area_size_allocate (GtkWidget * widget,
GtkAllocation * allocation);
static void hildon_pannable_area_child_allocate_calculate (GtkWidget * widget,
@@ -233,14 +232,7 @@ static void hildon_pannable_area_unmap (GtkWidget * widget);
static void hildon_pannable_area_grab_notify (GtkWidget *widget,
gboolean was_grabbed,
gpointer user_data);
-#if USE_CAIRO_SCROLLBARS == 1
static void rgb_from_gdkcolor (GdkColor *color, gdouble *r, gdouble *g, gdouble *b);
-#else /* USE_CAIRO_SCROLLBARS */
-static void tranparency_color (GdkColor *color,
- GdkColor colora,
- GdkColor colorb,
- gdouble transparency);
-#endif /* USE_CAIRO_SCROLLBARS */
static void hildon_pannable_draw_vscroll (GtkWidget * widget,
GdkColor *back_color,
GdkColor *scroll_color);
@@ -256,8 +248,8 @@ static void hildon_pannable_area_adjust_value_changed (HildonPannableArea * area
static void hildon_pannable_area_adjust_changed (HildonPannableArea * area,
gpointer data);
static gboolean hildon_pannable_area_scroll_indicator_fade(HildonPannableArea * area);
-static gboolean hildon_pannable_area_expose_event (GtkWidget * widget,
- GdkEventExpose * event);
+static gboolean hildon_pannable_area_draw (GtkWidget * widget,
+ cairo_t * cr);
static GdkWindow * hildon_pannable_area_get_topmost (GdkWindow * window,
gint x, gint y,
gint * tx, gint * ty,
@@ -339,9 +331,10 @@ hildon_pannable_area_class_init (HildonPannableAreaClass * klass)
widget_class->unrealize = hildon_pannable_area_unrealize;
widget_class->map = hildon_pannable_area_map;
widget_class->unmap = hildon_pannable_area_unmap;
- widget_class->size_request = hildon_pannable_area_size_request;
+ widget_class->get_preferred_width = hildon_pannable_area_get_preferred_width;
+ widget_class->get_preferred_height = hildon_pannable_area_get_preferred_height;
widget_class->size_allocate = hildon_pannable_area_size_allocate;
- widget_class->expose_event = hildon_pannable_area_expose_event;
+ widget_class->draw = hildon_pannable_area_draw;
widget_class->style_set = hildon_pannable_area_style_set;
widget_class->button_press_event = hildon_pannable_area_button_press_cb;
widget_class->button_release_event = hildon_pannable_area_button_release_cb;
@@ -715,7 +708,7 @@ hildon_pannable_area_init (HildonPannableArea * area)
{
HildonPannableAreaPrivate *priv = PANNABLE_AREA_PRIVATE (area);
- GTK_WIDGET_UNSET_FLAGS (area, GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (area), TRUE);
area->priv = priv;
@@ -757,7 +750,7 @@ hildon_pannable_area_init (HildonPannableArea * area)
priv->center_on_child_focus_pending = FALSE;
priv->selection_movement = FALSE;
- gtk_style_lookup_color (GTK_WIDGET (area)->style,
+ gtk_style_lookup_color (gtk_widget_get_style (GTK_WIDGET (area)),
"SecondaryTextColor", &priv->scroll_color);
priv->hadjust =
@@ -890,7 +883,7 @@ hildon_pannable_area_set_property (GObject * object,
case PROP_ENABLED:
enabled = g_value_get_boolean (value);
- if ((priv->enabled != enabled) && (GTK_WIDGET_REALIZED (object))) {
+ if ((priv->enabled != enabled) && (gtk_widget_get_realized (GTK_WIDGET (object)))) {
if (enabled)
gdk_window_raise (priv->event_window);
else
@@ -1043,30 +1036,33 @@ hildon_pannable_area_realize (GtkWidget * widget)
gint attributes_mask;
gint border_width;
HildonPannableAreaPrivate *priv;
+ GtkAllocation *allocation = NULL;
priv = HILDON_PANNABLE_AREA (widget)->priv;
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_set_realized (widget, TRUE);
+
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- border_width = GTK_CONTAINER (widget)->border_width;
+ gtk_widget_get_allocation (widget, allocation);
- attributes.x = widget->allocation.x + border_width;
- attributes.y = widget->allocation.y + border_width;
- attributes.width = MAX (widget->allocation.width - 2 * border_width, 0);
- attributes.height = MAX (widget->allocation.height - 2 * border_width, 0);
+ attributes.x = allocation->x + border_width;
+ attributes.y = allocation->y + border_width;
+ attributes.width = MAX (gtk_widget_get_allocated_width (widget) - 2 * border_width, 0);
+ attributes.height = MAX (gtk_widget_get_allocated_height (widget) - 2 * border_width, 0);
attributes.window_type = GDK_WINDOW_CHILD;
/* avoid using the hildon_window */
attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
attributes.wclass = GDK_INPUT_OUTPUT;
- 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;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
+ gtk_widget_set_window (widget,
+ gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask));
+ gdk_window_set_user_data (gtk_widget_get_window (widget), widget);
/* create the events window */
attributes.x = 0;
@@ -1082,15 +1078,13 @@ hildon_pannable_area_realize (GtkWidget * widget)
attributes_mask = GDK_WA_X | GDK_WA_Y;
- priv->event_window = gdk_window_new (widget->window,
+ priv->event_window = gdk_window_new (gtk_widget_get_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget);
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-
- priv->scrollbars_gc = gdk_gc_new (GDK_DRAWABLE (widget->window));
- gdk_gc_copy (priv->scrollbars_gc, widget->style->fg_gc[GTK_STATE_INSENSITIVE]);
+ gtk_widget_style_attach (widget);
+ gtk_style_set_background (gtk_widget_get_style (widget),
+ gtk_widget_get_window (widget), GTK_STATE_NORMAL);
}
@@ -1123,7 +1117,7 @@ hildon_pannable_area_unrealize (GtkWidget * widget)
priv = HILDON_PANNABLE_AREA (widget)->priv;
- if (GTK_WIDGET_MAPPED (widget))
+ if (gtk_widget_get_mapped (widget))
hildon_pannable_area_unmap (widget);
hildon_pannable_area_remove_timeouts (widget);
@@ -1134,55 +1128,58 @@ hildon_pannable_area_unrealize (GtkWidget * widget)
priv->event_window = NULL;
}
- gdk_gc_unref (priv->scrollbars_gc);
-
if (GTK_WIDGET_CLASS (hildon_pannable_area_parent_class)->unrealize)
(*GTK_WIDGET_CLASS (hildon_pannable_area_parent_class)->unrealize)(widget);
}
static void
-hildon_pannable_area_size_request (GtkWidget * widget,
- GtkRequisition * requisition)
+hildon_pannable_area_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
- GtkRequisition child_requisition = {0};
+ gint child_minimum, child_natural;
HildonPannableAreaPrivate *priv = HILDON_PANNABLE_AREA (widget)->priv;
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
- if (child && GTK_WIDGET_VISIBLE (child))
+ if (child && gtk_widget_get_visible (child))
{
- gtk_widget_size_request (child, &child_requisition);
+ gtk_widget_get_preferred_width (child, &child_minimum, &child_natural);
}
if (priv->hscrollbar_policy == GTK_POLICY_NEVER) {
- requisition->width = child_requisition.width;
+ *minimum = child_minimum;
+ *natural = child_natural;
} else {
- switch (priv->size_request_policy) {
- case HILDON_SIZE_REQUEST_CHILDREN:
- requisition->width = MIN (PANNABLE_MAX_WIDTH,
- child_requisition.width);
- break;
- case HILDON_SIZE_REQUEST_MINIMUM:
- default:
- requisition->width = priv->indicator_width;
- }
+ *minimum = *natural = priv->indicator_width;
}
+ *minimum += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+ *natural += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+}
+
+static void
+hildon_pannable_area_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ gint child_minimum, child_natural;
+ HildonPannableAreaPrivate *priv = HILDON_PANNABLE_AREA (widget)->priv;
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
+
+ if (child && gtk_widget_get_visible (child))
+ {
+ gtk_widget_get_preferred_height (child, &child_minimum, &child_natural);
+ }
+
if (priv->vscrollbar_policy == GTK_POLICY_NEVER) {
- requisition->height = child_requisition.height;
+ *minimum = child_minimum;
+ *natural = child_natural;
} else {
- switch (priv->size_request_policy) {
- case HILDON_SIZE_REQUEST_CHILDREN:
- requisition->height = MIN (PANNABLE_MAX_HEIGHT,
- child_requisition.height);
- break;
- case HILDON_SIZE_REQUEST_MINIMUM:
- default:
- requisition->height = priv->indicator_width;
- }
+ *minimum = *natural = priv->indicator_width;
}
- requisition->width += 2 * GTK_CONTAINER (widget)->border_width;
- requisition->height += 2 * GTK_CONTAINER (widget)->border_width;
+ *minimum += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+ *natural += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
}
static void
@@ -1193,7 +1190,7 @@ hildon_pannable_area_child_allocate_calculate (GtkWidget * widget,
gint border_width;
HildonPannableAreaPrivate *priv;
- border_width = GTK_CONTAINER (widget)->border_width;
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
priv = HILDON_PANNABLE_AREA (widget)->priv;
@@ -1231,14 +1228,14 @@ hildon_pannable_area_size_allocate (GtkWidget * widget,
gint border_width;
gdouble hv, vv;
- border_width = GTK_CONTAINER (widget)->border_width;
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
priv = HILDON_PANNABLE_AREA (widget)->priv;
- if (GTK_WIDGET_REALIZED (widget)) {
- gdk_window_move_resize (widget->window,
+ if (gtk_widget_get_realized (widget)) {
+ gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x + border_width,
allocation->y + border_width,
allocation->width - border_width * 2,
@@ -1250,7 +1247,7 @@ hildon_pannable_area_size_allocate (GtkWidget * widget,
allocation->height - border_width * 2);
}
- if (child && GTK_WIDGET_VISIBLE (child)) {
+ if (child && gtk_widget_get_visible (child)) {
hildon_pannable_area_check_scrollbars (HILDON_PANNABLE_AREA (widget));
@@ -1268,30 +1265,30 @@ hildon_pannable_area_size_allocate (GtkWidget * widget,
gtk_widget_size_allocate (child, &child_allocation);
}
- if (priv->vadjust->page_size >= 0) {
+ if (gtk_adjustment_get_page_size (priv->vadjust) >= 0) {
priv->accel_vel_y = MIN (priv->vmax,
- priv->vadjust->upper/priv->vadjust->page_size*ACCEL_FACTOR);
+ gtk_adjustment_get_upper (priv->vadjust) / gtk_adjustment_get_page_size (priv->vadjust) * ACCEL_FACTOR);
priv->accel_vel_x = MIN (priv->vmax,
- priv->hadjust->upper/priv->hadjust->page_size*ACCEL_FACTOR);
+ gtk_adjustment_get_upper (priv->hadjust) / gtk_adjustment_get_page_size (priv->hadjust) * ACCEL_FACTOR);
}
- hv = priv->hadjust->value;
- vv = priv->vadjust->value;
+ hv = gtk_adjustment_get_value (priv->hadjust);
+ vv = gtk_adjustment_get_value (priv->vadjust);
/* we have to do this after child size_allocate because page_size is
* changed when we allocate the size of the children */
if (priv->overshot_dist_y < 0) {
- priv->vadjust->value = priv->vadjust->upper - priv->vadjust->page_size;
+ gtk_adjustment_set_value (priv->vadjust, gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_page_size (priv->vadjust));
}
if (priv->overshot_dist_x < 0) {
- priv->hadjust->value = priv->hadjust->upper - priv->hadjust->page_size;
+ gtk_adjustment_set_value (priv->hadjust, gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_page_size (priv->hadjust));
}
- if (hv != priv->hadjust->value)
+ if (hv != gtk_adjustment_get_value (priv->hadjust))
gtk_adjustment_value_changed (priv->hadjust);
- if (vv != priv->vadjust->value)
+ if (vv != gtk_adjustment_get_value (priv->vadjust))
gtk_adjustment_value_changed (priv->vadjust);
} else {
@@ -1308,7 +1305,7 @@ hildon_pannable_area_style_set (GtkWidget * widget,
GTK_WIDGET_CLASS (hildon_pannable_area_parent_class)->
style_set (widget, previous_style);
- gtk_style_lookup_color (widget->style, "SecondaryTextColor", &priv->scroll_color);
+ gtk_style_lookup_color (gtk_widget_get_style (widget), "SecondaryTextColor", &priv->scroll_color);
gtk_widget_style_get (widget, "indicator-width", &priv->indicator_width, NULL);
}
@@ -1326,7 +1323,7 @@ hildon_pannable_area_map (GtkWidget * widget)
priv = HILDON_PANNABLE_AREA (widget)->priv;
- gdk_window_show (widget->window);
+ gdk_window_show (gtk_widget_get_window (widget));
if (priv->event_window != NULL && !priv->enabled)
gdk_window_show (priv->event_window);
@@ -1355,7 +1352,7 @@ hildon_pannable_area_unmap (GtkWidget * widget)
if (priv->event_window != NULL)
gdk_window_hide (priv->event_window);
- gdk_window_hide (widget->window);
+ gdk_window_hide (gtk_widget_get_window (widget));
(*GTK_WIDGET_CLASS (hildon_pannable_area_parent_class)->unmap) (widget);
}
@@ -1384,8 +1381,6 @@ hildon_pannable_area_grab_notify (GtkWidget *widget,
}
}
-#if USE_CAIRO_SCROLLBARS == 1
-
static void
rgb_from_gdkcolor (GdkColor *color, gdouble *r, gdouble *g, gdouble *b)
{
@@ -1406,7 +1401,7 @@ hildon_pannable_draw_vscroll (GtkWidget * widget,
gdouble r, g, b;
gint radius = (priv->vscroll_rect.width/2) - 1;
- cr = gdk_cairo_create(widget->window);
+ cr = gdk_cairo_create(gtk_widget_get_window (widget));
/* Draw the background */
rgb_from_gdkcolor (back_color, &r, &g, &b);
@@ -1418,20 +1413,20 @@ hildon_pannable_draw_vscroll (GtkWidget * widget,
cairo_clip (cr);
/* Calculate the scroll bar height and position */
- y = ((priv->vadjust->value - priv->vadjust->lower) / (priv->vadjust->upper - priv->vadjust->lower)) *
- (widget->allocation.height -
+ y = ((gtk_adjustment_get_value (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust)) / (gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust))) *
+ (gtk_widget_get_allocated_height (widget) -
(priv->hscroll_visible ? priv->indicator_width : 0));
- height = ((((priv->vadjust->value - priv->vadjust->lower) +
- priv->vadjust->page_size) /
- (priv->vadjust->upper - priv->vadjust->lower)) *
- (widget->allocation.height -
+ height = ((((gtk_adjustment_get_value (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust)) +
+ gtk_adjustment_get_page_size (priv->vadjust)) /
+ (gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust))) *
+ (gtk_widget_get_allocated_height (widget) -
(priv->hscroll_visible ? priv->indicator_width : 0))) - y;
/* Set a minimum height */
height = MAX (SCROLL_BAR_MIN_SIZE, height);
/* Check the max y position */
- y = MIN (y, widget->allocation.height -
+ y = MIN (y, gtk_widget_get_allocated_height (widget) -
(priv->hscroll_visible ? priv->hscroll_rect.height : 0) -
height);
@@ -1468,7 +1463,7 @@ hildon_pannable_draw_hscroll (GtkWidget * widget,
gdouble r, g, b;
gint radius = (priv->hscroll_rect.height/2) - 1;
- cr = gdk_cairo_create(widget->window);
+ cr = gdk_cairo_create(gtk_widget_get_window (widget));
/* Draw the background */
rgb_from_gdkcolor (back_color, &r, &g, &b);
@@ -1480,18 +1475,18 @@ hildon_pannable_draw_hscroll (GtkWidget * widget,
cairo_clip (cr);
/* calculate the scrollbar width and position */
- x = ((priv->hadjust->value - priv->hadjust->lower) / (priv->hadjust->upper - priv->hadjust->lower)) *
- (widget->allocation.width - (priv->vscroll_visible ? priv->indicator_width : 0));
- width =((((priv->hadjust->value - priv->hadjust->lower) +
- priv->hadjust->page_size) / (priv->hadjust->upper - priv->hadjust->lower)) *
- (widget->allocation.width -
+ x = ((gtk_adjustment_get_value (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust)) / (gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust))) *
+ (gtk_widget_get_allocated_width (widget) - (priv->vscroll_visible ? priv->indicator_width : 0));
+ width =((((gtk_adjustment_get_value (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust)) +
+ gtk_adjustment_get_page_size (priv->hadjust)) / (gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust))) *
+ (gtk_widget_get_allocated_width (widget) -
(priv->vscroll_visible ? priv->indicator_width : 0))) - x;
/* Set a minimum width */
width = MAX (SCROLL_BAR_MIN_SIZE, width);
/* Check the max x position */
- x = MIN (x, widget->allocation.width -
+ x = MIN (x, gtk_widget_get_allocated_width (widget) -
(priv->vscroll_visible ? priv->vscroll_rect.width : 0) -
width);
@@ -1516,119 +1511,6 @@ hildon_pannable_draw_hscroll (GtkWidget * widget,
cairo_destroy(cr);
}
-#else /* USE_CAIRO_SCROLLBARS */
-
-static void
-tranparency_color (GdkColor *color,
- GdkColor colora,
- GdkColor colorb,
- gdouble transparency)
-{
- gdouble diff;
-
- diff = colora.red - colorb.red;
- color->red = colora.red-diff*transparency;
-
- diff = colora.green - colorb.green;
- color->green = colora.green-diff*transparency;
-
- diff = colora.blue - colorb.blue;
- color->blue = colora.blue-diff*transparency;
-}
-
-static void
-hildon_pannable_draw_vscroll (GtkWidget *widget,
- GdkColor *back_color,
- GdkColor *scroll_color)
-{
- HildonPannableAreaPrivate *priv = HILDON_PANNABLE_AREA (widget)->priv;
- gfloat y, height;
- GdkColor transp_color;
- GdkGC *gc = priv->scrollbars_gc;
-
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- priv->vscroll_rect.x, priv->vscroll_rect.y,
- priv->vscroll_rect.width,
- priv->vscroll_rect.height);
-
- y = ((priv->vadjust->value - priv->vadjust->lower) / (priv->vadjust->upper - priv->vadjust->lower)) *
- (widget->allocation.height - (priv->hscroll_visible ? priv->indicator_width : 0));
- height = ((((priv->vadjust->value - priv->vadjust->lower) + priv->vadjust->page_size) /
- (priv->vadjust->upper - priv->vadjust->lower)) *
- (widget->allocation.height -
- (priv->hscroll_visible ? priv->indicator_width : 0))) - y;
-
- /* Set a minimum height */
- height = MAX (SCROLL_BAR_MIN_SIZE, height);
-
- /* Check the max y position */
- y = MIN (y, widget->allocation.height -
- (priv->hscroll_visible ? priv->hscroll_rect.height : 0) -
- height);
-
- if (priv->scroll_indicator_alpha == 1.0) {
- transp_color = priv->scroll_color;
- } else if (priv->scroll_indicator_alpha < 1.0) {
- tranparency_color (&transp_color, *back_color, *scroll_color,
- priv->scroll_indicator_alpha);
- }
- gdk_gc_set_rgb_fg_color (gc, &transp_color);
-
- gdk_draw_rectangle (widget->window, gc,
- TRUE, priv->vscroll_rect.x, y,
- priv->vscroll_rect.width, height);
-}
-
-static void
-hildon_pannable_draw_hscroll (GtkWidget *widget,
- GdkColor *back_color,
- GdkColor *scroll_color)
-{
- HildonPannableAreaPrivate *priv = HILDON_PANNABLE_AREA (widget)->priv;
- gfloat x, width;
- GdkColor transp_color;
- GdkGC *gc = priv->scrollbars_gc;
-
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_INSENSITIVE],
- TRUE,
- priv->hscroll_rect.x, priv->hscroll_rect.y,
- priv->hscroll_rect.width,
- priv->hscroll_rect.height);
-
- /* calculate the scrollbar width and position */
- x = ((priv->hadjust->value - priv->hadjust->lower) / (priv->hadjust->upper - priv->hadjust->lower)) *
- (widget->allocation.width - (priv->vscroll_visible ? priv->indicator_width : 0));
- width =((((priv->hadjust->value - priv->hadjust->lower) +
- priv->hadjust->page_size) / (priv->hadjust->upper - priv->hadjust->lower)) *
- (widget->allocation.width -
- (priv->vscroll_visible ? priv->indicator_width : 0))) - x;
-
- /* Set a minimum width */
- width = MAX (SCROLL_BAR_MIN_SIZE, width);
-
- /* Check the max x position */
- x = MIN (x, widget->allocation.width -
- (priv->vscroll_visible ? priv->vscroll_rect.width : 0) -
- width);
-
- if (priv->scroll_indicator_alpha == 1.0) {
- transp_color = priv->scroll_color;
- } else if (priv->scroll_indicator_alpha < 1.0) {
- tranparency_color (&transp_color, *back_color, *scroll_color,
- priv->scroll_indicator_alpha);
- }
- gdk_gc_set_rgb_fg_color (gc, &transp_color);
-
- gdk_draw_rectangle (widget->window, gc,
- TRUE, x, priv->hscroll_rect.y, width,
- priv->hscroll_rect.height);
-}
-
-#endif /* USE_CAIRO_SCROLLBARS */
-
static gboolean
launch_fade_in_timeout (GtkWidget * widget)
{
@@ -1683,7 +1565,7 @@ static void
hildon_pannable_area_adjust_changed (HildonPannableArea * area,
gpointer data)
{
- if (GTK_WIDGET_REALIZED (area))
+ if (gtk_widget_get_realized (GTK_WIDGET (area)))
hildon_pannable_area_refresh (area);
}
@@ -1696,12 +1578,12 @@ hildon_pannable_area_adjust_value_changed (HildonPannableArea * area,
gint x = priv->x_offset;
gint y = priv->y_offset;
- priv->x_offset = priv->hadjust->value;
+ priv->x_offset = gtk_adjustment_get_value (priv->hadjust);
xdiff = x - priv->x_offset;
- priv->y_offset = priv->vadjust->value;
+ priv->y_offset = gtk_adjustment_get_value (priv->vadjust);
ydiff = y - priv->y_offset;
- if ((xdiff || ydiff) && GTK_WIDGET_DRAWABLE (area)) {
+ if ((xdiff || ydiff) && gtk_widget_is_drawable (GTK_WIDGET (area))) {
hildon_pannable_area_redraw (area);
if ((priv->vscroll_visible) || (priv->hscroll_visible)) {
@@ -1719,14 +1601,14 @@ hildon_pannable_area_redraw (HildonPannableArea * area)
HildonPannableAreaPrivate *priv = HILDON_PANNABLE_AREA (area)->priv;
/* Redraw scroll indicators */
- if (GTK_WIDGET_DRAWABLE (area)) {
+ if (gtk_widget_is_drawable (GTK_WIDGET (area))) {
if (priv->hscroll_visible) {
- gdk_window_invalidate_rect (GTK_WIDGET (area)->window,
+ gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (area)),
&priv->hscroll_rect, FALSE);
}
if (priv->vscroll_visible) {
- gdk_window_invalidate_rect (GTK_WIDGET (area)->window,
+ gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (area)),
&priv->vscroll_rect, FALSE);
}
}
@@ -1787,18 +1669,13 @@ hildon_pannable_area_scroll_indicator_fade(HildonPannableArea * area)
}
static gboolean
-hildon_pannable_area_expose_event (GtkWidget * widget,
- GdkEventExpose * event)
+hildon_pannable_area_draw (GtkWidget * widget,
+ cairo_t * cr)
{
HildonPannableAreaPrivate *priv = HILDON_PANNABLE_AREA (widget)->priv;
-#if USE_CAIRO_SCROLLBARS == 1
- GdkColor back_color = widget->style->bg[GTK_STATE_NORMAL];
- GdkColor scroll_color = widget->style->base[GTK_STATE_SELECTED];
-#else /* USE_CAIRO_SCROLLBARS */
- GdkColor back_color = widget->style->bg[GTK_STATE_NORMAL];
- GdkColor scroll_color = priv->scroll_color;
-#endif
+ GdkColor back_color = gtk_widget_get_style (widget)->bg[GTK_STATE_NORMAL];
+ GdkColor scroll_color = gtk_widget_get_style (widget)->base[GTK_STATE_SELECTED];
if (G_UNLIKELY (priv->initial_effect)) {
hildon_pannable_area_initial_effect (widget);
@@ -1821,80 +1698,72 @@ hildon_pannable_area_expose_event (GtkWidget * widget,
if (priv->overshot_dist_y > 0) {
gint overshot_height;
- overshot_height = MIN (priv->overshot_dist_y, widget->allocation.height -
+ overshot_height = MIN (priv->overshot_dist_y, gtk_widget_get_allocated_height (widget) -
(priv->hscroll_visible ? priv->hscroll_rect.height : 0));
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- 0,
- 0,
- widget->allocation.width -
- (priv->vscroll_visible ? priv->vscroll_rect.width : 0),
- overshot_height);
+ gtk_style_apply_default_background (gtk_widget_get_style (widget), cr,
+ gtk_widget_get_window (widget), GTK_STATE_NORMAL,
+ 0, 0,
+ gtk_widget_get_allocated_width (widget) -
+ (priv->vscroll_visible ? priv->vscroll_rect.width : 0),
+ overshot_height);
} else if (priv->overshot_dist_y < 0) {
gint overshot_height;
gint overshot_y;
overshot_height =
MAX (priv->overshot_dist_y,
- -(widget->allocation.height -
+ -(gtk_widget_get_allocated_height (widget) -
(priv->hscroll_visible ? priv->hscroll_rect.height : 0)));
- overshot_y = MAX (widget->allocation.height +
+ overshot_y = MAX (gtk_widget_get_allocated_height (widget) +
overshot_height -
(priv->hscroll_visible ? priv->hscroll_rect.height : 0), 0);
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- 0,
- overshot_y,
- widget->allocation.width -
- priv->vscroll_rect.width,
- -overshot_height);
+ gtk_style_apply_default_background (gtk_widget_get_style (widget), cr,
+ gtk_widget_get_window (widget), GTK_STATE_NORMAL,
+ 0, overshot_y,
+ gtk_widget_get_allocated_width (widget) -
+ priv->vscroll_rect.width,
+ -overshot_height);
}
if (priv->overshot_dist_x > 0) {
gint overshot_width;
- overshot_width = MIN (priv->overshot_dist_x, widget->allocation.width -
+ overshot_width = MIN (priv->overshot_dist_x, gtk_widget_get_allocated_width (widget) -
(priv->vscroll_visible ? priv->vscroll_rect.width : 0));
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- 0,
- 0,
- overshot_width,
- widget->allocation.height -
- (priv->hscroll_visible ? priv->hscroll_rect.height : 0));
+ gtk_style_apply_default_background (gtk_widget_get_style (widget), cr,
+ gtk_widget_get_window (widget), GTK_STATE_NORMAL,
+ 0, 0,
+ overshot_width,
+ gtk_widget_get_allocated_height (widget) -
+ (priv->hscroll_visible ? priv->hscroll_rect.height : 0));
} else if (priv->overshot_dist_x < 0) {
gint overshot_width;
gint overshot_x;
overshot_width =
MAX (priv->overshot_dist_x,
- -(widget->allocation.width -
+ -(gtk_widget_get_allocated_width (widget) -
(priv->vscroll_visible ? priv->vscroll_rect.width : 0)));
- overshot_x = MAX (widget->allocation.width +
+ overshot_x = MAX (gtk_widget_get_allocated_width (widget) +
overshot_width -
(priv->vscroll_visible ? priv->vscroll_rect.width : 0), 0);
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- overshot_x,
- 0,
- -overshot_width,
- widget->allocation.height -
- priv->hscroll_rect.height);
+ gtk_style_apply_default_background (gtk_widget_get_style (widget), cr,
+ gtk_widget_get_window (widget), GTK_STATE_NORMAL,
+ overshot_x, 0,
+ -overshot_width,
+ gtk_widget_get_allocated_height (widget) -
+ priv->hscroll_rect.height);
}
}
- return GTK_WIDGET_CLASS (hildon_pannable_area_parent_class)->expose_event (widget, event);
+ return GTK_WIDGET_CLASS (hildon_pannable_area_parent_class)->draw (widget, cr);
}
static GdkWindow *
@@ -1911,7 +1780,9 @@ hildon_pannable_area_get_topmost (GdkWindow * window,
GList *c, *children;
GdkWindow *selected_window = NULL;
- gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
+ width = gdk_window_get_width (window);
+ height = gdk_window_get_height (window);
+
if ((x < 0) || (x >= width) || (y < 0) || (y >= height))
return NULL;
@@ -1929,7 +1800,8 @@ hildon_pannable_area_get_topmost (GdkWindow * window,
GdkWindow *child = (GdkWindow *) c->data;
gint wx, wy;
- gdk_drawable_get_size (GDK_DRAWABLE (child), &width, &height);
+ width = gdk_window_get_width (child);
+ height = gdk_window_get_height (child);
gdk_window_get_position (child, &wx, &wy);
if ((x >= wx) && (x < (wx + width)) && (y >= wy) && (y < (wy + height)) &&
@@ -2034,7 +1906,8 @@ hildon_pannable_area_button_press_cb (GtkWidget * widget,
if ((ABS (priv->vel_x) <= (priv->vmax * priv->vfast_factor)) &&
(ABS (priv->vel_y) <= (priv->vmax * priv->vfast_factor)))
priv->child =
- hildon_pannable_area_get_topmost (gtk_bin_get_child (GTK_BIN (widget))->window,
+ hildon_pannable_area_get_topmost (
+ gtk_widget_get_window (gtk_bin_get_child (GTK_BIN (widget))),
event->x, event->y, &x, &y, GDK_BUTTON_PRESS_MASK);
else
priv->child = NULL;
@@ -2054,8 +1927,8 @@ hildon_pannable_area_button_press_cb (GtkWidget * widget,
if (priv->child) {
- gdk_drawable_get_size (priv->child, &priv->child_width,
- &priv->child_height);
+ priv->child_width = gdk_window_get_width (priv->child);
+ priv->child_height = gdk_window_get_height (priv->child);
priv->last_in = TRUE;
g_object_add_weak_pointer ((GObject *) priv->child,
@@ -2091,6 +1964,7 @@ hildon_pannable_area_check_scrollbars (HildonPannableArea * area)
{
HildonPannableAreaPrivate *priv = area->priv;
gboolean prev_hscroll_visible, prev_vscroll_visible;
+ GtkAllocation *allocation = NULL;
prev_hscroll_visible = priv->hscroll_visible;
prev_vscroll_visible = priv->vscroll_visible;
@@ -2107,8 +1981,8 @@ hildon_pannable_area_check_scrollbars (HildonPannableArea * area)
priv->hscroll_visible = FALSE;
break;
default:
- priv->hscroll_visible = (priv->hadjust->upper - priv->hadjust->lower >
- priv->hadjust->page_size);
+ priv->hscroll_visible = (gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust) >
+ gtk_adjustment_get_page_size (priv->hadjust));
}
switch (priv->vscrollbar_policy) {
@@ -2119,13 +1993,13 @@ hildon_pannable_area_check_scrollbars (HildonPannableArea * area)
priv->vscroll_visible = FALSE;
break;
default:
- priv->vscroll_visible = (priv->vadjust->upper - priv->vadjust->lower >
- priv->vadjust->page_size);
+ priv->vscroll_visible = (gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust) >
+ gtk_adjustment_get_page_size (priv->vadjust));
}
/* Store the vscroll/hscroll areas for redrawing */
if (priv->vscroll_visible) {
- GtkAllocation *allocation = &GTK_WIDGET (area)->allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (area), allocation);
priv->vscroll_rect.x = allocation->width - priv->indicator_width;
priv->vscroll_rect.y = 0;
priv->vscroll_rect.width = priv->indicator_width;
@@ -2133,7 +2007,7 @@ hildon_pannable_area_check_scrollbars (HildonPannableArea * area)
(priv->hscroll_visible ? priv->indicator_width : 0);
}
if (priv->hscroll_visible) {
- GtkAllocation *allocation = &GTK_WIDGET (area)->allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (area), allocation);
priv->hscroll_rect.y = allocation->height - priv->indicator_width;
priv->hscroll_rect.x = 0;
priv->hscroll_rect.height = priv->indicator_width;
@@ -2149,7 +2023,7 @@ hildon_pannable_area_check_scrollbars (HildonPannableArea * area)
static void
hildon_pannable_area_refresh (HildonPannableArea * area)
{
- if (GTK_WIDGET_DRAWABLE (area) &&
+ if (gtk_widget_is_drawable (GTK_WIDGET (area)) &&
hildon_pannable_area_check_scrollbars (area)) {
HildonPannableAreaPrivate *priv = area->priv;
@@ -2194,10 +2068,10 @@ hildon_pannable_axis_scroll (HildonPannableArea *area,
/* Initiation of the overshoot happens when the finger is released
* and the current position of the pannable contents are out of range
*/
- if (dist < adjust->lower) {
+ if (dist < gtk_adjustment_get_lower (adjust)) {
if (s) *s = FALSE;
- dist = adjust->lower;
+ dist = gtk_adjustment_get_lower (adjust);
if (overshoot_max!=0) {
*overshooting = 1;
@@ -2209,10 +2083,10 @@ hildon_pannable_axis_scroll (HildonPannableArea *area,
*vel = 0.0;
*scroll_to = -1;
}
- } else if (dist > adjust->upper - adjust->page_size) {
+ } else if (dist > gtk_adjustment_get_upper (adjust) - gtk_adjustment_get_page_size (adjust)) {
if (s) *s = FALSE;
- dist = adjust->upper - adjust->page_size;
+ dist = gtk_adjustment_get_upper (adjust) - gtk_adjustment_get_page_size (adjust);
if (overshoot_max!=0) {
*overshooting = 1;
@@ -2235,7 +2109,7 @@ hildon_pannable_axis_scroll (HildonPannableArea *area,
}
}
- adjust->value = dist;
+ gtk_adjustment_set_value (adjust, dist);
} else {
if (!priv->button_pressed) {
@@ -2293,10 +2167,11 @@ hildon_pannable_axis_scroll (HildonPannableArea *area,
*overshot_dist = CLAMP ((*overshot_dist) + inc, -1 * overshoot_max, 0);
} else {
*overshooting = 0;
- adjust->value = CLAMP (dist,
- adjust->lower,
- adjust->upper -
- adjust->page_size);
+ gtk_adjustment_set_value (adjust,
+ CLAMP (dist,
+ gtk_adjustment_get_lower (adjust),
+ gtk_adjustment_get_upper (adjust) -
+ gtk_adjustment_get_page_size (adjust)));
}
if (*overshot_dist != overshot_dist_old)
@@ -2317,16 +2192,16 @@ hildon_pannable_area_scroll (HildonPannableArea *area,
if (gtk_bin_get_child (GTK_BIN (area)) == NULL)
return;
- vscroll_visible = (priv->vadjust->upper - priv->vadjust->lower >
- priv->vadjust->page_size);
- hscroll_visible = (priv->hadjust->upper - priv->hadjust->lower >
- priv->hadjust->page_size);
+ vscroll_visible = (gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust) >
+ gtk_adjustment_get_page_size (priv->vadjust));
+ hscroll_visible = (gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust) >
+ gtk_adjustment_get_page_size (priv->hadjust));
sx = TRUE;
sy = TRUE;
- hv = priv->hadjust->value;
- vv = priv->vadjust->value;
+ hv = gtk_adjustment_get_value (priv->hadjust);
+ vv = gtk_adjustment_get_value (priv->vadjust);
if (vscroll_visible) {
hildon_pannable_axis_scroll (area, priv->vadjust, &priv->vel_y, y,
@@ -2346,10 +2221,10 @@ hildon_pannable_area_scroll (HildonPannableArea *area,
priv->scroll_to_x = -1;
}
- if (hv != priv->hadjust->value)
+ if (hv != gtk_adjustment_get_value (priv->hadjust))
gtk_adjustment_value_changed (priv->hadjust);
- if (vv != priv->vadjust->value)
+ if (vv != gtk_adjustment_get_value (priv->vadjust))
gtk_adjustment_value_changed (priv->vadjust);
/* If the scroll on a particular axis wasn't succesful, reset the
@@ -2381,7 +2256,7 @@ hildon_pannable_area_timeout (HildonPannableArea * area)
hildon_pannable_area_scroll (area, priv->vel_x, priv->vel_y);
- gdk_window_process_updates (GTK_WIDGET (area)->window, FALSE);
+ gdk_window_process_updates (gtk_widget_get_window (GTK_WIDGET (area)), FALSE);
if (!priv->button_pressed) {
/* Decelerate gradually when pointer is raised */
@@ -2518,14 +2393,14 @@ hildon_pannable_area_check_move (HildonPannableArea *area,
HILDON_MOVEMENT_DOWN,
(gdouble)priv->ix, (gdouble)priv->iy);
- vscroll_visible = (priv->vadjust->upper - priv->vadjust->lower >
- priv->vadjust->page_size);
+ vscroll_visible = (gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust) >
+ gtk_adjustment_get_page_size (priv->vadjust));
if (!((vscroll_visible)&&
(priv->mov_mode&HILDON_MOVEMENT_MODE_VERT))) {
- hscroll_visible = (priv->hadjust->upper - priv->hadjust->lower >
- priv->hadjust->page_size);
+ hscroll_visible = (gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust) >
+ gtk_adjustment_get_page_size (priv->hadjust));
/* even in case we do not have to move we check if this
could be a fake horizontal movement */
@@ -2544,14 +2419,14 @@ hildon_pannable_area_check_move (HildonPannableArea *area,
HILDON_MOVEMENT_RIGHT,
(gdouble)priv->ix, (gdouble)priv->iy);
- hscroll_visible = (priv->hadjust->upper - priv->hadjust->lower >
- priv->hadjust->page_size);
+ hscroll_visible = (gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust) >
+ gtk_adjustment_get_page_size (priv->hadjust));
if (!((hscroll_visible)&&
(priv->mov_mode&HILDON_MOVEMENT_MODE_HORIZ))) {
- vscroll_visible = (priv->vadjust->upper - priv->vadjust->lower >
- priv->vadjust->page_size);
+ vscroll_visible = (gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust) >
+ gtk_adjustment_get_page_size (priv->vadjust));
/* even in case we do not have to move we check if this
could be a fake vertical movement */
@@ -2623,11 +2498,11 @@ hildon_pannable_area_handle_move (HildonPannableArea *area,
priv->ey = event->y;
priv->vel_x = ((*x > 0) ? 1 : -1) *
(((ABS (*x) /
- (gdouble) GTK_WIDGET (area)->allocation.width) *
+ (gdouble) gtk_widget_get_allocated_width (GTK_WIDGET (area))) *
(priv->vmax - priv->vmin)) + priv->vmin);
priv->vel_y = ((*y > 0) ? 1 : -1) *
(((ABS (*y) /
- (gdouble) GTK_WIDGET (area)->allocation.height) *
+ (gdouble) gtk_widget_get_allocated_width (GTK_WIDGET (area))) *
(priv->vmax - priv->vmin)) + priv->vmin);
break;
case HILDON_PANNABLE_AREA_MODE_AUTO:
@@ -2690,7 +2565,7 @@ hildon_pannable_area_motion_notify_cb (GtkWidget * widget,
if ((!priv->enabled) || (!priv->button_pressed) ||
((event->time == priv->last_time) && (priv->last_type == 2))) {
- gdk_window_get_pointer (widget->window, NULL, NULL, 0);
+ gdk_window_get_pointer (gtk_widget_get_window (widget), NULL, NULL, 0);
return TRUE;
}
@@ -2744,7 +2619,7 @@ hildon_pannable_area_motion_notify_cb (GtkWidget * widget,
gdk_event_free ((GdkEvent *) event);
}
- gdk_window_get_pointer (widget->window, NULL, NULL, 0);
+ gdk_window_get_pointer (gtk_widget_get_window (widget), NULL, NULL, 0);
return TRUE;
}
@@ -2924,7 +2799,8 @@ hildon_pannable_area_button_release_cb (GtkWidget * widget,
}
child =
- hildon_pannable_area_get_topmost (gtk_bin_get_child (GTK_BIN (widget))->window,
+ hildon_pannable_area_get_topmost (
+ gtk_widget_get_window (gtk_bin_get_child (GTK_BIN (widget))),
event->x, event->y, &x, &y, GDK_BUTTON_RELEASE_MASK);
event = (GdkEventButton *) gdk_event_copy ((GdkEvent *) event);
@@ -3011,13 +2887,13 @@ hildon_pannable_area_scroll_cb (GtkWidget *widget,
gdouble delta, new_value;
/* from gtkrange.c calculate delta*/
- delta = pow (adj->page_size, 2.0 / 3.0);
+ delta = pow (gtk_adjustment_get_page_size (adj), 2.0 / 3.0);
if (event->direction == GDK_SCROLL_UP ||
event->direction == GDK_SCROLL_LEFT)
delta = - delta;
- new_value = CLAMP (adj->value + delta, adj->lower, adj->upper - adj->page_size);
+ new_value = CLAMP (gtk_adjustment_get_value (adj) + delta, gtk_adjustment_get_lower (adj), gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
gtk_adjustment_set_value (adj, new_value);
}
@@ -3040,17 +2916,22 @@ static void
hildon_pannable_area_add (GtkContainer *container, GtkWidget *child)
{
HildonPannableAreaPrivate *priv = HILDON_PANNABLE_AREA (container)->priv;
+ GtkScrollable *scroll = GTK_SCROLLABLE (child);
g_return_if_fail (gtk_bin_get_child (GTK_BIN (container)) == NULL);
gtk_widget_set_parent (child, GTK_WIDGET (container));
- GTK_BIN (container)->child = child;
+ gtk_container_add (container, child);
g_signal_connect_after (child, "map-event",
G_CALLBACK (hildon_pannable_area_child_mapped),
container);
- if (!gtk_widget_set_scroll_adjustments (child, priv->hadjust, priv->vadjust)) {
+ if (scroll != NULL) {
+ gtk_scrollable_set_hadjustment (scroll, priv->hadjust);
+ gtk_scrollable_set_vadjustment (scroll, priv->vadjust);
+ }
+ else {
g_warning ("%s: cannot add non scrollable widget, "
"wrap it in a viewport", __FUNCTION__);
}
@@ -3065,7 +2946,7 @@ hildon_pannable_area_center_on_child_focus (HildonPannableArea *area)
window = gtk_widget_get_toplevel (GTK_WIDGET (area));
- if (GTK_WIDGET_TOPLEVEL (window)) {
+ if (gtk_widget_is_toplevel (window)) {
focused_child = gtk_window_get_focus (GTK_WINDOW (window));
}
@@ -3092,11 +2973,15 @@ hildon_pannable_area_set_focus_child (GtkContainer *container,
static void
hildon_pannable_area_remove (GtkContainer *container, GtkWidget *child)
{
+ GtkScrollable *scroll = GTK_SCROLLABLE (child);
g_return_if_fail (HILDON_IS_PANNABLE_AREA (container));
g_return_if_fail (child != NULL);
g_return_if_fail (gtk_bin_get_child (GTK_BIN (container)) == child);
- gtk_widget_set_scroll_adjustments (child, NULL, NULL);
+ if (scroll != NULL) {
+ gtk_scrollable_set_hadjustment (scroll, NULL);
+ gtk_scrollable_set_vadjustment (scroll, NULL);
+ }
g_signal_handlers_disconnect_by_func (child,
hildon_pannable_area_child_mapped,
@@ -3219,16 +3104,16 @@ hildon_pannable_area_add_with_viewport (HildonPannableArea * area,
g_return_if_fail (HILDON_IS_PANNABLE_AREA (area));
g_return_if_fail (GTK_IS_WIDGET (child));
- g_return_if_fail (child->parent == NULL);
+ g_return_if_fail (gtk_widget_get_parent (child) == NULL);
bin = GTK_BIN (area);
- if (bin->child != NULL)
+ if (gtk_bin_get_child (bin) != NULL)
{
- g_return_if_fail (GTK_IS_VIEWPORT (bin->child));
- g_return_if_fail (GTK_BIN (bin->child)->child == NULL);
+ g_return_if_fail (GTK_IS_VIEWPORT (gtk_bin_get_child (bin)));
+ g_return_if_fail (gtk_bin_get_child (GTK_BIN (gtk_bin_get_child (bin))) == NULL);
- viewport = bin->child;
+ viewport = gtk_bin_get_child (bin);
}
else
{
@@ -3295,15 +3180,15 @@ hildon_pannable_area_scroll_to (HildonPannableArea *area,
gint dist_x, dist_y;
gboolean hscroll_visible, vscroll_visible;
- g_return_if_fail (GTK_WIDGET_REALIZED (area));
+ g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (area)));
g_return_if_fail (HILDON_IS_PANNABLE_AREA (area));
priv = area->priv;
- vscroll_visible = (priv->vadjust->upper - priv->vadjust->lower >
- priv->vadjust->page_size);
- hscroll_visible = (priv->hadjust->upper - priv->hadjust->lower >
- priv->hadjust->page_size);
+ vscroll_visible = (gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust) >
+ gtk_adjustment_get_page_size (priv->vadjust));
+ hscroll_visible = (gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust) >
+ gtk_adjustment_get_page_size (priv->hadjust));
if (((!vscroll_visible)&&(!hscroll_visible)) ||
(x == -1 && y == -1)) {
@@ -3313,16 +3198,16 @@ hildon_pannable_area_scroll_to (HildonPannableArea *area,
if (priv->mode == HILDON_PANNABLE_AREA_MODE_PUSH)
hildon_pannable_area_jump_to (area, x, y);
- width = priv->hadjust->upper - priv->hadjust->lower;
- height = priv->vadjust->upper - priv->vadjust->lower;
+ width = gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust);
+ height = gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust);
g_return_if_fail (x < width || y < height);
if ((x > -1)&&(hscroll_visible)) {
- priv->scroll_to_x = CLAMP (x - priv->hadjust->page_size/2,
- priv->hadjust->lower,
- priv->hadjust->upper - priv->hadjust->page_size);
- dist_x = priv->scroll_to_x - priv->hadjust->value;
+ priv->scroll_to_x = CLAMP (x - gtk_adjustment_get_page_size (priv->hadjust)/2,
+ gtk_adjustment_get_lower (priv->hadjust),
+ gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_page_size (priv->hadjust));
+ dist_x = priv->scroll_to_x - gtk_adjustment_get_value (priv->hadjust);
if (dist_x == 0) {
priv->scroll_to_x = -1;
} else {
@@ -3333,10 +3218,10 @@ hildon_pannable_area_scroll_to (HildonPannableArea *area,
}
if ((y > -1)&&(vscroll_visible)) {
- priv->scroll_to_y = CLAMP (y - priv->vadjust->page_size/2,
- priv->vadjust->lower,
- priv->vadjust->upper - priv->vadjust->page_size);
- dist_y = priv->scroll_to_y - priv->vadjust->value;
+ priv->scroll_to_y = CLAMP (y - gtk_adjustment_get_page_size (priv->vadjust)/2,
+ gtk_adjustment_get_lower (priv->vadjust),
+ gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_page_size (priv->vadjust));
+ dist_y = priv->scroll_to_y - gtk_adjustment_get_value (priv->vadjust);
if (dist_y == 0) {
priv->scroll_to_y = -1;
} else {
@@ -3387,7 +3272,7 @@ hildon_pannable_area_jump_to (HildonPannableArea *area,
gdouble hv, vv;
g_return_if_fail (HILDON_IS_PANNABLE_AREA (area));
- g_return_if_fail (GTK_WIDGET_REALIZED (area));
+ g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (area)));
g_return_if_fail (x >= -1 && y >= -1);
if (x == -1 && y == -1) {
@@ -3396,36 +3281,38 @@ hildon_pannable_area_jump_to (HildonPannableArea *area,
priv = area->priv;
- width = priv->hadjust->upper - priv->hadjust->lower;
- height = priv->vadjust->upper - priv->vadjust->lower;
+ width = gtk_adjustment_get_upper (priv->hadjust) - gtk_adjustment_get_lower (priv->hadjust);
+ height = gtk_adjustment_get_upper (priv->vadjust) - gtk_adjustment_get_lower (priv->vadjust);
g_return_if_fail (x < width || y < height);
- hv = priv->hadjust->value;
- vv = priv->vadjust->value;
+ hv = gtk_adjustment_get_value (priv->hadjust);
+ vv = gtk_adjustment_get_value (priv->vadjust);
if (x != -1) {
- gdouble jump_to = x - priv->hadjust->page_size/2;
+ gdouble jump_to = x - gtk_adjustment_get_page_size (priv->hadjust)/2;
- priv->hadjust->value = CLAMP (jump_to,
- priv->hadjust->lower,
- priv->hadjust->upper -
- priv->hadjust->page_size);
+ gtk_adjustment_set_value (priv->hadjust,
+ CLAMP (jump_to,
+ gtk_adjustment_get_lower (priv->hadjust),
+ gtk_adjustment_get_upper (priv->hadjust) -
+ gtk_adjustment_get_page_size (priv->hadjust)));
}
if (y != -1) {
- gdouble jump_to = y - priv->vadjust->page_size/2;
+ gdouble jump_to = y - gtk_adjustment_get_page_size (priv->vadjust)/2;
- priv->vadjust->value = CLAMP (jump_to,
- priv->vadjust->lower,
- priv->vadjust->upper -
- priv->vadjust->page_size);
+ gtk_adjustment_set_value (priv->vadjust,
+ CLAMP (jump_to,
+ gtk_adjustment_get_lower (priv->vadjust),
+ gtk_adjustment_get_upper (priv->vadjust) -
+ gtk_adjustment_get_page_size (priv->vadjust)));
}
- if (hv != priv->hadjust->value)
+ if (hv != gtk_adjustment_get_value (priv->hadjust))
gtk_adjustment_value_changed (priv->hadjust);
- if (vv != priv->vadjust->value)
+ if (vv != gtk_adjustment_get_value (priv->vadjust))
gtk_adjustment_value_changed (priv->vadjust);
hildon_pannable_area_launch_fade_timeout (area, 1.0);
@@ -3471,20 +3358,20 @@ hildon_pannable_area_scroll_to_child (HildonPannableArea *area, GtkWidget *child
GtkWidget *bin_child;
gint x, y;
- g_return_if_fail (GTK_WIDGET_REALIZED (area));
+ g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (area)));
g_return_if_fail (HILDON_IS_PANNABLE_AREA (area));
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (gtk_widget_is_ancestor (child, GTK_WIDGET (area)));
- if (GTK_BIN (area)->child == NULL)
+ if (gtk_bin_get_child (GTK_BIN (area)) == NULL)
return;
/* We need to get to check the child of the inside the area */
- bin_child = GTK_BIN (area)->child;
+ bin_child = gtk_bin_get_child (GTK_BIN (area));
/* we check if we added a viewport */
if (GTK_IS_VIEWPORT (bin_child)) {
- bin_child = GTK_BIN (bin_child)->child;
+ bin_child = gtk_bin_get_child (GTK_BIN (bin_child));
}
if (gtk_widget_translate_coordinates (child, bin_child, 0, 0, &x, &y))
@@ -3514,7 +3401,7 @@ hildon_pannable_area_jump_to_child (HildonPannableArea *area, GtkWidget *child)
GtkWidget *bin_child;
gint x, y;
- g_return_if_fail (GTK_WIDGET_REALIZED (area));
+ g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (area)));
g_return_if_fail (HILDON_IS_PANNABLE_AREA (area));
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (gtk_widget_is_ancestor (child, GTK_WIDGET (area)));
@@ -3555,7 +3442,7 @@ hildon_pannable_get_child_widget_at (HildonPannableArea *area,
GtkWidget *child_widget = NULL;
window = hildon_pannable_area_get_topmost
- (gtk_bin_get_child (GTK_BIN (area))->window,
+ (gtk_widget_get_window (gtk_bin_get_child (GTK_BIN (area))),
x, y, NULL, NULL, GDK_ALL_EVENTS_MASK);
gdk_window_get_user_data (window, (gpointer) &child_widget);
diff --git a/hildon/hildon-picker-button.c b/hildon/hildon-picker-button.c
index 59f315a..26642d5 100644
--- a/hildon/hildon-picker-button.c
+++ b/hildon/hildon-picker-button.c
@@ -218,7 +218,7 @@ _selection_changed (HildonPickerButton *button)
HildonPickerButtonPrivate *priv = GET_PRIVATE (button);
if (!GTK_IS_WINDOW (priv->dialog) ||
- !GTK_WIDGET_VISIBLE (GTK_WINDOW (priv->dialog))) {
+ !gtk_widget_get_visible (GTK_WIDGET (priv->dialog))) {
gchar *value = hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (priv->selector));
if (value) {
hildon_button_set_value (HILDON_BUTTON (button), value);
@@ -264,7 +264,7 @@ hildon_picker_button_clicked (GtkButton * button)
/* Create the dialog if it doesn't exist already. */
if (!priv->dialog) {
parent = gtk_widget_get_toplevel (GTK_WIDGET (button));
- if (GTK_WIDGET_TOPLEVEL (parent)) {
+ if (gtk_widget_is_toplevel (parent)) {
priv->dialog = hildon_picker_dialog_new (GTK_WINDOW (parent));
} else {
priv->dialog = hildon_picker_dialog_new (NULL);
diff --git a/hildon/hildon-picker-dialog.c b/hildon/hildon-picker-dialog.c
index de4edf2..d2118b6 100644
--- a/hildon/hildon-picker-dialog.c
+++ b/hildon/hildon-picker-dialog.c
@@ -55,7 +55,7 @@
#define HILDON_PICKER_DIALOG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), HILDON_TYPE_PICKER_DIALOG, HildonPickerDialogPrivate))
-G_DEFINE_TYPE (HildonPickerDialog, hildon_picker_dialog, HILDON_TYPE_DIALOG)
+G_DEFINE_TYPE (HildonPickerDialog, hildon_picker_dialog, GTK_TYPE_DIALOG)
struct _HildonPickerDialogPrivate
{
@@ -109,8 +109,14 @@ static void
hildon_picker_dialog_realize (GtkWidget *widget);
static void
-hildon_picker_dialog_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+hildon_picker_dialog_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+
+static void
+hildon_picker_dialog_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
/* private functions */
static gboolean
@@ -158,14 +164,10 @@ static void
hildon_picker_dialog_class_init (HildonPickerDialogClass * class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
/* GObject */
gobject_class->set_property = hildon_picker_dialog_set_property;
@@ -175,7 +177,8 @@ hildon_picker_dialog_class_init (HildonPickerDialogClass * class)
/* GtkWidget */
widget_class->show = hildon_picker_dialog_show;
widget_class->realize = hildon_picker_dialog_realize;
- widget_class->size_request = hildon_picker_dialog_size_request,
+ widget_class->get_preferred_height = hildon_picker_dialog_get_preferred_width;
+ widget_class->get_preferred_height = hildon_picker_dialog_get_preferred_height;
/* HildonPickerDialog */
class->set_selector = _hildon_picker_dialog_set_selector;
@@ -233,7 +236,7 @@ hildon_picker_dialog_class_init (HildonPickerDialogClass * class)
638,
G_PARAM_READWRITE));
- g_type_class_add_private (object_class, sizeof (HildonPickerDialogPrivate));
+ g_type_class_add_private (class, sizeof (HildonPickerDialogPrivate));
}
@@ -247,7 +250,6 @@ hildon_picker_dialog_init (HildonPickerDialog * dialog)
gtk_dialog_add_button (GTK_DIALOG (dialog), "", GTK_RESPONSE_OK);
gtk_widget_grab_default (dialog->priv->button);
gtk_button_set_focus_on_click (GTK_BUTTON (dialog->priv->button), FALSE);
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
dialog->priv->signal_changed_id = 0;
dialog->priv->signal_columns_changed_id = 0;
@@ -337,47 +339,57 @@ hildon_picker_dialog_show (GtkWidget *widget)
}
static void
-hildon_picker_dialog_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+hildon_picker_dialog_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
HildonTouchSelector *selector;
selector = hildon_picker_dialog_get_selector (HILDON_PICKER_DIALOG (widget));
if (selector) {
- GtkRequisition child_requisition;
- GtkRequisition optimal_requisition;
- GtkRequisition selector_requisition;
- GtkBin *bin;
- guint max_height;
+ gint border;
- bin = GTK_BIN (widget);
+ gtk_widget_get_preferred_width (gtk_bin_get_child (GTK_BIN (widget)), minimum, natural);
- requisition->width = GTK_CONTAINER (widget)->border_width * 2;
- /* Adding pannable container border using 4 instead of 2 */
- requisition->height = GTK_CONTAINER (widget)->border_width * 4;
+ border = gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2;
+
+ *minimum += border;
+ *natural += border;
+ } else
+ GTK_WIDGET_CLASS (hildon_picker_dialog_parent_class)->get_preferred_width
+ (widget, minimum, natural);
+}
+
+static void
+hildon_picker_dialog_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ HildonTouchSelector *selector;
+
+ selector = hildon_picker_dialog_get_selector (HILDON_PICKER_DIALOG (widget));
- /* assure the requisition is done */
- gtk_widget_size_request (bin->child, &child_requisition);
- gtk_widget_get_child_requisition (GTK_WIDGET (selector), &selector_requisition);
+ if (selector) {
+ gint border;
+ gint selector_minimum, selector_natural;
+
+ gtk_widget_get_preferred_height (gtk_bin_get_child (GTK_BIN (widget)), minimum, natural);
- hildon_touch_selector_optimal_size_request (selector,
- &optimal_requisition);
+ /* Adding pannable container border using 4 instead of 2 */
+ border = gtk_container_get_border_width (GTK_CONTAINER (widget)) * 4;
- requisition->width += child_requisition.width;
- requisition->height += child_requisition.height;
+ gtk_widget_get_preferred_height (GTK_WIDGET (selector),
+ &selector_minimum, &selector_natural);
- max_height = hildon_picker_dialog_get_max_height (HILDON_PICKER_DIALOG (widget));
+ *minimum = border + *minimum + selector_minimum;
- requisition->height = MIN (max_height,
- requisition->height +
- optimal_requisition.height -
- selector_requisition.height);
+ *natural = MIN (hildon_picker_dialog_get_max_height (HILDON_PICKER_DIALOG (widget)),
+ border + *natural + selector_natural - selector_minimum);
} else
- GTK_WIDGET_CLASS (hildon_picker_dialog_parent_class)->size_request
- (widget, requisition);
+ GTK_WIDGET_CLASS (hildon_picker_dialog_parent_class)->get_preferred_height
+ (widget, minimum, natural);
}
-
static void
hildon_picker_dialog_realize (GtkWidget *widget)
{
@@ -506,7 +518,7 @@ on_selector_columns_changed (HildonTouchSelector * selector, gpointer userdata)
dialog = HILDON_PICKER_DIALOG (userdata);
prepare_action_area (dialog);
- if (GTK_WIDGET_REALIZED (dialog)) {
+ if (gtk_widget_get_realized (GTK_WIDGET (dialog))) {
setup_interaction_mode (dialog);
}
}
@@ -659,9 +671,9 @@ static void
prepare_action_area (HildonPickerDialog *dialog)
{
if (requires_done_button (dialog)) {
- gtk_widget_show (GTK_DIALOG (dialog)->action_area);
+ gtk_widget_show (gtk_dialog_get_action_area (GTK_DIALOG (dialog)));
} else {
- gtk_widget_hide (GTK_DIALOG (dialog)->action_area);
+ gtk_widget_hide (gtk_dialog_get_action_area (GTK_DIALOG (dialog)));
}
}
@@ -715,7 +727,7 @@ _hildon_picker_dialog_set_selector (HildonPickerDialog * dialog,
/* Remove the old selector, if any */
if (dialog->priv->selector != NULL) {
- gtk_container_remove (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
+ gtk_container_remove (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
dialog->priv->selector);
if (dialog->priv->signal_columns_changed_id) {
g_signal_handler_disconnect (dialog->priv->selector,
@@ -726,7 +738,7 @@ _hildon_picker_dialog_set_selector (HildonPickerDialog * dialog,
dialog->priv->selector = GTK_WIDGET (selector);
/* Pack the new selector */
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
dialog->priv->selector, TRUE, TRUE, 0);
g_object_unref (selector);
@@ -734,7 +746,7 @@ _hildon_picker_dialog_set_selector (HildonPickerDialog * dialog,
gtk_widget_show (dialog->priv->selector);
prepare_action_area (dialog);
- if (GTK_WIDGET_REALIZED (dialog)) {
+ if (gtk_widget_get_realized (GTK_WIDGET (dialog))) {
setup_interaction_mode (dialog);
}
diff --git a/hildon/hildon-picker-dialog.h b/hildon/hildon-picker-dialog.h
index 040b733..f084afd 100644
--- a/hildon/hildon-picker-dialog.h
+++ b/hildon/hildon-picker-dialog.h
@@ -21,7 +21,6 @@
#ifndef __HILDON_PICKER_DIALOG_H__
#define __HILDON_PICKER_DIALOG_H__
-#include "hildon-dialog.h"
#include "hildon-touch-selector.h"
G_BEGIN_DECLS
@@ -53,7 +52,7 @@ typedef struct _HildonPickerDialogPrivate Hildo
struct _HildonPickerDialog
{
- HildonDialog parent_instance;
+ GtkDialog parent_instance;
/*< private > */
HildonPickerDialogPrivate *priv;
@@ -61,7 +60,7 @@ struct _HildonPickerDialog
struct _HildonPickerDialogClass
{
- HildonDialogClass parent_class;
+ GtkDialogClass parent_class;
gboolean (* set_selector) (HildonPickerDialog *dialog,
HildonTouchSelector *selector);
diff --git a/hildon/hildon-program.c b/hildon/hildon-program.c
index e7d332f..3456f73 100644
--- a/hildon/hildon-program.c
+++ b/hildon/hildon-program.c
@@ -313,7 +313,7 @@ hildon_program_update_top_most (HildonProgram *program)
XWMHints *wm_hints;
gdk_error_trap_push ();
- wm_hints = XGetWMHints (GDK_DISPLAY (), active_window);
+ wm_hints = XGetWMHints (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), active_window);
xerror = gdk_error_trap_pop ();
if (xerror && xerror != BadWindow)
{
@@ -327,7 +327,7 @@ hildon_program_update_top_most (HildonProgram *program)
GSList *iter;
for (iter = priv->windows ; iter && !is_topmost; iter = iter->next)
{
- GdkWindow *gdkwin = GTK_WIDGET (iter->data)->window;
+ GdkWindow *gdkwin = gtk_widget_get_window (GTK_WIDGET (iter->data));
GdkWindow *group = gdkwin ? gdk_window_get_group (gdkwin) : NULL;
if (group)
is_topmost = wm_hints->window_group == GDK_WINDOW_XID (group);
@@ -361,7 +361,8 @@ hildon_program_root_window_event_filter (GdkXEvent *xevent,
XAnyEvent *eventti = xevent;
HildonProgram *program = HILDON_PROGRAM (data);
Atom active_app_atom =
- XInternAtom (GDK_DISPLAY (), "_MB_CURRENT_APP_WINDOW", False);
+ XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+ "_MB_CURRENT_APP_WINDOW", False);
if (eventti->type == PropertyNotify)
{
@@ -486,7 +487,7 @@ hildon_program_add_window (HildonProgram *self,
/* Now that we have a window we should start keeping track of
* the root window */
- if (GTK_WIDGET_REALIZED (window))
+ if (gtk_widget_get_realized (GTK_WIDGET (window)))
{
window_add_event_filter (GTK_WIDGET (window), self);
}
@@ -536,7 +537,7 @@ hildon_program_remove_window (HildonProgram *self,
priv->window_count --;
- if (GTK_WIDGET_REALIZED (window))
+ if (gtk_widget_get_realized (GTK_WIDGET (window)))
{
gdk_window_remove_filter (gtk_widget_get_window (GTK_WIDGET (window)),
hildon_program_root_window_event_filter,
@@ -624,7 +625,7 @@ hildon_program_set_common_menu (HildonProgram *self,
if (priv->common_menu)
{
- if (GTK_WIDGET_VISIBLE (priv->common_menu))
+ if (gtk_widget_get_visible (GTK_WIDGET (priv->common_menu)))
{
gtk_menu_popdown (priv->common_menu);
gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->common_menu));
@@ -659,8 +660,7 @@ hildon_program_set_common_menu (HildonProgram *self,
if (priv->common_menu)
{
- g_object_ref (menu);
- gtk_object_sink (GTK_OBJECT (menu));
+ g_object_ref_sink (G_OBJECT (menu));
gtk_widget_show_all (GTK_WIDGET (menu));
}
}
@@ -804,9 +804,10 @@ hildon_program_set_common_toolbar (HildonProgram *self,
if (priv->common_toolbar)
{
- if (priv->common_toolbar->parent)
+ GtkWidget *parent = gtk_widget_get_parent (priv->common_toolbar);
+ if (parent)
{
- gtk_container_remove (GTK_CONTAINER (priv->common_toolbar->parent),
+ gtk_container_remove (GTK_CONTAINER (parent),
priv->common_toolbar);
}
@@ -817,8 +818,7 @@ hildon_program_set_common_toolbar (HildonProgram *self,
if (priv->common_toolbar)
{
- g_object_ref (priv->common_toolbar);
- gtk_object_sink (GTK_OBJECT (priv->common_toolbar) );
+ g_object_ref_sink (G_OBJECT (priv->common_toolbar) );
}
/* if the program is the topmost we have to update the common
diff --git a/hildon/hildon-remote-texture.c b/hildon/hildon-remote-texture.c
index b39202d..3ee1741 100644
--- a/hildon/hildon-remote-texture.c
+++ b/hildon/hildon-remote-texture.c
@@ -80,12 +80,12 @@ hildon_remote_texture_realize (GtkWidget *widget)
/* Set remote texture window type. */
- display = gdk_drawable_get_display (widget->window);
+ display = gdk_window_get_display (gtk_widget_get_window (widget));
wm_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE");
applet_type = gdk_x11_get_xatom_by_name_for_display (display, "_HILDON_WM_WINDOW_TYPE_REMOTE_TEXTURE");
- XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (widget->window), wm_type,
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (gtk_widget_get_window (widget)), wm_type,
XA_ATOM, 32, PropModeReplace,
(unsigned char *) &applet_type, 1);
@@ -135,7 +135,7 @@ hildon_remote_texture_realize (GtkWidget *widget)
/* Wait for a ready message */
- gdk_window_add_filter (widget->window,
+ gdk_window_add_filter (gtk_widget_get_window (widget),
hildon_remote_texture_event_filter,
widget);
}
@@ -143,7 +143,7 @@ hildon_remote_texture_realize (GtkWidget *widget)
static void
hildon_remote_texture_unrealize (GtkWidget *widget)
{
- gdk_window_remove_filter (widget->window,
+ gdk_window_remove_filter (gtk_widget_get_window (widget),
hildon_remote_texture_event_filter,
widget);
@@ -272,8 +272,8 @@ hildon_remote_texture_update_ready (HildonRemoteTexture *self)
HildonRemoteTexturePrivate
*priv = HILDON_REMOTE_TEXTURE_GET_PRIVATE (self);
GtkWidget *widget = GTK_WIDGET (self);
- Display *display = GDK_WINDOW_XDISPLAY (widget->window);
- Window window = GDK_WINDOW_XID (widget->window);
+ Display *display = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (widget));
+ Window window = GDK_WINDOW_XID (gtk_widget_get_window (widget));
int status;
gint xerror;
@@ -322,7 +322,7 @@ hildon_remote_texture_update_ready (HildonRemoteTexture *self)
G_CALLBACK(hildon_remote_texture_map_event),
self);
- if (GTK_WIDGET_MAPPED (GTK_WIDGET (self)))
+ if (gtk_widget_get_mapped (GTK_WIDGET (self)))
{
gtk_widget_unmap (GTK_WIDGET (self));
gtk_widget_map (GTK_WIDGET (self));
@@ -430,8 +430,8 @@ hildon_remote_texture_send_message (HildonRemoteTexture *self,
guint32 l4)
{
GtkWidget *widget = GTK_WIDGET (self);
- Display *display = GDK_WINDOW_XDISPLAY (widget->window);
- Window window = GDK_WINDOW_XID (widget->window);
+ Display *display = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (widget));
+ Window window = GDK_WINDOW_XID (gtk_widget_get_window (widget));
XEvent event = { 0 };
@@ -486,11 +486,11 @@ hildon_remote_texture_set_image (HildonRemoteTexture *self,
priv->shm_height = height;
priv->shm_bpp = bpp;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
/* Defer messages until the remote texture is parented
* and the parent window is mapped */
- if (!priv->parent || !GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!priv->parent || !gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
return;
hildon_remote_texture_send_message (self,
shm_atom,
@@ -544,11 +544,11 @@ hildon_remote_texture_update_area (HildonRemoteTexture *self,
}
priv->set_damage = 1;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
/* Defer messages until the remote texture is parented
* and the parent window is mapped */
- if (!priv->parent || !GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!priv->parent || !gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
return;
hildon_remote_texture_send_message (self,
damage_atom,
@@ -608,11 +608,11 @@ hildon_remote_texture_set_show_full (HildonRemoteTexture *self,
priv->opacity = opacity;
priv->set_show = 1;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
/* Defer show messages until the remote texture is parented
* and the parent window is mapped */
- if (!priv->parent || !GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!priv->parent || !gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
return;
hildon_remote_texture_send_message (self,
show_atom,
@@ -703,12 +703,12 @@ hildon_remote_texture_set_position (HildonRemoteTexture *self,
priv->height = height;
priv->set_position = 1;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
/* Defer messages until the remote texture is parented
* and the parent window is mapped */
- if (!priv->parent || !GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!priv->parent || !gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
return;
hildon_remote_texture_send_message (self,
position_atom,
@@ -747,12 +747,12 @@ hildon_remote_texture_set_offset (HildonRemoteTexture *self,
priv->offset_y = y;
priv->set_offset = 1;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
/* Defer messages until the remote texture is parented
* and the parent window is mapped */
- if (!priv->parent || !GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!priv->parent || !gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
return;
hildon_remote_texture_send_message (self,
offset_atom,
@@ -783,11 +783,11 @@ hildon_remote_texture_set_scale (HildonRemoteTexture *self,
priv->scale_y = y_scale;
priv->set_scale = 1;
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
/* Defer messages until the remote texture is parented
* and the parent window is mapped */
- if (!priv->parent || !GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!priv->parent || !gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
return;
hildon_remote_texture_send_message (self,
scale_atom,
@@ -915,14 +915,14 @@ hildon_remote_texture_set_parent (HildonRemoteTexture *self,
}
}
- if (GTK_WIDGET_MAPPED (widget) && priv->ready)
+ if (gtk_widget_get_mapped (widget) && priv->ready)
{
Window win = 0;
/* If the remote texture is being unparented or parented to an
* unmapped widget, force its visibility to "hidden". */
- if (!priv->parent || !GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!priv->parent || !gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
{
hildon_remote_texture_send_message (self,
show_atom,
@@ -937,10 +937,10 @@ hildon_remote_texture_set_parent (HildonRemoteTexture *self,
if (priv->parent)
{
- if (!GTK_WIDGET_MAPPED (GTK_WIDGET (priv->parent)))
+ if (!gtk_widget_get_mapped (GTK_WIDGET (priv->parent)))
return;
- GdkWindow *gdk = GTK_WIDGET (parent)->window;
+ GdkWindow *gdk = gtk_widget_get_window (GTK_WIDGET (parent));
win = GDK_WINDOW_XID (gdk);
}
diff --git a/hildon/hildon-sound.c b/hildon/hildon-sound.c
index 1d609b3..a33dc42 100644
--- a/hildon/hildon-sound.c
+++ b/hildon/hildon-sound.c
@@ -93,7 +93,6 @@ hildon_ca_context_get (void)
void
hildon_play_system_sound(const gchar *sample)
{
- int ret;
ca_context *ca_con = NULL;
ca_proplist *pl = NULL;
@@ -104,7 +103,7 @@ hildon_play_system_sound(const gchar *sample)
ca_proplist_sets(pl, CA_PROP_MEDIA_ROLE, "dialog-information");
ca_proplist_sets(pl, "module-stream-restore.id", "x-maemo-system-sound");
- ret = ca_context_play_full(ca_con, 0, pl, NULL, NULL);
+ ca_context_play_full(ca_con, 0, pl, NULL, NULL);
ca_proplist_destroy(pl);
}
diff --git a/hildon/hildon-stackable-window.c b/hildon/hildon-stackable-window.c
index 1f6c0d5..5382e00 100644
--- a/hildon/hildon-stackable-window.c
+++ b/hildon/hildon-stackable-window.c
@@ -157,9 +157,9 @@ hildon_stackable_window_map (GtkWidget *widget)
/* Set additional property "_HILDON_STACKABLE_WINDOW", to allow the WM to manage
it as a stackable window. */
- display = gdk_drawable_get_display (widget->window);
+ display = gdk_window_get_display (gtk_widget_get_window (widget));
atom = gdk_x11_get_xatom_by_name_for_display (display, "_HILDON_STACKABLE_WINDOW");
- XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (widget->window), atom,
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (gtk_widget_get_window (widget)), atom,
XA_INTEGER, 32, PropModeReplace,
(unsigned char *) &val, 1);
diff --git a/hildon/hildon-time-selector.c b/hildon/hildon-time-selector.c
index 6e1ce5e..e5bc003 100644
--- a/hildon/hildon-time-selector.c
+++ b/hildon/hildon-time-selector.c
@@ -144,14 +144,8 @@ static void
hildon_time_selector_class_init (HildonTimeSelectorClass * class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
/* GObject */
gobject_class->get_property = hildon_time_selector_get_property;
@@ -190,7 +184,7 @@ hildon_time_selector_class_init (HildonTimeSelectorClass * class)
/* signals */
- g_type_class_add_private (object_class, sizeof (HildonTimeSelectorPrivate));
+ g_type_class_add_private (class, sizeof (HildonTimeSelectorPrivate));
}
/* FIXME: the constructor was required because as we need the initial values
@@ -253,7 +247,7 @@ hildon_time_selector_init (HildonTimeSelector * selector)
{
selector->priv = HILDON_TIME_SELECTOR_GET_PRIVATE (selector);
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (selector), GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (selector), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (selector), FALSE);
hildon_touch_selector_set_print_func (HILDON_TOUCH_SELECTOR (selector),
diff --git a/hildon/hildon-touch-selector-entry.c b/hildon/hildon-touch-selector-entry.c
index 8d1b705..e321c12 100644
--- a/hildon/hildon-touch-selector-entry.c
+++ b/hildon/hildon-touch-selector-entry.c
@@ -421,7 +421,10 @@ entry_on_text_changed (GtkEditable * editable,
if (!found && !found_suggestion && priv->smart_match) {
gchar *ascii_text = g_convert_with_iconv (text, -1, priv->converter, NULL, NULL, NULL);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuninitialized"
found_suggestion = !g_ascii_strncasecmp (ascii_text, ascii_prefix, prefix_len);
+#pragma GCC diagnostic pop
if (found_suggestion) {
iter_suggested = iter;
}
@@ -446,7 +449,10 @@ entry_on_text_changed (GtkEditable * editable,
g_signal_handler_unblock (selector, priv->signal_id);
if (priv->smart_match) {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuninitialized"
g_free (ascii_prefix);
+#pragma GCC diagnostic pop
}
}
diff --git a/hildon/hildon-touch-selector.c b/hildon/hildon-touch-selector.c
index f6f22fe..158a763 100644
--- a/hildon/hildon-touch-selector.c
+++ b/hildon/hildon-touch-selector.c
@@ -262,6 +262,10 @@ hildon_touch_selector_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec);
/* gtkwidget */
+static void
+hildon_touch_selector_get_preferred_height (GtkWidget *widget,
+ gint *minimal,
+ gint *natural);
/* gtkcontainer */
static void hildon_touch_selector_remove (GtkContainer * container,
@@ -342,17 +346,14 @@ static void hildon_touch_selector_column_cell_layout_reorder (GtkCellLayou
static GList *hildon_touch_selector_column_cell_layout_get_cells (GtkCellLayout *cell_layout);
static void
-hildon_touch_selector_check_ui_mode_coherence (HildonTouchSelector *selector);
-
-static void
hildon_touch_selector_class_init (HildonTouchSelectorClass * class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
+ GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
gobject_class = G_OBJECT_CLASS (class);
- object_class = GTK_OBJECT_CLASS (class);
+ widget_class = (GtkWidgetClass *) class;
container_class = GTK_CONTAINER_CLASS (class);
/* GObject */
@@ -361,6 +362,7 @@ hildon_touch_selector_class_init (HildonTouchSelectorClass * class)
gobject_class->set_property = hildon_touch_selector_set_property;
/* GtkWidget */
+ widget_class->get_preferred_height = hildon_touch_selector_get_preferred_height;
/* GtkContainer */
container_class->remove = hildon_touch_selector_remove;
@@ -449,7 +451,7 @@ hildon_touch_selector_class_init (HildonTouchSelectorClass * class)
"} widget \"*.fremantle-htst\" style \"fremantle-htst\""
"widget_class \"*<HildonPannableArea>.GtkTreeView\" style :highest \"fremantle-htst\"");
- g_type_class_add_private (object_class, sizeof (HildonTouchSelectorPrivate));
+ g_type_class_add_private (class, sizeof (HildonTouchSelectorPrivate));
}
static void
@@ -503,7 +505,7 @@ hildon_touch_selector_init (HildonTouchSelector * selector)
{
selector->priv = HILDON_TOUCH_SELECTOR_GET_PRIVATE (selector);
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (selector), GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (selector), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (selector), FALSE);
selector->priv->columns = NULL;
@@ -619,7 +621,7 @@ void
hildon_touch_selector_column_disable_focus (HildonTouchSelectorColumn *col)
{
g_return_if_fail (HILDON_IS_TOUCH_SELECTOR_COLUMN (col));
- GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (col->priv->tree_view), GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (GTK_WIDGET (col->priv->tree_view), FALSE);
}
static void
@@ -2340,7 +2342,8 @@ search_nearest_element (HildonPannableArea *panarea,
/* we add this in order to check the nearest to the center of
the visible area */
- target_value = gtk_adjustment_get_value (adj) + adj->page_size/2;
+ target_value = gtk_adjustment_get_value (adj)
+ + gtk_adjustment_get_page_size (adj)/2;
path = result_path = selected_rows->data;
gtk_tree_view_get_background_area (tv, path, NULL, &rect);
@@ -2397,7 +2400,7 @@ hildon_touch_selector_scroll_to (HildonTouchSelectorColumn *column,
GtkTreeView *tv,
GtkTreePath *path)
{
- if (GTK_WIDGET_REALIZED (column->priv->panarea)) {
+ if (gtk_widget_get_realized (GTK_WIDGET (column->priv->panarea))) {
GdkRectangle rect;
gint y;
@@ -2571,69 +2574,64 @@ hildon_touch_selector_center_on_selected (HildonTouchSelector *selector)
}
/**
- * hildon_touch_selector_optimal_size_request
- * @selector: a #HildonTouchSelector
- * @requisition: a #GtkRequisition
+ * hildon_touch_selector_get_preferred_height
+ * @widget: a #GtkWidget instance (of #HildonTouchSelector)
+ * @minimum_height: location to store the minimum height, or NULL. [out][allow-none]
+ * @natural_height: location to store the natural height, or NULL. [out][allow-none]
*
- * Gets the optimal size request of the touch selector. This function is mostly
+ * Gets the optimal height of the touch selector. This function is mostly
* intended for dialog implementations that include a #HildonTouchSelector and
* want to optimize the screen real state, for example, when you want a dialog
* to show as much of the selector, avoiding any extra empty space below the
* selector.
*
* See #HildonPickerDialog implementation for an example.
- *
- * This function is oriented to be used in the size_request of a dialog or window,
- * if you are not sure do not use it.
- *
- * There is a precondition to this function: Since this function does not
- * call the "size_request" method, it can only be used when you know that
- * gtk_widget_size_request() has been called since the last time a resize was
- * queued.
- *
- * Since: 2.2
**/
-void
-hildon_touch_selector_optimal_size_request (HildonTouchSelector *selector,
- GtkRequisition *requisition)
+static void
+hildon_touch_selector_get_preferred_height (GtkWidget *widget,
+ gint *minimal,
+ gint *natural)
{
+ HildonTouchSelectorClass *klass;
+ GtkVBoxClass *parent_class;
GSList *iter = NULL;
gint height = 0;
gint base_height = 0;
- g_return_if_fail (HILDON_IS_TOUCH_SELECTOR (selector));
+ g_return_if_fail (HILDON_IS_TOUCH_SELECTOR (widget));
- iter = selector->priv->columns;
+ iter = HILDON_TOUCH_SELECTOR (widget)->priv->columns;
/* Default optimal values are the current ones */
- gtk_widget_get_child_requisition (GTK_WIDGET (selector),
- requisition);
+ klass = HILDON_TOUCH_SELECTOR_GET_CLASS (widget);
+ parent_class = g_type_class_peek_parent (klass);
+ GTK_WIDGET_CLASS (parent_class)->get_preferred_height (widget, minimal, natural);
if (iter == NULL) {
- height = requisition->height;
+ height = *natural;
} else {
/* we use the normal requisition as base, as the touch selector can has
extra widgets, not only the columns (ie: HildonTouchSelectorEntry) */
- base_height = requisition->height;
+ base_height = *natural;
}
/* Compute optimal height for the columns */
while (iter) {
HildonTouchSelectorColumn *column;
GtkWidget *child;
- GtkRequisition child_requisition = {0};
+ gint child_minimal, child_natural;
column = HILDON_TOUCH_SELECTOR_COLUMN (iter->data);
child = GTK_WIDGET (column->priv->tree_view);
- gtk_widget_get_child_requisition (child, &child_requisition);
+ gtk_widget_get_preferred_height (child, &child_minimal, &child_natural);
- height = MAX (height, child_requisition.height);
+ height = MAX (height, child_natural);
iter = g_slist_next (iter);
}
- requisition->height = base_height + height;
+ *natural = base_height + height;
}
diff --git a/hildon/hildon-touch-selector.h b/hildon/hildon-touch-selector.h
index 12ef96d..169d839 100644
--- a/hildon/hildon-touch-selector.h
+++ b/hildon/hildon-touch-selector.h
@@ -212,9 +212,6 @@ void
hildon_touch_selector_center_on_index (HildonTouchSelector *selector,
gint column,
gint index);
-void
-hildon_touch_selector_optimal_size_request (HildonTouchSelector *selector,
- GtkRequisition *requisition);
GtkTreePath*
hildon_touch_selector_get_last_activated_row (HildonTouchSelector *selector,
diff --git a/hildon/hildon-window-stack.c b/hildon/hildon-window-stack.c
index cbc2907..96a34d7 100644
--- a/hildon/hildon-window-stack.c
+++ b/hildon/hildon-window-stack.c
@@ -188,7 +188,7 @@ hildon_window_stack_window_realized (GtkWidget *win,
HildonWindowStack *stack)
{
GdkWindow *leader = hildon_window_stack_get_leader_window (stack, win);
- gdk_window_set_group (win->window, leader);
+ gdk_window_set_group (gtk_widget_get_window (win), leader);
}
/* Remove a window from its stack, no matter its position */
@@ -203,8 +203,8 @@ hildon_window_stack_remove (HildonStackableWindow *win)
hildon_stackable_window_set_stack (win, NULL, -1);
gtk_window_set_transient_for (GTK_WINDOW (win), NULL);
- if (GTK_WIDGET (win)->window) {
- gdk_window_set_group (GTK_WIDGET (win)->window, NULL);
+ if (gtk_widget_get_window (GTK_WIDGET (win))) {
+ gdk_window_set_group (gtk_widget_get_window (GTK_WIDGET (win)), NULL);
}
/* If the window removed is in the middle of the stack, update
@@ -303,7 +303,7 @@ _hildon_window_stack_do_push (HildonWindowStack *stack,
}
/* Set window group */
- if (GTK_WIDGET_REALIZED (win)) {
+ if (gtk_widget_get_realized (GTK_WIDGET (win))) {
hildon_window_stack_window_realized (GTK_WIDGET (win), stack);
} else {
g_signal_connect (win, "realize",
diff --git a/hildon/hildon-window.c b/hildon/hildon-window.c
index 01d20c3..78c1d74 100644
--- a/hildon/hildon-window.c
+++ b/hildon/hildon-window.c
@@ -86,7 +86,6 @@
#include <X11/Xatom.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
-#include <gtk/gtkprivate.h>
#include "hildon-window.h"
#include "hildon-window-private.h"
@@ -134,8 +133,8 @@ hildon_window_menu_popup_func_full (GtkMenu *menu,
gboolean *push_in,
GtkWidget *widget);
static gboolean
-hildon_window_expose (GtkWidget *widget,
- GdkEventExpose *event);
+hildon_window_draw (GtkWidget *widget,
+ cairo_t *cr);
static void
hildon_window_forall (GtkContainer *container,
gboolean include_internals,
@@ -148,8 +147,13 @@ static void
hildon_window_size_allocate (GtkWidget * widget,
GtkAllocation *allocation);
static void
-hildon_window_size_request (GtkWidget * widget,
- GtkRequisition *requisition);
+hildon_window_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width);
+static void
+hildon_window_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height);
static void
hildon_window_finalize (GObject *obj_self);
@@ -169,7 +173,7 @@ static void
hildon_window_update_markup (HildonWindow *window);
static void
-hildon_window_destroy (GtkObject *obj);
+hildon_window_destroy (GtkWidget *obj);
static void
hildon_window_realize (GtkWidget *widget);
@@ -222,15 +226,15 @@ visible_toolbar (gpointer data,
static void
paint_toolbar (GtkWidget *widget,
- GtkBox *box,
- GdkEventExpose * event,
- gboolean fullscreen);
+ GtkBox *box,
+ cairo_t *cr,
+ gboolean fullscreen);
static void
paint_edit_toolbar (GtkWidget *widget,
GtkWidget *toolbar,
- GdkEventExpose *event,
- gboolean fullscreen);
+ cairo_t *cr,
+ gboolean fullscreen);
enum
{
@@ -260,8 +264,9 @@ hildon_window_class_init (HildonWindowClass * window_clas
object_class->set_property = hildon_window_set_property;
object_class->notify = hildon_window_notify;
widget_class->size_allocate = hildon_window_size_allocate;
- widget_class->size_request = hildon_window_size_request;
- widget_class->expose_event = hildon_window_expose;
+ widget_class->get_preferred_width = hildon_window_get_preferred_width;
+ widget_class->get_preferred_height = hildon_window_get_preferred_height;
+ widget_class->draw = hildon_window_draw;
widget_class->show_all = hildon_window_show_all;
widget_class->realize = hildon_window_realize;
widget_class->unrealize = hildon_window_unrealize;
@@ -269,6 +274,7 @@ hildon_window_class_init (HildonWindowClass * window_clas
widget_class->window_state_event = hildon_window_window_state_event;
widget_class->map = hildon_window_map;
widget_class->unmap = hildon_window_unmap;
+ widget_class->destroy = hildon_window_destroy;
/* now the object stuff */
object_class->finalize = hildon_window_finalize;
@@ -279,9 +285,6 @@ hildon_window_class_init (HildonWindowClass * window_clas
/* To this class */
window_class->toggle_menu = hildon_window_toggle_menu_real;
- /* gtkobject stuff*/
- GTK_OBJECT_CLASS (window_class)->destroy = hildon_window_destroy;
-
g_type_class_add_private (window_class,
sizeof (struct _HildonWindowPrivate));
@@ -392,10 +395,10 @@ hildon_window_realize (GtkWidget *widget)
gtk_widget_realize (priv->edit_toolbar);
/* catch the custom button signal from mb to display the menu */
- gdk_window_add_filter (widget->window, hildon_window_event_filter, widget);
+ gdk_window_add_filter (gtk_widget_get_window (widget), hildon_window_event_filter, widget);
- window = GDK_WINDOW_XID (widget->window);
- disp = GDK_WINDOW_XDISPLAY (widget->window);
+ window = GDK_WINDOW_XID (gtk_widget_get_window (widget));
+ disp = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (widget));
/* Enable custom button that is used for menu */
XGetWMProtocols (disp, window, &old_atoms, &atom_count);
@@ -412,7 +415,7 @@ hildon_window_realize (GtkWidget *widget)
g_free(new_atoms);
/* rely on GDK to set the window group to its default */
- gdk_window_set_group (widget->window, NULL);
+ gdk_window_set_group (gtk_widget_get_window (widget), NULL);
if (priv->program) {
gboolean can_hibernate = hildon_program_get_can_hibernate (priv->program);
@@ -435,7 +438,7 @@ hildon_window_unrealize (GtkWidget *widget)
HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (widget);
g_assert (priv != NULL);
- gdk_window_remove_filter (widget->window, hildon_window_event_filter,
+ gdk_window_remove_filter (gtk_widget_get_window (widget), hildon_window_event_filter,
widget);
hildon_window_update_topmost (HILDON_WINDOW (widget), 0);
@@ -457,10 +460,10 @@ hildon_window_map (GtkWidget *widget)
if (GTK_WIDGET_CLASS (hildon_window_parent_class)->map)
GTK_WIDGET_CLASS (hildon_window_parent_class)->map (widget);
- if (priv->vbox != NULL && GTK_WIDGET_VISIBLE (priv->vbox))
+ if (priv->vbox != NULL && gtk_widget_get_visible (priv->vbox))
gtk_widget_map (priv->vbox);
- if (priv->edit_toolbar != NULL && GTK_WIDGET_VISIBLE (priv->edit_toolbar))
+ if (priv->edit_toolbar != NULL && gtk_widget_get_visible (priv->edit_toolbar))
gtk_widget_map (priv->edit_toolbar);
}
@@ -566,8 +569,8 @@ hildon_window_get_borders (HildonWindow *window)
}
static gboolean
-hildon_window_expose (GtkWidget *widget,
- GdkEventExpose * event)
+hildon_window_draw (GtkWidget *widget,
+ cairo_t *cr)
{
HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (widget);
g_assert (priv);
@@ -584,21 +587,19 @@ hildon_window_expose (GtkWidget *widget,
tb = priv->toolbar_borders;
}
- tb_height = bx->allocation.height + tb->top + tb->bottom;
+ tb_height = gtk_widget_get_allocated_height (bx) + tb->top + tb->bottom;
- paint_toolbar (widget, box,
- event, priv->fullscreen);
+ paint_toolbar (widget, box, cr, priv->fullscreen);
if (priv->edit_toolbar != NULL)
{
- paint_edit_toolbar (widget, priv->edit_toolbar,
- event, priv->fullscreen);
+ paint_edit_toolbar (widget, priv->edit_toolbar, cr, priv->fullscreen);
}
if (! priv->fullscreen) {
/* Draw the left and right window border */
- gint side_borders_height = widget->allocation.height - b->top;
+ gint side_borders_height = gtk_widget_get_allocated_height (widget) - b->top;
if (priv->visible_toolbars)
side_borders_height -= tb_height;
@@ -607,42 +608,32 @@ hildon_window_expose (GtkWidget *widget,
if (b->left > 0)
{
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
- &event->area, widget, "left-border",
- widget->allocation.x, widget->allocation.y +
- b->top, b->left, side_borders_height);
+ gtk_render_frame (gtk_widget_get_style_context (widget), cr,
+ 0, b->top,
+ b->left, side_borders_height);
}
if (b->right > 0)
{
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
- &event->area, widget, "right-border",
- widget->allocation.x + widget->allocation.width -
- b->right, widget->allocation.y + b->top,
- b->right, side_borders_height);
+ gtk_render_frame (gtk_widget_get_style_context (widget), cr,
+ gtk_widget_get_allocated_width (widget) - b->right, b->top,
+ b->right, side_borders_height);
}
/* If no toolbar, draw the bottom window border */
if (! priv->visible_toolbars && b->bottom > 0)
{
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
- &event->area, widget, "bottom-border",
- widget->allocation.x, widget->allocation.y +
- (widget->allocation.height - b->bottom),
- widget->allocation.width, b->bottom);
+ gtk_render_frame (gtk_widget_get_style_context (widget), cr,
+ 0, gtk_widget_get_allocated_height (widget) - b->bottom,
+ gtk_widget_get_allocated_width (widget), b->bottom);
}
/* Draw the top border */
if (b->top > 0)
{
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
- &event->area, widget, "top-border",
- widget->allocation.x, widget->allocation.y,
- widget->allocation.width, b->top);
+ gtk_render_frame (gtk_widget_get_style_context (widget), cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (widget), b->top);
}
@@ -650,43 +641,66 @@ hildon_window_expose (GtkWidget *widget,
/* don't draw the window stuff as it overwrites our borders with a blank
* rectangle. Instead start with the drawing of the GtkBin */
- GTK_WIDGET_CLASS (g_type_class_peek_parent (hildon_window_parent_class))->expose_event (widget, event);
-
- /* FIXME Not sure why this is commented out
- * GTK_WIDGET_CLASS (hildon_window_parent_class))->
- * expose_event (widget, event);
- */
+ GTK_WIDGET_CLASS (g_type_class_peek_parent (hildon_window_parent_class))->draw (widget, cr);
return FALSE;
}
static void
-hildon_window_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+hildon_window_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
{
GdkScreen *screen = gtk_widget_get_screen (widget);
HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (widget);
GtkWidget *child;
- GtkRequisition req;
+ gint minimal, natural;
g_assert (priv);
child = gtk_bin_get_child (GTK_BIN (widget));
- if (child != NULL && GTK_WIDGET_VISIBLE (child))
- gtk_widget_size_request (child, &req);
+ if (child != NULL && gtk_widget_get_visible (child))
+ gtk_widget_get_preferred_width (child, &minimal, &natural);
- if (priv->vbox != NULL && GTK_WIDGET_VISIBLE (priv->vbox))
- gtk_widget_size_request (priv->vbox, &req);
+ if (priv->vbox != NULL && gtk_widget_get_visible (priv->vbox))
+ gtk_widget_get_preferred_width (priv->vbox, &minimal, &natural);
- if (priv->edit_toolbar != NULL && GTK_WIDGET_VISIBLE (priv->edit_toolbar))
- gtk_widget_size_request (priv->edit_toolbar, &req);
+ if (priv->edit_toolbar != NULL && gtk_widget_get_visible (priv->edit_toolbar))
+ gtk_widget_get_preferred_width (priv->edit_toolbar, &minimal, &natural);
/* Request the full size of the screen */
- requisition->width = gdk_screen_get_width (screen);
- requisition->height = gdk_screen_get_height (screen);
+ *minimal_width = *natural_width = gdk_screen_get_width (screen);
+}
+
+static void
+hildon_window_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ GdkScreen *screen = gtk_widget_get_screen (widget);
+ HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (widget);
+ GtkWidget *child;
+ gint minimal, natural;
+ g_assert (priv);
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+
+ if (child != NULL && gtk_widget_get_visible (child))
+ gtk_widget_get_preferred_height (child, &minimal, &natural);
+
+ if (priv->vbox != NULL && gtk_widget_get_visible (priv->vbox))
+ gtk_widget_get_preferred_height (priv->vbox, &minimal, &natural);
+
+ if (priv->edit_toolbar != NULL && gtk_widget_get_visible (priv->edit_toolbar))
+ gtk_widget_get_preferred_height (priv->edit_toolbar, &minimal, &natural);
+
+ /* Request the full size of the screen */
+ *minimal_height = gdk_screen_get_height (screen);
if (! priv->fullscreen)
- requisition->height -= HILDON_WINDOW_TITLEBAR_HEIGHT;
+ *minimal_height -= HILDON_WINDOW_TITLEBAR_HEIGHT;
+
+ *natural_height = *minimal_height;
}
static void
@@ -708,10 +722,10 @@ hildon_window_size_allocate (GtkWidget *widget,
tb = priv->toolbar_borders;
- widget->allocation = *allocation;
+ gtk_widget_size_allocate (widget, allocation);
/* Calculate allocation of edit toolbar */
- if (priv->edit_toolbar != NULL && GTK_WIDGET_VISIBLE (priv->edit_toolbar))
+ if (priv->edit_toolbar != NULL && gtk_widget_get_visible (priv->edit_toolbar))
{
GtkRequisition req;
gtk_widget_get_child_requisition (priv->edit_toolbar, &req);
@@ -729,7 +743,7 @@ hildon_window_size_allocate (GtkWidget *widget,
}
/* Calculate allocation of normal toolbars */
- if (priv->vbox != NULL && GTK_WIDGET_VISIBLE (priv->vbox))
+ if (priv->vbox != NULL && gtk_widget_get_visible (priv->vbox))
{
GtkRequisition req;
gtk_widget_get_child_requisition (priv->vbox, &req);
@@ -746,7 +760,7 @@ hildon_window_size_allocate (GtkWidget *widget,
}
/* Calculate allocation of the child widget */
- if (child != NULL && GTK_WIDGET_VISIBLE (child))
+ if (child != NULL && gtk_widget_get_visible (child))
{
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
alloc.x += border_width;
@@ -782,8 +796,8 @@ hildon_window_size_allocate (GtkWidget *widget,
gint draw_from_y = MIN (priv->previous_vbox_y, box_alloc.y) - tb->top;
gtk_widget_queue_draw_area (widget, 0, draw_from_y,
- widget->allocation.width,
- widget->allocation.height - draw_from_y);
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget) - draw_from_y);
priv->previous_vbox_y = box_alloc.y;
}
@@ -829,7 +843,7 @@ hildon_window_show_all (GtkWidget *widget)
}
static void
-hildon_window_destroy (GtkObject *obj)
+hildon_window_destroy (GtkWidget *obj)
{
HildonWindow *self = HILDON_WINDOW (obj);
HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (obj);
@@ -844,7 +858,7 @@ hildon_window_destroy (GtkObject *obj)
{
GtkWidget * common_toolbar =
GTK_WIDGET (hildon_program_get_common_toolbar (priv->program));
- if (common_toolbar && common_toolbar->parent == priv->vbox)
+ if (common_toolbar && gtk_widget_get_parent (common_toolbar) == priv->vbox)
{
gtk_container_remove (GTK_CONTAINER (priv->vbox),
common_toolbar);
@@ -876,7 +890,7 @@ hildon_window_destroy (GtkObject *obj)
{
if (GTK_IS_MENU (menu_node->data))
{
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (menu_node->data)))
+ if (gtk_widget_get_visible (GTK_WIDGET (menu_node->data)))
{
gtk_menu_popdown (GTK_MENU (menu_node->data));
gtk_menu_shell_deactivate (GTK_MENU_SHELL (menu_node->data));
@@ -886,7 +900,7 @@ hildon_window_destroy (GtkObject *obj)
/* Destroy it, but only if it's not a common menu */
if (priv->program &&
hildon_program_get_common_menu (priv->program) != menu_node->data) {
- gtk_object_destroy (GTK_OBJECT (menu_node->data));
+ gtk_widget_destroy (GTK_WIDGET (menu_node->data));
g_object_unref (menu_node->data);
}
}
@@ -903,7 +917,7 @@ hildon_window_destroy (GtkObject *obj)
gtk_widget_set_events (GTK_WIDGET(obj), 0);
- GTK_OBJECT_CLASS (hildon_window_parent_class)->destroy (obj);
+ GTK_WIDGET_CLASS (hildon_window_parent_class)->destroy (obj);
}
static void
@@ -926,65 +940,62 @@ static void
visible_toolbar (gpointer data,
gpointer user_data)
{
- if (GTK_WIDGET_VISIBLE (((GtkBoxChild *)data)->widget))
+ if (gtk_widget_get_visible ((GtkWidget *)data))
(*((gint *)user_data))++;
}
static void
paint_toolbar (GtkWidget *widget,
- GtkBox *box,
- GdkEventExpose * event,
- gboolean fullscreen)
+ GtkBox *box,
+ cairo_t *cr,
+ gboolean fullscreen)
{
gint toolbar_num = 0;
gint count;
+ GtkAllocation *box_allocation = NULL;
/* collect info to help on painting the boxes */
- g_list_foreach (box->children, visible_toolbar,
- (gpointer) &toolbar_num);
+ g_list_foreach (gtk_container_get_children (GTK_CONTAINER (box)),
+ visible_toolbar, (gpointer) &toolbar_num);
if(toolbar_num <= 0)
return;
+ gtk_widget_get_allocation (GTK_WIDGET (box), box_allocation);
+
/*top most toolbar painting*/
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
- &event->area, widget, "toolbar-primary",
- widget->allocation.x,
- GTK_WIDGET(box)->allocation.y,
- widget->allocation.width,
- TOOLBAR_HEIGHT);
+ gtk_render_frame (gtk_widget_get_style_context (widget), cr,
+ 0, box_allocation->y,
+ gtk_widget_get_allocated_width (widget), TOOLBAR_HEIGHT);
/*multi toolbar painting*/
for (count = 0; count < toolbar_num - 1; count++)
{
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
- &event->area, widget, "toolbar-secondary",
- widget->allocation.x,
- GTK_WIDGET(box)->allocation.y +
- (1 + count) * (TOOLBAR_HEIGHT),
- widget->allocation.width,
- TOOLBAR_HEIGHT);
+ gtk_render_frame (gtk_widget_get_style_context (widget), cr,
+ 0, box_allocation->y +
+ (1 + count) * (TOOLBAR_HEIGHT),
+ gtk_widget_get_allocated_width (widget), TOOLBAR_HEIGHT);
}
}
static void
paint_edit_toolbar (GtkWidget *widget,
GtkWidget *toolbar,
- GdkEventExpose *event,
- gboolean fullscreen)
+ cairo_t *cr,
+ gboolean fullscreen)
{
- if (!GTK_WIDGET_VISIBLE (toolbar))
+ GtkAllocation *toolbar_allocation = NULL;
+
+ if (!gtk_widget_get_visible (toolbar))
return;
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
- &event->area, widget, "toolbar-edit-mode",
- toolbar->allocation.x,
- toolbar->allocation.y,
- toolbar->allocation.width,
- toolbar->allocation.height);
+ gtk_widget_get_allocation (toolbar, toolbar_allocation);
+
+ gtk_render_frame (gtk_widget_get_style_context (widget), cr,
+ toolbar_allocation->x,
+ toolbar_allocation->y,
+ toolbar_allocation->width,
+ toolbar_allocation->height);
}
/*
@@ -1006,12 +1017,13 @@ hildon_window_get_active_window (void)
unsigned char *char_pointer;
} win;
Atom active_app_atom =
- XInternAtom (GDK_DISPLAY (), "_MB_CURRENT_APP_WINDOW", False);
+ XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "_MB_CURRENT_APP_WINDOW", False);
win.win = NULL;
gdk_error_trap_push ();
- status = XGetWindowProperty (GDK_DISPLAY(), GDK_ROOT_WINDOW(),
+ status = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+ GDK_ROOT_WINDOW(),
active_app_atom, 0L, 16L,
0, XA_WINDOW, &realtype, &format,
&n, &extra, &win.char_pointer);
@@ -1038,7 +1050,8 @@ static int
xclient_message_type_check (XClientMessageEvent *cm,
const gchar *name)
{
- return cm->message_type == XInternAtom(GDK_DISPLAY(), name, FALSE);
+ return cm->message_type == XInternAtom(
+ GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), name, FALSE);
}
/*
@@ -1067,7 +1080,8 @@ hildon_window_event_filter (GdkXEvent *xevent,
{
XPropertyEvent *pevent = xevent;
Atom active_app_atom =
- XInternAtom (GDK_DISPLAY (), "_MB_CURRENT_APP_WINDOW", False);
+ XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+ "_MB_CURRENT_APP_WINDOW", False);
if (pevent->atom == active_app_atom)
{
@@ -1134,15 +1148,18 @@ static void
set_legacy_menu_type (GtkMenu *menu,
gboolean set)
{
- GdkWindow *gdkwin = GTK_WIDGET (menu->toplevel)->window;
- GdkAtom property = gdk_atom_intern_static_string (LEGACY_MENU_PROPERTY_NAME);
- if (set) {
- GdkAtom type = gdk_x11_xatom_to_atom (XA_ATOM);
- GdkAtom value = gdk_atom_intern_static_string (LEGACY_MENU_PROPERTY_VALUE);
- gdk_property_change (gdkwin, property, type, 32,
- GDK_PROP_MODE_REPLACE, (const guchar *) &value, 1);
- } else {
- gdk_property_delete (gdkwin, property);
+ GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menu));
+ if (gtk_widget_is_toplevel (toplevel)) {
+ GdkWindow *gdkwin = gtk_widget_get_window (toplevel);
+ GdkAtom property = gdk_atom_intern_static_string (LEGACY_MENU_PROPERTY_NAME);
+ if (set) {
+ GdkAtom type = gdk_x11_xatom_to_atom (XA_ATOM);
+ GdkAtom value = gdk_atom_intern_static_string (LEGACY_MENU_PROPERTY_VALUE);
+ gdk_property_change (gdkwin, property, type, 32,
+ GDK_PROP_MODE_REPLACE, (const guchar *) &value, 1);
+ } else {
+ gdk_property_delete (gdkwin, property);
+ }
}
}
@@ -1172,7 +1189,7 @@ hildon_window_menu_popup_func (GtkMenu *menu,
{
gint window_x = 0;
gint window_y = 0;
- GdkWindow *window = GTK_WIDGET(widget)->window;
+ GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (widget));
if (window)
{
@@ -1184,7 +1201,8 @@ hildon_window_menu_popup_func (GtkMenu *menu,
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{
- *x = GTK_WIDGET (widget)->allocation.width + window_x - GTK_WIDGET (menu)->allocation.width - *x;
+ *x = gtk_widget_get_allocated_width (widget) + window_x
+ - gtk_widget_get_allocated_width (GTK_WIDGET (menu)) - *x;
}
else
*x += window_x;
@@ -1204,7 +1222,8 @@ hildon_window_menu_popup_func_full (GtkMenu *menu,
"vertical-offset", y, NULL);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- *x = GTK_WIDGET (widget)->allocation.width - GTK_WIDGET (menu)->allocation.width - *x;
+ *x = gtk_widget_get_allocated_width (widget)
+ - gtk_widget_get_allocated_width (GTK_WIDGET (menu)) - *x;
else
*x = MAX (0, *x);
@@ -1320,7 +1339,7 @@ hildon_window_set_can_hibernate_property (HildonWindow *self,
g_return_if_fail(self && HILDON_IS_WINDOW (self));
- if (!GTK_WIDGET_REALIZED ((GTK_WIDGET (self))))
+ if (!gtk_widget_get_realized (GTK_WIDGET (self)))
{
return;
}
@@ -1331,14 +1350,14 @@ hildon_window_set_can_hibernate_property (HildonWindow *self,
if (can_hibernate)
{
- gdk_property_change (GTK_WIDGET (self)->window, killable_atom,
+ gdk_property_change (gtk_widget_get_window (GTK_WIDGET (self)), killable_atom,
(GdkAtom)31/* XA_STRING */, 8,
GDK_PROP_MODE_REPLACE, (const guchar *)CAN_HIBERNATE,
CAN_HIBERNATE_LENGTH);
}
else
{
- gdk_property_delete (GTK_WIDGET (self)->window, killable_atom);
+ gdk_property_delete (gtk_widget_get_window (GTK_WIDGET (self)), killable_atom);
}
}
@@ -1360,23 +1379,25 @@ hildon_window_take_common_toolbar (HildonWindow *self)
GtkWidget *common_toolbar =
GTK_WIDGET (hildon_program_get_common_toolbar (priv->program));
- if (common_toolbar && common_toolbar->parent != priv->vbox)
- {
- g_object_ref (common_toolbar);
- if (common_toolbar->parent)
+ if (common_toolbar) {
+ GtkWidget *parent = gtk_widget_get_parent (common_toolbar);
+ if (parent != priv->vbox)
{
- gtk_container_remove (GTK_CONTAINER (common_toolbar->parent),
- common_toolbar);
- }
-
- gtk_box_pack_end (GTK_BOX(priv->vbox), common_toolbar,
- TRUE, TRUE, 0);
- g_object_unref (common_toolbar);
+ g_object_ref (common_toolbar);
+ if (parent)
+ {
+ gtk_container_remove (GTK_CONTAINER (parent),
+ common_toolbar);
+ }
- gtk_widget_set_size_request (common_toolbar, -1, TOOLBAR_HEIGHT);
+ gtk_box_pack_end (GTK_BOX(priv->vbox), common_toolbar,
+ TRUE, TRUE, 0);
+ g_object_unref (common_toolbar);
- gtk_widget_show (priv->vbox);
+ gtk_widget_set_size_request (common_toolbar, -1, TOOLBAR_HEIGHT);
+ gtk_widget_show (priv->vbox);
+ }
}
}
}
@@ -1395,7 +1416,7 @@ hildon_window_update_topmost (HildonWindow *self,
g_return_if_fail (HILDON_IS_WINDOW (self));
g_assert (priv);
- my_window = GTK_WIDGET (self)->window;
+ my_window = gtk_widget_get_window (GTK_WIDGET (self));
if (my_window && window_id == GDK_WINDOW_XID (my_window))
{
@@ -1412,9 +1433,9 @@ hildon_window_update_topmost (HildonWindow *self,
GtkWidget *focus = gtk_window_get_focus (GTK_WINDOW (self));
if (GTK_IS_ENTRY (focus))
- gtk_im_context_focus_out (GTK_ENTRY (focus)->im_context);
+ gtk_entry_reset_im_context (GTK_ENTRY (focus));
if (GTK_IS_TEXT_VIEW (focus))
- gtk_im_context_focus_out (GTK_TEXT_VIEW (focus)->im_context);
+ gtk_text_view_reset_im_context (GTK_TEXT_VIEW (focus));
priv->is_topmost = FALSE;
hildon_window_is_topmost_notify (self);
@@ -1469,7 +1490,7 @@ hildon_window_toggle_gtk_menu (HildonWindow *self,
g_object_unref (menu);
}
- if (GTK_WIDGET_MAPPED (menu))
+ if (gtk_widget_get_mapped (GTK_WIDGET (menu)))
{
gtk_menu_popdown (menu);
gtk_menu_shell_deactivate (GTK_MENU_SHELL (menu));
@@ -1486,7 +1507,7 @@ hildon_window_toggle_gtk_menu (HildonWindow *self,
g_list_free (menu_children);
/* Set the 'legacy app menu' property when the widget is realized */
- if (GTK_WIDGET_REALIZED (menu)) {
+ if (gtk_widget_get_realized (GTK_WIDGET (menu))) {
set_legacy_menu_type (menu, TRUE);
} else {
g_signal_connect (menu, "realize",
@@ -1534,7 +1555,7 @@ hildon_window_toggle_app_menu (HildonWindow *self,
gtk_widget_hide (GTK_WIDGET (menu));
}
- if (GTK_WIDGET_MAPPED (menu))
+ if (gtk_widget_get_mapped (GTK_WIDGET (menu)))
{
gtk_widget_hide (GTK_WIDGET (menu));
}
@@ -1621,7 +1642,7 @@ hildon_window_add_with_scrollbar (HildonWindow *self,
g_return_if_fail (HILDON_IS_WINDOW (self));
g_return_if_fail (GTK_IS_WIDGET (child));
- g_return_if_fail (child->parent == NULL);
+ g_return_if_fail (gtk_widget_get_parent (child) == NULL);
scrolledw = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL));
gtk_scrolled_window_set_policy (scrolledw, GTK_POLICY_NEVER,
@@ -1633,7 +1654,7 @@ hildon_window_add_with_scrollbar (HildonWindow *self,
else
{
if (GTK_IS_CONTAINER (child) )
- gtk_container_set_focus_vadjustment (GTK_CONTAINER(child),
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (child),
gtk_scrolled_window_get_vadjustment (scrolledw) );
gtk_scrolled_window_add_with_viewport (scrolledw, child);
}
@@ -1645,7 +1666,7 @@ static void
calculate_visible_toolbars (gpointer data,
gpointer user_data)
{
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (((GtkBoxChild *)data)->widget)))
+ if (gtk_widget_get_visible ((GtkWidget *)data))
(*((gint *)user_data)) ++;
}
@@ -1660,8 +1681,8 @@ toolbar_visible_notify (GtkWidget *toolbar, GParamSpec
/* Recalculate from scratch the value just in case */
priv->visible_toolbars = 0;
- g_list_foreach (GTK_BOX (priv->vbox)->children, calculate_visible_toolbars,
- &priv->visible_toolbars);
+ g_list_foreach (gtk_container_get_children (GTK_CONTAINER (priv->vbox)),
+ calculate_visible_toolbars, &priv->visible_toolbars);
if (priv->visible_toolbars == 0)
gtk_widget_hide (priv->vbox);
@@ -1700,7 +1721,7 @@ hildon_window_add_toolbar (HildonWindow *self,
g_signal_connect (G_OBJECT (toolbar), "notify::visible",
G_CALLBACK (toolbar_visible_notify), self);
- if (GTK_WIDGET_VISIBLE (toolbar))
+ if (gtk_widget_get_visible (GTK_WIDGET (toolbar)))
{
priv->visible_toolbars++;
gtk_widget_show (priv->vbox);
@@ -1728,7 +1749,7 @@ hildon_window_remove_toolbar (HildonWindow *self,
priv = HILDON_WINDOW_GET_PRIVATE (self);
- if (GTK_WIDGET_VISIBLE (toolbar))
+ if (gtk_widget_get_visible (GTK_WIDGET (toolbar)))
{
if (--(priv->visible_toolbars) == 0)
gtk_widget_hide (priv->vbox);
@@ -1992,7 +2013,7 @@ hildon_window_update_markup (HildonWindow *window)
HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (window);
GdkAtom markup_atom = gdk_atom_intern ("_HILDON_WM_NAME", FALSE);
GdkAtom utf8_atom = gdk_atom_intern ("UTF8_STRING", FALSE);
- GdkWindow *gdkwin = GTK_WIDGET (window)->window;
+ GdkWindow *gdkwin = gtk_widget_get_window (GTK_WIDGET (window));
if (priv->markup) {
gdk_property_change (gdkwin, markup_atom, utf8_atom, 8,
@@ -2058,7 +2079,7 @@ hildon_window_set_markup (HildonWindow *window,
g_free (priv->markup);
priv->markup = new_markup;
- if (GTK_WIDGET_REALIZED (window))
+ if (gtk_widget_get_realized (GTK_WIDGET (window)))
hildon_window_update_markup (window);
g_object_notify (G_OBJECT (window), "markup");
diff --git a/hildon/hildon-wizard-dialog.c b/hildon/hildon-wizard-dialog.c
index d4b0948..badf4ec 100644
--- a/hildon/hildon-wizard-dialog.c
+++ b/hildon/hildon-wizard-dialog.c
@@ -86,7 +86,7 @@ static void
finalize (GObject *object);
static void
-destroy (GtkObject *object);
+destroy (GtkWidget *object);
static void
response (HildonWizardDialog *wizard,
@@ -146,7 +146,7 @@ static void
hildon_wizard_dialog_class_init (HildonWizardDialogClass *wizard_dialog_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (wizard_dialog_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (wizard_dialog_class);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (wizard_dialog_class);
parent_class = g_type_class_peek_parent (wizard_dialog_class);
g_type_class_add_private (wizard_dialog_class, sizeof (HildonWizardDialogPrivate));
@@ -155,7 +155,7 @@ hildon_wizard_dialog_class_init (HildonWizardDialogClass *wizard
object_class->set_property = hildon_wizard_dialog_set_property;
object_class->get_property = hildon_wizard_dialog_get_property;
object_class->finalize = finalize;
- gtk_object_class->destroy = destroy;
+ widget_class->destroy = destroy;
/**
* HildonWizardDialog:wizard-name:
@@ -215,7 +215,7 @@ finalize (GObject *object)
}
static void
-destroy (GtkObject *object)
+destroy (GtkWidget *object)
{
HildonWizardDialogPrivate *priv = HILDON_WIZARD_DIALOG_GET_PRIVATE (object);
@@ -262,9 +262,6 @@ hildon_wizard_dialog_init (HildonWizardDialog *wizard_dial
GtkDialog *dialog = GTK_DIALOG (wizard_dialog);
- /* Init internal widgets */
- gtk_dialog_set_has_separator (dialog, FALSE);
-
/* Default values for user provided properties */
priv->notebook = NULL;
priv->wizard_name = NULL;
@@ -283,7 +280,7 @@ hildon_wizard_dialog_init (HildonWizardDialog *wizard_dial
make_buttons_sensitive (wizard_dialog, FALSE, FALSE, TRUE);
/* Show all the internal widgets */
- gtk_widget_show_all (GTK_WIDGET (dialog->vbox));
+ gtk_widget_show_all (GTK_WIDGET (gtk_dialog_get_content_area (dialog)));
/* connect to dialog's response signal */
g_signal_connect (G_OBJECT (dialog), "response",
@@ -344,7 +341,7 @@ hildon_wizard_dialog_set_property (GObject *object,
* and remove borders) to make it look like a nice wizard widget */
gtk_notebook_set_show_tabs (priv->notebook, FALSE);
gtk_notebook_set_show_border (priv->notebook, FALSE);
- gtk_box_pack_start_defaults (GTK_BOX (dialog->vbox), GTK_WIDGET (priv->notebook));
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (priv->notebook), TRUE, TRUE, 0);
/* Show the notebook so that a gtk_widget_show on the dialog is
* all that is required to display the dialog correctly */
@@ -392,7 +389,7 @@ hildon_wizard_dialog_get_property (GObject *object,
static void
create_title (HildonWizardDialog *wizard_dialog)
{
- gint pages, current;
+ gint current;
gchar *str = NULL;
HildonWizardDialogPrivate *priv = HILDON_WIZARD_DIALOG_GET_PRIVATE (wizard_dialog);
GtkNotebook *notebook;
@@ -404,7 +401,6 @@ create_title (HildonWizardDialog *wizard_dial
return;
/* Get page information, we'll need that when creating title */
- pages = gtk_notebook_get_n_pages (notebook);
current = gtk_notebook_get_current_page (priv->notebook);
if (current < 0)
current = 0;
@@ -448,7 +444,7 @@ response (HildonWizardDialog *wizard_dial
g_assert (priv);
- current = gtk_notebook_current_page (notebook);
+ current = gtk_notebook_get_current_page (notebook);
switch (response_id) {