diff options
author | Javier Jardón <jjardon@gnome.org> | 2009-11-13 13:29:35 +0800 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2009-11-17 07:53:40 +0800 |
commit | 6f9fe3b417a3870ce48288f1273843af05d39624 (patch) | |
tree | bf9836bcf0e67793ee18e3beca4835880ed656aa /libempathy-gtk | |
parent | e836a987945a601d70082eef2c6f2fd6796c4fd3 (diff) | |
download | gsoc2013-empathy-6f9fe3b417a3870ce48288f1273843af05d39624.tar gsoc2013-empathy-6f9fe3b417a3870ce48288f1273843af05d39624.tar.gz gsoc2013-empathy-6f9fe3b417a3870ce48288f1273843af05d39624.tar.bz2 gsoc2013-empathy-6f9fe3b417a3870ce48288f1273843af05d39624.tar.lz gsoc2013-empathy-6f9fe3b417a3870ce48288f1273843af05d39624.tar.xz gsoc2013-empathy-6f9fe3b417a3870ce48288f1273843af05d39624.tar.zst gsoc2013-empathy-6f9fe3b417a3870ce48288f1273843af05d39624.zip |
Use accessor functions instead direct access.
Some functions still remaining because there is not API
in GTK+ 2.19.0 yet.
http://bugzilla.gnome.org/show_bug.cgi?id=586476
Reviewed-By: Danielle Madeley <danielle.madeley@collabora.co.uk>
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-avatar-image.c | 6 | ||||
-rw-r--r-- | libempathy-gtk/empathy-cell-renderer-expander.c | 4 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 10 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-dialogs.c | 6 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-menu.c | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-kludge-label.c | 9 | ||||
-rw-r--r-- | libempathy-gtk/empathy-presence-chooser.c | 6 | ||||
-rw-r--r-- | libempathy-gtk/empathy-status-preset-dialog.c | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.c | 4 | ||||
-rw-r--r-- | libempathy-gtk/empathy-video-widget.c | 6 |
10 files changed, 33 insertions, 22 deletions
diff --git a/libempathy-gtk/empathy-avatar-image.c b/libempathy-gtk/empathy-avatar-image.c index 03f638336..ef4185ae9 100644 --- a/libempathy-gtk/empathy-avatar-image.c +++ b/libempathy-gtk/empathy-avatar-image.c @@ -190,6 +190,7 @@ avatar_image_button_press_event (GtkWidget *widget, GdkEventButton *event) gint popup_width, popup_height; gint width, height; GdkPixbuf *pixbuf; + GtkAllocation allocation; priv = GET_PRIV (widget); @@ -205,8 +206,9 @@ avatar_image_button_press_event (GtkWidget *widget, GdkEventButton *event) popup_width = gdk_pixbuf_get_width (priv->pixbuf); popup_height = gdk_pixbuf_get_height (priv->pixbuf); - width = priv->image->allocation.width; - height = priv->image->allocation.height; + gtk_widget_get_allocation (priv->image, &allocation); + width = allocation.width; + height = allocation.height; /* Don't show a popup if the popup is smaller then the currently avatar * image. diff --git a/libempathy-gtk/empathy-cell-renderer-expander.c b/libempathy-gtk/empathy-cell-renderer-expander.c index 481bb8a49..fb360431f 100644 --- a/libempathy-gtk/empathy-cell-renderer-expander.c +++ b/libempathy-gtk/empathy-cell-renderer-expander.c @@ -354,13 +354,15 @@ invalidate_node (GtkTreeView *tree_view, { GdkWindow *bin_window; GdkRectangle rect; + GtkAllocation allocation; bin_window = gtk_tree_view_get_bin_window (tree_view); gtk_tree_view_get_background_area (tree_view, path, NULL, &rect); rect.x = 0; - rect.width = GTK_WIDGET (tree_view)->allocation.width; + gtk_widget_get_allocation (GTK_WIDGET (tree_view), &allocation); + rect.width = allocation.width; gdk_window_invalidate_rect (bin_window, &rect, TRUE); } diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 67c8426cb..07bd35711 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1822,6 +1822,7 @@ chat_update_contacts_visibility (EmpathyChat *chat) { EmpathyChatPriv *priv = GET_PRIV (chat); gboolean show; + GtkAllocation allocation; show = priv->remote_contact == NULL && priv->show_contacts; @@ -1839,7 +1840,8 @@ chat_update_contacts_visibility (EmpathyChat *chat) * chat view is bigger the contact list will take some space on * it but we make sure the chat view don't become smaller than * 250. Relax the size request once the resize is done */ - min_width = MIN (priv->vbox_left->allocation.width, 250); + gtk_widget_get_allocation (priv->vbox_left, &allocation); + min_width = MIN (allocation.width, 250); gtk_widget_set_size_request (priv->vbox_left, min_width, -1); g_idle_add (chat_reset_size_request, priv->vbox_left); @@ -2053,7 +2055,7 @@ chat_size_request (GtkWidget *widget, child = gtk_bin_get_child (bin); - if (child && GTK_WIDGET_VISIBLE (child)) + if (child && gtk_widget_get_visible (child)) { GtkRequisition child_requisition; @@ -2072,11 +2074,11 @@ chat_size_allocate (GtkWidget *widget, GtkAllocation child_allocation; GtkWidget *child; - widget->allocation = *allocation; + gtk_widget_set_allocation (widget, allocation); child = gtk_bin_get_child (bin); - if (child && GTK_WIDGET_VISIBLE (child)) + if (child && gtk_widget_get_visible (child)) { child_allocation.x = allocation->x + gtk_container_get_border_width (GTK_CONTAINER (widget)); child_allocation.y = allocation->y + gtk_container_get_border_width (GTK_CONTAINER (widget)); diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c index b7108d8f3..c00558402 100644 --- a/libempathy-gtk/empathy-contact-dialogs.c +++ b/libempathy-gtk/empathy-contact-dialogs.c @@ -184,7 +184,7 @@ empathy_contact_information_dialog_show (EmpathyContact *contact, gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CLOSE); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button, TRUE); gtk_window_set_default (GTK_WINDOW (dialog), button); gtk_widget_show (button); @@ -243,7 +243,7 @@ empathy_contact_edit_dialog_show (EmpathyContact *contact, gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CLOSE); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button, TRUE); gtk_window_set_default (GTK_WINDOW (dialog), button); gtk_widget_show (button); @@ -294,7 +294,7 @@ empathy_contact_personal_dialog_show (GtkWindow *parent) gtk_dialog_add_action_widget (GTK_DIALOG (personal_dialog), button, GTK_RESPONSE_CLOSE); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button, TRUE); gtk_window_set_default (GTK_WINDOW (personal_dialog), button); gtk_widget_show (button); diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c index d261d5554..4e1adfa90 100644 --- a/libempathy-gtk/empathy-contact-menu.c +++ b/libempathy-gtk/empathy-contact-menu.c @@ -140,7 +140,7 @@ empathy_contact_add_menu_item_activated (GtkMenuItem *item, GtkWidget *toplevel; toplevel = gtk_widget_get_toplevel (GTK_WIDGET (item)); - if (!GTK_WIDGET_TOPLEVEL (toplevel) || !GTK_IS_WINDOW (toplevel)) { + if (!gtk_widget_is_toplevel (toplevel) || !GTK_IS_WINDOW (toplevel)) { toplevel = NULL; } diff --git a/libempathy-gtk/empathy-kludge-label.c b/libempathy-gtk/empathy-kludge-label.c index f4a29dec2..7ed4be62f 100644 --- a/libempathy-gtk/empathy-kludge-label.c +++ b/libempathy-gtk/empathy-kludge-label.c @@ -44,6 +44,7 @@ empathy_kludge_label_expose_event (GtkWidget *self, PangoLayout *layout; PangoRectangle rect; GtkAllocation real_allocation; + GtkAllocation allocation; gboolean r; layout = gtk_label_get_layout (GTK_LABEL (self)); @@ -54,13 +55,15 @@ empathy_kludge_label_expose_event (GtkWidget *self, * layout when painting it. This really sucks. We're going to compensate by * adding this value to the allocation. */ - real_allocation = self->allocation; - self->allocation.x += rect.x; + gtk_widget_get_allocation (self, &allocation); + real_allocation = allocation; + allocation.x += rect.x; + gtk_widget_set_allocation (self, &allocation); r = GTK_WIDGET_CLASS (empathy_kludge_label_parent_class)->expose_event ( self, event); - self->allocation = real_allocation; + gtk_widget_set_allocation (self, &real_allocation); return r; } diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c index 33e533273..08c328681 100644 --- a/libempathy-gtk/empathy-presence-chooser.c +++ b/libempathy-gtk/empathy-presence-chooser.c @@ -385,7 +385,7 @@ presence_chooser_set_status_editing (EmpathyPresenceChooser *self, /* attempt to get the toplevel for this widget */ window = gtk_widget_get_toplevel (GTK_WIDGET (self)); - if (GTK_WIDGET_TOPLEVEL (window) && GTK_IS_WINDOW (window)) { + if (gtk_widget_is_toplevel (window) && GTK_IS_WINDOW (window)) { /* unset the focus */ gtk_window_set_focus (GTK_WINDOW (window), NULL); } @@ -530,7 +530,7 @@ presence_chooser_entry_button_press_event_cb (EmpathyPresenceChooser *self, if (!priv->editing_status && event->button == 1 && - !GTK_WIDGET_HAS_FOCUS (entry)) { + !gtk_widget_has_focus (entry)) { gtk_widget_grab_focus (entry); gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1); @@ -598,7 +598,7 @@ presence_chooser_changed_cb (GtkComboBox *self, gpointer user_data) /* attempt to get the toplevel for this widget */ window = gtk_widget_get_toplevel (GTK_WIDGET (self)); - if (!GTK_WIDGET_TOPLEVEL (window) || !GTK_IS_WINDOW (window)) { + if (!gtk_widget_is_toplevel (window) || !GTK_IS_WINDOW (window)) { window = NULL; } diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c index 0337d16a3..4a4893b57 100644 --- a/libempathy-gtk/empathy-status-preset-dialog.c +++ b/libempathy-gtk/empathy-status-preset-dialog.c @@ -477,7 +477,7 @@ status_preset_dialog_add_combo_press_event (GtkWidget *widget, GdkEventButton *event, EmpathyStatusPresetDialog *self) { - if (!GTK_WIDGET_HAS_FOCUS (widget)) { + if (!gtk_widget_has_focus (widget)) { /* if the widget isn't focused, focus it and select the text */ gtk_widget_grab_focus (widget); gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1); diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 4bbc3b81c..523b89351 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -1322,7 +1322,7 @@ empathy_get_toplevel_window (GtkWidget *widget) toplevel = gtk_widget_get_toplevel (widget); if (GTK_IS_WINDOW (toplevel) && - GTK_WIDGET_TOPLEVEL (toplevel)) { + gtk_widget_is_toplevel (toplevel)) { return GTK_WINDOW (toplevel); } @@ -1496,7 +1496,7 @@ empathy_send_file_with_file_chooser (EmpathyContact *contact) gtk_widget_show (button); gtk_dialog_add_action_widget (GTK_DIALOG (widget), button, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button, TRUE); gtk_dialog_set_default_response (GTK_DIALOG (widget), GTK_RESPONSE_OK); diff --git a/libempathy-gtk/empathy-video-widget.c b/libempathy-gtk/empathy-video-widget.c index 915aa33da..902e5cd7f 100644 --- a/libempathy-gtk/empathy-video-widget.c +++ b/libempathy-gtk/empathy-video-widget.c @@ -96,7 +96,7 @@ empathy_video_widget_init (EmpathyVideoWidget *obj) gtk_widget_modify_bg (GTK_WIDGET (obj), GTK_STATE_NORMAL, &black); - GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (obj), GTK_DOUBLE_BUFFERED); + gtk_widget_set_double_buffered (GTK_WIDGET (obj), FALSE); } static void @@ -425,14 +425,16 @@ empathy_video_widget_expose_event (GtkWidget *widget, GdkEventExpose *event) { EmpathyVideoWidget *self = EMPATHY_VIDEO_WIDGET (widget); EmpathyVideoWidgetPriv *priv = GET_PRIV (self); + GtkAllocation allocation; if (event != NULL && event->count > 0) return TRUE; if (priv->overlay == NULL) { + gtk_widget_get_allocation (widget, &allocation); gdk_window_clear_area (gtk_widget_get_window (widget), 0, 0, - widget->allocation.width, widget->allocation.height); + allocation.width, allocation.height); return TRUE; } |