Commit 1b3135ca authored by Michael Natterer's avatar Michael Natterer 😴

Get rid of using GtkMisc API globally

parent 80985692
......@@ -160,7 +160,12 @@ prefs_check_button_add_with_icon (GObject *config,
gtk_widget_show (hbox);
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
gtk_misc_set_padding (GTK_MISC (image), 2, 2);
g_object_set (image,
"margin-start", 2,
"margin-end", 2,
"margin-top", 2,
"margin-bottom", 2,
NULL);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
......
......@@ -2631,7 +2631,10 @@ prefs_dialog_new (Gimp *gimp,
calibrate_button = gtk_button_new_with_mnemonic (_("C_alibrate..."));
label = gtk_bin_get_child (GTK_BIN (calibrate_button));
gtk_misc_set_padding (GTK_MISC (label), 4, 0);
g_object_set (label,
"margin-start", 4,
"margin-end", 4,
NULL);
gtk_box_pack_start (GTK_BOX (hbox), calibrate_button, FALSE, FALSE, 0);
gtk_widget_show (calibrate_button);
gtk_widget_set_sensitive (calibrate_button,
......
......@@ -171,7 +171,7 @@ tips_dialog_create (Gimp *gimp)
image = gtk_image_new_from_icon_name (GIMP_ICON_DIALOG_INFORMATION,
GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
gtk_widget_set_valign (image, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
......
......@@ -521,7 +521,10 @@ gimp_prop_gui_new (GObject *config,
gimp_label_set_attributes (GTK_LABEL (gui),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_misc_set_padding (GTK_MISC (gui), 0, 4);
g_object_set (gui,
"margin-top", 4,
"margin-bottom", 4,
NULL);
}
return gui;
......
......@@ -1628,7 +1628,12 @@ gimp_filter_tool_add_color_picker (GimpFilterTool *filter_tool,
NULL);
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
gtk_misc_set_padding (GTK_MISC (image), 2, 2);
g_object_set (image,
"margin-start", 2,
"margin-end", 2,
"margin-top", 2,
"margin-bottom", 2,
NULL);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
......
......@@ -487,7 +487,10 @@ gimp_gegl_tool_dialog (GimpFilterTool *filter_tool)
gimp_label_set_attributes (GTK_LABEL (options_gui),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_misc_set_padding (GTK_MISC (options_gui), 0, 4);
g_object_set (options_gui,
"margin-top", 4,
"margin-bottom", 4,
NULL);
gtk_container_add (GTK_CONTAINER (options_box), options_gui);
g_object_unref (options_box);
g_weak_ref_set (&o_tool->options_gui_ref, options_gui);
......
......@@ -99,7 +99,7 @@ gimp_critical_dialog_init (GimpCriticalDialog *dialog)
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
vbox = gtk_vbox_new (FALSE, 6);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
vbox, TRUE, TRUE, 0);
......@@ -107,7 +107,7 @@ gimp_critical_dialog_init (GimpCriticalDialog *dialog)
/* The error label. */
dialog->top_label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (dialog->top_label), 0.0, 0.5);
gtk_widget_set_halign (dialog->top_label, GTK_ALIGN_START);
gtk_label_set_ellipsize (GTK_LABEL (dialog->top_label), PANGO_ELLIPSIZE_END);
gtk_label_set_selectable (GTK_LABEL (dialog->top_label), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), dialog->top_label,
......@@ -144,7 +144,7 @@ gimp_critical_dialog_init (GimpCriticalDialog *dialog)
dialog->bottom_label = gtk_label_new (text);
g_free (text);
gtk_misc_set_alignment (GTK_MISC (dialog->bottom_label), 0.0, 0.5);
gtk_widget_set_halign (dialog->bottom_label, GTK_ALIGN_START);
gtk_label_set_selectable (GTK_LABEL (dialog->bottom_label), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), dialog->bottom_label,
FALSE, FALSE, 0);
......@@ -153,7 +153,7 @@ gimp_critical_dialog_init (GimpCriticalDialog *dialog)
widget = gtk_label_new (_("You can also close the dialog directly but "
"reporting bugs is the best way to make your "
"software awesome."));
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
gtk_widget_set_halign (widget, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
attrs = pango_attr_list_new ();
......
......@@ -167,12 +167,11 @@ gimp_message_box_constructed (GObject *object)
if (box->icon_name)
{
gtk_widget_push_composite_child ();
box->image = gtk_image_new_from_icon_name (box->icon_name,
GTK_ICON_SIZE_DIALOG);
gtk_widget_pop_composite_child ();
gtk_misc_set_alignment (GTK_MISC (box->image), 0.0, 0.0);
gtk_widget_set_halign (box->image, GTK_ALIGN_START);
gtk_widget_set_valign (box->image, GTK_ALIGN_START);
gtk_widget_set_parent (box->image, GTK_WIDGET (box));
gtk_widget_show (box->image);
}
......
......@@ -142,8 +142,12 @@ gimp_paned_box_init (GimpPanedBox *paned_box)
* doesn't contribute to the minimum height of the toolbox.
*/
paned_box->p->instructions = gtk_label_new (INSTRUCTIONS_TEXT);
gtk_misc_set_padding (GTK_MISC (paned_box->p->instructions),
INSTRUCTIONS_TEXT_PADDING, INSTRUCTIONS_TEXT_PADDING);
g_object_set (paned_box->p->instructions,
"margin-start", INSTRUCTIONS_TEXT_PADDING,
"margin-end", INSTRUCTIONS_TEXT_PADDING,
"margin-top", INSTRUCTIONS_TEXT_PADDING,
"margin-bottom", INSTRUCTIONS_TEXT_PADDING,
NULL);
gtk_label_set_line_wrap (GTK_LABEL (paned_box->p->instructions), TRUE);
gtk_label_set_justify (GTK_LABEL (paned_box->p->instructions),
GTK_JUSTIFY_CENTER);
......
......@@ -684,7 +684,7 @@ gimp_viewable_box_new (GimpContainer *container,
image = gtk_image_new_from_icon_name (GIMP_ICON_EDIT,
GTK_ICON_SIZE_BUTTON);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 1.0);
gtk_widget_set_valign (image, GTK_ALIGN_END);
gtk_container_add (GTK_CONTAINER (edit_button), image);
gtk_widget_show (image);
......
......@@ -118,7 +118,7 @@ gimp_viewable_dialog_init (GimpViewableDialog *dialog)
gtk_widget_show (hbox);
dialog->icon = gtk_image_new ();
gtk_misc_set_alignment (GTK_MISC (dialog->icon), 0.5, 0.0);
gtk_widget_set_valign (dialog->icon, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), dialog->icon, FALSE, FALSE, 0);
gtk_widget_show (dialog->icon);
......
......@@ -226,7 +226,7 @@ gimp_table_attach_icon (GtkTable *table,
g_return_if_fail (GTK_IS_WIDGET (widget));
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
gtk_misc_set_alignment (GTK_MISC (image), 1.0, 0.5);
gtk_widget_set_halign (image, GTK_ALIGN_END);
gtk_table_attach (table, image, 0, 1, row, row + 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (image);
......
......@@ -465,7 +465,7 @@ confirm_save_dialog (const gchar *message,
image = gtk_image_new_from_icon_name ("dialog-warning",
GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
gtk_widget_set_valign (image, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
......@@ -548,7 +548,7 @@ export_dialog (GSList *actions,
image = gtk_image_new_from_icon_name ("dialog-information",
GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
gtk_widget_set_valign (image, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
......
......@@ -271,7 +271,7 @@ gimp_enum_radio_frame_new_with_range (GType enum_type,
* icon name for each icon is created by appending the enum_value's
* nick to the given @icon_prefix.
*
* Return value: a new #GtkHBox holding a group of #GtkRadioButtons.
* Return value: a new horizontal #GtkBox holding a group of #GtkRadioButtons.
*
* Since: 2.10
**/
......@@ -318,7 +318,7 @@ gimp_enum_icon_box_new (GType enum_type,
* of radio buttons, but additionally it supports limiting the range
* of available enum values.
*
* Return value: a new #GtkHBox holding a group of #GtkRadioButtons.
* Return value: a new horizontal #GtkBox holding a group of #GtkRadioButtons.
*
* Since: 2.10
**/
......@@ -423,19 +423,22 @@ gimp_enum_icon_box_set_child_padding (GtkWidget *icon_box,
for (list = children; list; list = g_list_next (list))
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (list->data));
if (GTK_IS_MISC (child))
{
GtkMisc *misc = GTK_MISC (child);
gint misc_xpad;
gint misc_ypad;
gtk_misc_get_padding (misc, &misc_xpad, &misc_ypad);
gtk_misc_set_padding (misc,
xpad < 0 ? misc_xpad : xpad,
ypad < 0 ? misc_ypad : ypad);
}
gint start, end;
gint top, bottom;
g_object_get (child,
"margin-start", &start,
"margin-end", &end,
"margin-top", &top,
"margin-bottom", &bottom,
NULL);
g_object_set (child,
"margin-start", xpad < 0 ? start : xpad,
"margin-end", xpad < 0 ? end : xpad,
"margin-top", ypad < 0 ? top : ypad,
"margin-bottom", ypad < 0 ? bottom : ypad,
NULL);
}
g_list_free (children);
......
......@@ -190,7 +190,7 @@ create_query_box (const gchar *title,
gtk_widget_show (hbox);
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
gtk_widget_set_valign (image, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
}
......
......@@ -519,7 +519,10 @@ gimp_random_seed_new (guint *seed,
"given \"random\" operation"), NULL);
button = gtk_button_new_with_mnemonic (_("_New Seed"));
gtk_misc_set_padding (GTK_MISC (gtk_bin_get_child (GTK_BIN (button))), 2, 0);
g_object_set (gtk_bin_get_child (GTK_BIN (button)),
"margin-start", 2,
"margin-end", 2,
NULL);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
......
......@@ -1426,7 +1426,7 @@ offsets_dialog (gint offset_x,
image = gtk_image_new_from_icon_name (GIMP_ICON_DIALOG_QUESTION,
GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
gtk_widget_set_valign (image, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
......
......@@ -733,8 +733,10 @@ edit_callback (GtkWidget *widget,
gtk_widget_show (hbox);
button = gtk_button_new_with_mnemonic( _("_Randomize"));
gtk_misc_set_padding (GTK_MISC (gtk_bin_get_child (GTK_BIN (button))),
2, 0);
g_object_set (gtk_bin_get_child (GTK_BIN (button)),
"margin-start", 2,
"margin-end", 2,
NULL);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
......
......@@ -1384,7 +1384,10 @@ main_dialog (GimpDrawable *drawable)
gtk_widget_show (hbox);
button = gtk_button_new_with_mnemonic (_("_Preview!"));
gtk_misc_set_padding (GTK_MISC (gtk_bin_get_child (GTK_BIN (button))), 2, 0);
g_object_set (gtk_bin_get_child (GTK_BIN (button)),
"margin-start", 2,
"margin-end", 2,
NULL);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
......
......@@ -700,7 +700,7 @@ shoot_dialog (GdkScreen **screen)
label = gtk_label_new (_("seconds"));
gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_SHRINK, 1.0, 0);
gtk_misc_set_alignment (GTK_MISC (label), 0.1, 0.5);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_show (label);
/* Selection delay hints */
......@@ -763,7 +763,7 @@ shoot_dialog (GdkScreen **screen)
label = gtk_label_new (_("seconds"));
gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_SHRINK, 1.0, 0);
gtk_misc_set_alignment (GTK_MISC (label), 0.1, 0.5);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_show (label);
/* Screenshot delay hints */
......
......@@ -230,7 +230,10 @@ script_fu_console_interface (void)
&console);
button = gtk_button_new_with_mnemonic (_("_Browse..."));
gtk_misc_set_padding (GTK_MISC (gtk_bin_get_child (GTK_BIN (button))), 2, 0);
g_object_set (gtk_bin_get_child (GTK_BIN (button)),
"margin-start", 2,
"margin-end", 2,
NULL);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
gtk_widget_show (button);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment