From 7deb4ea20b08eab10473f2620c90f6b896d5af10 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Sat, 20 Jun 2009 17:27:06 +0100 Subject: Use accessor functions instead direct access (Fixes #586476) Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-avatar-chooser.c | 10 +++---- libempathy-gtk/empathy-avatar-image.c | 2 +- libempathy-gtk/empathy-cell-renderer-expander.c | 38 ++++++++++++++++++------- libempathy-gtk/empathy-chat-text-view.c | 6 ++-- libempathy-gtk/empathy-chat.c | 31 ++++++++++++-------- libempathy-gtk/empathy-contact-dialogs.c | 8 +++--- libempathy-gtk/empathy-contact-list-view.c | 4 +-- libempathy-gtk/empathy-status-preset-dialog.c | 4 +-- libempathy-gtk/empathy-ui-utils.c | 4 +-- libempathy-gtk/empathy-video-widget.c | 6 ++-- 10 files changed, 70 insertions(+), 43 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c index 83475b565..af96885e4 100644 --- a/libempathy-gtk/empathy-avatar-chooser.c +++ b/libempathy-gtk/empathy-avatar-chooser.c @@ -786,24 +786,24 @@ avatar_chooser_drag_data_received_cb (GtkWidget *widget, gchar *target_type; gboolean handled = FALSE; - target_type = gdk_atom_name (selection_data->target); + target_type = gdk_atom_name (gtk_selection_data_get_target (selection_data)); if (!strcmp (target_type, URI_LIST_TYPE)) { GFile *file; GFileInputStream *input_stream; gchar *nl; gchar *data = NULL; - nl = strstr (selection_data->data, "\r\n"); + nl = strstr (gtk_selection_data_get_data (selection_data), "\r\n"); if (nl) { gchar *uri; - uri = g_strndup (selection_data->data, - nl - (gchar *) selection_data->data); + uri = g_strndup (gtk_selection_data_get_data (selection_data), + nl - (gchar *) gtk_selection_data_get_data (selection_data)); file = g_file_new_for_uri (uri); g_free (uri); } else { - file = g_file_new_for_uri (selection_data->data); + file = g_file_new_for_uri (gtk_selection_data_get_data (selection_data)); } input_stream = g_file_read (file, NULL, NULL); diff --git a/libempathy-gtk/empathy-avatar-image.c b/libempathy-gtk/empathy-avatar-image.c index d430c0fa6..f7898e1bd 100644 --- a/libempathy-gtk/empathy-avatar-image.c +++ b/libempathy-gtk/empathy-avatar-image.c @@ -232,7 +232,7 @@ avatar_image_button_press_event (GtkWidget *widget, GdkEventButton *event) gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf); g_object_unref (pixbuf); - gdk_window_get_origin (priv->image->window, &x, &y); + gdk_window_get_origin (gtk_widget_get_window (priv->image), &x, &y); x = x - (popup_width - width) / 2; y = y - (popup_height - height) / 2; diff --git a/libempathy-gtk/empathy-cell-renderer-expander.c b/libempathy-gtk/empathy-cell-renderer-expander.c index 6fb7cfded..bd5c89f19 100644 --- a/libempathy-gtk/empathy-cell-renderer-expander.c +++ b/libempathy-gtk/empathy-cell-renderer-expander.c @@ -101,9 +101,11 @@ empathy_cell_renderer_expander_init (EmpathyCellRendererExpander *expander) priv->activatable = TRUE; priv->animation_node = NULL; - GTK_CELL_RENDERER (expander)->xpad = 2; - GTK_CELL_RENDERER (expander)->ypad = 2; - GTK_CELL_RENDERER (expander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE; + g_object_set (expander, + "xpad", 2, + "ypad", 2, + "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, + NULL); } static void @@ -252,18 +254,27 @@ empathy_cell_renderer_expander_get_size (GtkCellRenderer *cell, { EmpathyCellRendererExpander *expander; EmpathyCellRendererExpanderPriv *priv; + gfloat xalign, yalign; + guint xpad, ypad; expander = (EmpathyCellRendererExpander *) cell; priv = GET_PRIV (expander); + g_object_get (cell, + "xalign", &xalign, + "yalign", &yalign, + "xpad", &xpad, + "ypad", &ypad, + NULL); + if (cell_area) { if (x_offset) { - *x_offset = cell->xalign * (cell_area->width - (priv->expander_size + (2 * cell->xpad))); + *x_offset = xalign * (cell_area->width - (priv->expander_size + (2 * xpad))); *x_offset = MAX (*x_offset, 0); } if (y_offset) { - *y_offset = cell->yalign * (cell_area->height - (priv->expander_size + (2 * cell->ypad))); + *y_offset = yalign * (cell_area->height - (priv->expander_size + (2 * ypad))); *y_offset = MAX (*y_offset, 0); } } else { @@ -275,10 +286,10 @@ empathy_cell_renderer_expander_get_size (GtkCellRenderer *cell, } if (width) - *width = cell->xpad * 2 + priv->expander_size; + *width = xpad * 2 + priv->expander_size; if (height) - *height = cell->ypad * 2 + priv->expander_size; + *height = ypad * 2 + priv->expander_size; } static void @@ -294,6 +305,8 @@ empathy_cell_renderer_expander_render (GtkCellRenderer *cell, EmpathyCellRendererExpanderPriv *priv; GtkExpanderStyle expander_style; gint x_offset, y_offset; + guint xpad, ypad; + expander = (EmpathyCellRendererExpander *) cell; priv = GET_PRIV (expander); @@ -319,14 +332,19 @@ empathy_cell_renderer_expander_render (GtkCellRenderer *cell, &x_offset, &y_offset, NULL, NULL); - gtk_paint_expander (widget->style, + g_object_get (cell, + "xpad", &xpad, + "ypad", &ypad, + NULL); + + gtk_paint_expander (gtk_widget_get_style (widget), window, GTK_STATE_NORMAL, expose_area, widget, "treeview", - cell_area->x + x_offset + cell->xpad + priv->expander_size / 2, - cell_area->y + y_offset + cell->ypad + priv->expander_size / 2, + cell_area->x + x_offset + xpad + priv->expander_size / 2, + cell_area->y + y_offset + ypad + priv->expander_size / 2, expander_style); } diff --git a/libempathy-gtk/empathy-chat-text-view.c b/libempathy-gtk/empathy-chat-text-view.c index abe1fc1f3..d7ebda647 100644 --- a/libempathy-gtk/empathy-chat-text-view.c +++ b/libempathy-gtk/empathy-chat-text-view.c @@ -495,7 +495,9 @@ chat_text_view_size_allocate (GtkWidget *widget, GtkAdjustment *adj; adj = GTK_TEXT_VIEW (widget)->vadjustment; - gtk_adjustment_set_value (adj, adj->upper - adj->page_size); + gtk_adjustment_set_value (adj, + gtk_adjustment_get_upper (adj) - + gtk_adjustment_get_page_size (adj)); } } @@ -652,7 +654,7 @@ chat_text_view_scroll_cb (EmpathyChatTextView *view) priv = GET_PRIV (view); adj = GTK_TEXT_VIEW (view)->vadjustment; - max_val = adj->upper - adj->page_size; + max_val = gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj); g_return_val_if_fail (priv->scroll_time != NULL, FALSE); diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 1729e5305..a8ca745e2 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -748,13 +748,14 @@ chat_input_key_press_event_cb (GtkWidget *widget, if (!(event->state & GDK_CONTROL_MASK) && event->keyval == GDK_Page_Up) { adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (text_view_sw)); - gtk_adjustment_set_value (adj, adj->value - adj->page_size); + gtk_adjustment_set_value (adj, gtk_adjustment_get_value (adj) - gtk_adjustment_get_page_size (adj)); return TRUE; } if ((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK && event->keyval == GDK_Page_Down) { adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (text_view_sw)); - val = MIN (adj->value + adj->page_size, adj->upper - adj->page_size); + val = MIN (gtk_adjustment_get_value (adj) + gtk_adjustment_get_page_size (adj), + gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj)); gtk_adjustment_set_value (adj, val); return TRUE; } @@ -1478,15 +1479,18 @@ chat_size_request (GtkWidget *widget, GtkRequisition *requisition) { GtkBin *bin = GTK_BIN (widget); + GtkWidget *child; - requisition->width = GTK_CONTAINER (widget)->border_width * 2; - requisition->height = GTK_CONTAINER (widget)->border_width * 2; + requisition->width = gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2; + requisition->height = gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2; - if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) + child = gtk_bin_get_child (bin); + + if (child && GTK_WIDGET_VISIBLE (child)) { GtkRequisition child_requisition; - gtk_widget_size_request (bin->child, &child_requisition); + gtk_widget_size_request (child, &child_requisition); requisition->width += child_requisition.width; requisition->height += child_requisition.height; @@ -1499,17 +1503,20 @@ chat_size_allocate (GtkWidget *widget, { GtkBin *bin = GTK_BIN (widget); GtkAllocation child_allocation; + GtkWidget *child; widget->allocation = *allocation; - if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) + child = gtk_bin_get_child (bin); + + if (child && GTK_WIDGET_VISIBLE (child)) { - child_allocation.x = allocation->x + GTK_CONTAINER (widget)->border_width; - child_allocation.y = allocation->y + GTK_CONTAINER (widget)->border_width; - child_allocation.width = MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0); - child_allocation.height = MAX (allocation->height - GTK_CONTAINER (widget)->border_width * 2, 0); + 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)); + child_allocation.width = MAX (allocation->width - gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2, 0); + child_allocation.height = MAX (allocation->height - gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2, 0); - gtk_widget_size_allocate (bin->child, &child_allocation); + gtk_widget_size_allocate (child, &child_allocation); } } diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c index ef100a3b7..d271cdd28 100644 --- a/libempathy-gtk/empathy-contact-dialogs.c +++ b/libempathy-gtk/empathy-contact-dialogs.c @@ -193,7 +193,7 @@ empathy_contact_information_dialog_show (EmpathyContact *contact, EMPATHY_CONTACT_WIDGET_SHOW_LOCATION | EMPATHY_CONTACT_WIDGET_EDIT_NONE); gtk_container_set_border_width (GTK_CONTAINER (contact_widget), 8); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), contact_widget, TRUE, TRUE, 0); gtk_widget_show (contact_widget); @@ -252,7 +252,7 @@ empathy_contact_edit_dialog_show (EmpathyContact *contact, EMPATHY_CONTACT_WIDGET_EDIT_ALIAS | EMPATHY_CONTACT_WIDGET_EDIT_GROUPS); gtk_container_set_border_width (GTK_CONTAINER (contact_widget), 8); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), contact_widget, TRUE, TRUE, 0); gtk_widget_show (contact_widget); @@ -304,7 +304,7 @@ empathy_contact_personal_dialog_show (GtkWindow *parent) EMPATHY_CONTACT_WIDGET_EDIT_ALIAS | EMPATHY_CONTACT_WIDGET_EDIT_AVATAR); gtk_container_set_border_width (GTK_CONTAINER (contact_widget), 8); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (personal_dialog)->vbox), + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (personal_dialog))), contact_widget, TRUE, TRUE, 0); empathy_contact_widget_set_account_filter (contact_widget, @@ -407,7 +407,7 @@ empathy_new_contact_dialog_show (GtkWindow *parent) EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT | EMPATHY_CONTACT_WIDGET_EDIT_ID | EMPATHY_CONTACT_WIDGET_EDIT_GROUPS); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), contact_widget, TRUE, TRUE, 0); empathy_contact_widget_set_account_filter (contact_widget, diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index f7b506e7c..9cebe1daa 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -292,7 +292,7 @@ contact_list_view_drag_data_received (GtkWidget *view, goto OUT; } - id = (const gchar*) selection->data; + id = (const gchar*) gtk_selection_data_get_data (selection); DEBUG ("Received %s%s drag & drop contact from roster with id:'%s'", context->action == GDK_ACTION_MOVE ? "move" : "", context->action == GDK_ACTION_COPY ? "copy" : "", @@ -851,7 +851,7 @@ contact_list_view_expander_cell_data_func (GtkTreeViewColumn *column, gboolean row_expanded; path = gtk_tree_model_get_path (model, iter); - row_expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (column->tree_view), path); + row_expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (gtk_tree_view_column_get_tree_view (column)), path); gtk_tree_path_free (path); g_object_set (cell, diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c index 7ac13ad38..802d116e7 100644 --- a/libempathy-gtk/empathy-status-preset-dialog.c +++ b/libempathy-gtk/empathy-status-preset-dialog.c @@ -559,8 +559,8 @@ empathy_status_preset_dialog_init (EmpathyStatusPresetDialog *self) status_preset_dialog_setup_presets_treeview (self); status_preset_dialog_setup_add_combobox (self); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->vbox), toplevel_vbox, - TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), + toplevel_vbox, TRUE, TRUE, 0); g_object_unref (gui); } diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index baa6d21de..e91ac6291 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -1250,7 +1250,7 @@ empathy_window_get_is_visible (GtkWindow *window) g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE); - gdk_window = GTK_WIDGET (window)->window; + gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); if (!gdk_window) { return FALSE; } @@ -1272,7 +1272,7 @@ empathy_window_iconify (GtkWindow *window, GtkStatusIcon *status_icon) GdkWindow *gdk_window; gtk_status_icon_get_geometry (status_icon, NULL, &icon_location, NULL); - gdk_window = GTK_WIDGET (window)->window; + gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); dpy = gdk_x11_drawable_get_xdisplay (gdk_window); data[0] = icon_location.x; diff --git a/libempathy-gtk/empathy-video-widget.c b/libempathy-gtk/empathy-video-widget.c index 79f27814f..0f62496de 100644 --- a/libempathy-gtk/empathy-video-widget.c +++ b/libempathy-gtk/empathy-video-widget.c @@ -403,7 +403,7 @@ empathy_video_widget_sync_message_cb (GstBus *bus, GstMessage *message, { g_assert (GTK_WIDGET_REALIZED (GTK_WIDGET (self))); gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (priv->overlay), - GDK_WINDOW_XID (GTK_WIDGET (self)->window)); + GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (self)))); } } @@ -418,13 +418,13 @@ empathy_video_widget_expose_event (GtkWidget *widget, GdkEventExpose *event) if (priv->overlay == NULL) { - gdk_window_clear_area (widget->window, 0, 0, + gdk_window_clear_area (gtk_widget_get_window (widget), 0, 0, widget->allocation.width, widget->allocation.height); return TRUE; } gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (priv->overlay), - GDK_WINDOW_XID (widget->window)); + GDK_WINDOW_XID (gtk_widget_get_window (widget))); gst_x_overlay_expose (GST_X_OVERLAY (priv->overlay)); -- cgit v1.2.3