[gtk+] Replace gtk_misc_set_padding() with GtkWidget:margin properties
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Replace gtk_misc_set_padding() with GtkWidget:margin properties
- Date: Thu, 2 Jun 2011 16:50:51 +0000 (UTC)
commit 32ef28bc8592e0983c5b31ae64a30847164b981e
Author: Javier Jardón <jjardon gnome org>
Date: Thu Jun 2 13:37:43 2011 +0200
Replace gtk_misc_set_padding() with GtkWidget:margin properties
https://bugzilla.gnome.org/show_bug.cgi?id=651605
demos/gtk-demo/changedisplay.c | 2 +-
gtk/gtkprintbackend.c | 3 +--
gtk/gtkstatusicon.c | 10 ++++++++--
modules/input/gtkimcontextxim.c | 2 +-
tests/testfilechooser.c | 4 ++--
tests/testgtk.c | 18 ++++++++++++------
6 files changed, 25 insertions(+), 14 deletions(-)
---
diff --git a/demos/gtk-demo/changedisplay.c b/demos/gtk-demo/changedisplay.c
index 951d373..36b7af2 100644
--- a/demos/gtk-demo/changedisplay.c
+++ b/demos/gtk-demo/changedisplay.c
@@ -125,7 +125,7 @@ query_for_toplevel (GdkScreen *screen,
gtk_container_add (GTK_CONTAINER (popup), frame);
label = gtk_label_new (prompt);
- gtk_misc_set_padding (GTK_MISC (label), 10, 10);
+ g_object_set (label, "margin", 10, NULL);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_show_all (popup);
diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c
index f8858c1..2980928 100644
--- a/gtk/gtkprintbackend.c
+++ b/gtk/gtkprintbackend.c
@@ -758,8 +758,7 @@ request_password (GtkPrintBackend *backend,
/* Left */
icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0.0);
- gtk_misc_set_padding (GTK_MISC (icon), 6, 6);
-
+ g_object_set (icon, "margin", 6, NULL);
/* Right */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c
index 0501117..aa37454 100644
--- a/gtk/gtkstatusicon.c
+++ b/gtk/gtkstatusicon.c
@@ -1679,9 +1679,15 @@ gtk_status_icon_padding_changed (GtkStatusIcon *status_icon)
padding = _gtk_tray_icon_get_padding (GTK_TRAY_ICON (priv->tray_icon));
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_misc_set_padding (GTK_MISC (priv->image), padding, 0);
+ {
+ gtk_widget_set_margin_left (priv->image, padding);
+ gtk_widget_set_margin_right (priv->image, padding);
+ }
else
- gtk_misc_set_padding (GTK_MISC (priv->image), 0, padding);
+ {
+ gtk_widget_set_margin_bottom (priv->image, padding);
+ gtk_widget_set_margin_top (priv->image, padding);
+ }
}
static void
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c
index a6adf9f..84f2379 100644
--- a/modules/input/gtkimcontextxim.c
+++ b/modules/input/gtkimcontextxim.c
@@ -1793,7 +1793,7 @@ status_window_make_window (StatusWindow *status_window)
gtk_widget_set_app_paintable (window, TRUE);
status_label = gtk_label_new ("");
- gtk_misc_set_padding (GTK_MISC (status_label), 1, 1);
+ g_object_set (status_label, "margin", 1, NULL);
gtk_widget_show (status_label);
gtk_container_add (GTK_CONTAINER (window), status_label);
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index b64c381..aec9a32 100644
--- a/tests/testfilechooser.c
+++ b/tests/testfilechooser.c
@@ -604,11 +604,11 @@ main (int argc, char **argv)
preview_label = gtk_label_new (NULL);
gtk_box_pack_start (GTK_BOX (preview_vbox), preview_label, TRUE, TRUE, 0);
- gtk_misc_set_padding (GTK_MISC (preview_label), 6, 6);
+ g_object_set (preview_label, "margin", 6, NULL);
preview_image = gtk_image_new ();
gtk_box_pack_start (GTK_BOX (preview_vbox), preview_image, TRUE, TRUE, 0);
- gtk_misc_set_padding (GTK_MISC (preview_image), 6, 6);
+ g_object_set (preview_image, "margin", 6, NULL);
update_preview_cb (GTK_FILE_CHOOSER (dialog));
g_signal_connect (dialog, "update-preview",
diff --git a/tests/testgtk.c b/tests/testgtk.c
index d5c7427..6aa7696 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -5499,7 +5499,7 @@ label_toggle (GtkWidget *widget,
"destroy",
G_CALLBACK (gtk_widget_destroyed),
label);
- gtk_misc_set_padding (GTK_MISC (*label), 10, 10);
+ g_object_set (*label, "margin", 10, NULL);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog_window))),
*label, TRUE, TRUE, 0);
gtk_widget_show (*label);
@@ -6121,7 +6121,10 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
g_object_set_data (G_OBJECT (child), "tab_pixmap", pixwid);
gtk_box_pack_start (GTK_BOX (label_box), pixwid, FALSE, TRUE, 0);
- gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
+ gtk_widget_set_margin_left (pixwid, 3);
+ gtk_widget_set_margin_right (pixwid, 3);
+ gtk_widget_set_margin_bottom (pixwid, 1);
+ gtk_widget_set_margin_top (pixwid, 1);
label = gtk_label_new_with_mnemonic (accel_buffer);
gtk_box_pack_start (GTK_BOX (label_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (label_box);
@@ -6132,7 +6135,10 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
g_object_set_data (G_OBJECT (child), "menu_pixmap", pixwid);
gtk_box_pack_start (GTK_BOX (menu_box), pixwid, FALSE, TRUE, 0);
- gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
+ gtk_widget_set_margin_left (pixwid, 3);
+ gtk_widget_set_margin_right (pixwid, 3);
+ gtk_widget_set_margin_bottom (pixwid, 1);
+ gtk_widget_set_margin_top (pixwid, 1);
label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (menu_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (menu_box);
@@ -9348,7 +9354,7 @@ create_timeout_test (GtkWidget *widget)
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
label = gtk_label_new ("count: 0");
- gtk_misc_set_padding (GTK_MISC (label), 10, 10);
+ g_object_set (label, "margin", 10, NULL);
gtk_box_pack_start (GTK_BOX (content_area), label, TRUE, TRUE, 0);
gtk_widget_show (label);
@@ -9470,7 +9476,7 @@ create_idle_test (GtkWidget *widget)
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
label = gtk_label_new ("count: 0");
- gtk_misc_set_padding (GTK_MISC (label), 10, 10);
+ g_object_set (label, "margin", 10, NULL);
gtk_widget_show (label);
container =
@@ -9667,7 +9673,7 @@ create_mainloop (GtkWidget *widget)
action_area = gtk_dialog_get_action_area (GTK_DIALOG (window));
label = gtk_label_new ("In recursive main loop...");
- gtk_misc_set_padding (GTK_MISC(label), 20, 20);
+ g_object_set (label, "margin", 20, NULL);
gtk_box_pack_start (GTK_BOX (content_area), label, TRUE, TRUE, 0);
gtk_widget_show (label);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]