[gnome-session] [all] Use accessor functions instead direct access
- From: Lucas Almeida Rocha <lucasr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-session] [all] Use accessor functions instead direct access
- Date: Mon, 10 Aug 2009 23:55:24 +0000 (UTC)
commit cd07d6d4276d0f3d1f400ae1577bc7d6e7d4b51c
Author: Javier Jardón <javierjc1982 gmail com>
Date: Tue Aug 11 00:51:57 2009 +0100
[all] Use accessor functions instead direct access
This is partial go on replacing all directly accessed attributes with
proper accessor functions. Partially fixes bgo#586767.
capplet/gsm-app-dialog.c | 4 +++-
capplet/gsm-properties-dialog.c | 6 ++++--
configure.in | 2 +-
gnome-session/gsm-inhibit-dialog.c | 4 +++-
gnome-session/gsm-logout-dialog.c | 5 ++++-
gnome-session/test-inhibit.c | 2 +-
splash/splash-window.c | 25 ++++++++++++++-----------
7 files changed, 30 insertions(+), 18 deletions(-)
---
diff --git a/capplet/gsm-app-dialog.c b/capplet/gsm-app-dialog.c
index 91035e0..3779be5 100644
--- a/capplet/gsm-app-dialog.c
+++ b/capplet/gsm-app-dialog.c
@@ -151,6 +151,7 @@ on_entry_activate (GtkEntry *entry,
static void
setup_dialog (GsmAppDialog *dialog)
{
+ GtkWidget *content_area;
GtkWidget *widget;
GtkBuilder *xml;
GError *error;
@@ -171,8 +172,9 @@ setup_dialog (GsmAppDialog *dialog)
}
}
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
widget = GTK_WIDGET (gtk_builder_get_object (xml, "main-table"));
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), widget);
+ gtk_container_add (GTK_CONTAINER (content_area), widget);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
diff --git a/capplet/gsm-properties-dialog.c b/capplet/gsm-properties-dialog.c
index 32465d1..84ef910 100644
--- a/capplet/gsm-properties-dialog.c
+++ b/capplet/gsm-properties-dialog.c
@@ -750,6 +750,7 @@ gsm_properties_dialog_class_init (GsmPropertiesDialogClass *klass)
static void
gsm_properties_dialog_init (GsmPropertiesDialog *dialog)
{
+ GtkWidget *content_area;
GtkWidget *widget;
GConfClient *client;
GError *error;
@@ -778,13 +779,14 @@ gsm_properties_dialog_init (GsmPropertiesDialog *dialog)
}
}
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
"main-notebook"));
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), widget);
+ gtk_container_add (GTK_CONTAINER (content_area), widget);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_icon_name (GTK_WINDOW (dialog), "session-properties");
gtk_window_set_title (GTK_WINDOW (dialog), _("Startup Applications Preferences"));
diff --git a/configure.in b/configure.in
index 3954ce5..1dcde89 100644
--- a/configure.in
+++ b/configure.in
@@ -47,7 +47,7 @@ fi
GLIB_REQUIRED=2.16.0
LIBGNOMEUI_REQUIRED=2.2.0
-GTK_REQUIRED=2.12.0
+GTK_REQUIRED=2.14.0
DBUS_GLIB_REQUIRED=0.76
POLKIT_GNOME_REQUIRED=0.7
DEVKIT_POWER_REQUIRED=008
diff --git a/gnome-session/gsm-inhibit-dialog.c b/gnome-session/gsm-inhibit-dialog.c
index e48f898..da59ab0 100644
--- a/gnome-session/gsm-inhibit-dialog.c
+++ b/gnome-session/gsm-inhibit-dialog.c
@@ -1088,6 +1088,7 @@ gsm_inhibit_dialog_class_init (GsmInhibitDialogClass *klass)
static void
gsm_inhibit_dialog_init (GsmInhibitDialog *dialog)
{
+ GtkWidget *content_area;
GtkWidget *widget;
GError *error;
@@ -1109,9 +1110,10 @@ gsm_inhibit_dialog_init (GsmInhibitDialog *dialog)
}
}
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
"main-box"));
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), widget);
+ gtk_container_add (GTK_CONTAINER (content_area), widget);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
diff --git a/gnome-session/gsm-logout-dialog.c b/gnome-session/gsm-logout-dialog.c
index 2de3f12..de4d22a 100644
--- a/gnome-session/gsm-logout-dialog.c
+++ b/gnome-session/gsm-logout-dialog.c
@@ -355,6 +355,7 @@ gsm_get_dialog (GsmDialogLogoutType type,
guint32 activate_time)
{
GsmLogoutDialog *logout_dialog;
+ GtkWidget *dialog_image;
const char *primary_text;
const char *icon_name;
@@ -433,7 +434,9 @@ gsm_get_dialog (GsmDialogLogoutType type,
g_assert_not_reached ();
}
- gtk_image_set_from_icon_name (GTK_IMAGE (GTK_MESSAGE_DIALOG (logout_dialog)->image),
+ dialog_image = gtk_message_dialog_get_image (GTK_MESSAGE_DIALOG (logout_dialog));
+
+ gtk_image_set_from_icon_name (GTK_IMAGE (dialog_image),
icon_name, GTK_ICON_SIZE_DIALOG);
gtk_window_set_icon_name (GTK_WINDOW (logout_dialog), icon_name);
gtk_window_set_position (GTK_WINDOW (logout_dialog), GTK_WIN_POS_CENTER_ALWAYS);
diff --git a/gnome-session/test-inhibit.c b/gnome-session/test-inhibit.c
index 680bc3d..68cc0a7 100644
--- a/gnome-session/test-inhibit.c
+++ b/gnome-session/test-inhibit.c
@@ -154,7 +154,7 @@ on_widget_show (GtkWidget *dialog,
{
gboolean res;
- res = do_inhibit_for_window (dialog->window);
+ res = do_inhibit_for_window (gtk_widget_get_window (dialog));
if (! res) {
g_warning ("Unable to register client with session manager");
}
diff --git a/splash/splash-window.c b/splash/splash-window.c
index 493dac1..0f0e194 100644
--- a/splash/splash-window.c
+++ b/splash/splash-window.c
@@ -130,6 +130,7 @@ splash_window_expose_event (GtkWidget *widget,
{
GList *l;
GdkRectangle exposed;
+ GtkStyle *style = gtk_widget_get_style (widget);
GsmSplashWindow *splash = GSM_SPLASH_WINDOW (widget);
if (!GTK_WIDGET_DRAWABLE (widget)) {
@@ -143,8 +144,8 @@ splash_window_expose_event (GtkWidget *widget,
&si->position,
&exposed)) {
gdk_draw_pixbuf (
- widget->window,
- widget->style->black_gc,
+ gtk_widget_get_window (widget),
+ style->black_gc,
si->scaled,
exposed.x - si->position.x,
exposed.y - si->position.y,
@@ -159,14 +160,14 @@ splash_window_expose_event (GtkWidget *widget,
calc_text_box (splash);
if (gdk_rectangle_intersect (&event->area, &splash->text_box, &exposed)) {
/* drop shadow */
- gdk_draw_layout (widget->window,
- widget->style->black_gc,
+ gdk_draw_layout (gtk_widget_get_window (widget),
+ style->black_gc,
splash->text_box.x + 1, splash->text_box.y + 1,
splash->layout);
/* text */
- gdk_draw_layout (widget->window,
- widget->style->white_gc,
+ gdk_draw_layout (gtk_widget_get_window (widget),
+ style->white_gc,
splash->text_box.x, splash->text_box.y,
splash->layout);
}
@@ -182,13 +183,13 @@ splash_window_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (gsm_splash_window_parent_class)->realize (widget);
- if (splash->background && widget->window) {
+ if (splash->background && gtk_widget_get_window (widget)) {
GdkPixmap *pixmap = NULL;
GdkBitmap *mask = NULL;
GdkColormap *colormap;
colormap = gtk_widget_get_colormap (widget);
- pixmap = gdk_pixmap_new (widget->window,
+ pixmap = gdk_pixmap_new (gtk_widget_get_window (widget),
gdk_pixbuf_get_width (splash->background),
gdk_pixbuf_get_height (splash->background),
-1);
@@ -201,7 +202,7 @@ splash_window_realize (GtkWidget *widget)
0, 0, 0, 0, -1, -1,
GDK_RGB_DITHER_MAX, 0, 0);
- style = gtk_style_copy (widget->style);
+ style = gtk_widget_get_style (widget);
style->bg_pixmap[GTK_STATE_NORMAL] = pixmap;
gtk_widget_set_style (widget, style);
@@ -214,11 +215,13 @@ splash_window_realize (GtkWidget *widget)
125);
if (mask) {
- gdk_window_shape_combine_mask (widget->window, mask, 0, 0);
+ gdk_window_shape_combine_mask (gtk_widget_get_window (widget),
+ mask, 0, 0);
g_object_unref (mask);
}
- gtk_style_set_background (widget->style, widget->window,
+ gtk_style_set_background (gtk_widget_get_style (widget),
+ gtk_widget_get_window (widget),
GTK_STATE_NORMAL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]