[nautilus/wip/gbsneto/code-cleanup] project: kill GtkMisc throughout the code



commit 682ecbd92d3d9bd6c4cd9eecd62eaadd62c1dd34
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jun 17 02:17:18 2015 -0300

    project: kill GtkMisc throughout the code

 eel/eel-gtk-extensions.c                           |    3 +-
 .../nautilus-file-conflict-dialog.c                |   16 +++------
 .../nautilus-mime-application-chooser.c            |    2 +-
 src/nautilus-autorun-software.c                    |    4 +--
 src/nautilus-connect-server-dialog.c               |    6 ++--
 src/nautilus-desktop-item-properties.c             |    2 +-
 src/nautilus-image-properties-page.c               |    6 ++-
 src/nautilus-list-view.c                           |   15 +++-----
 src/nautilus-notebook.c                            |    1 -
 src/nautilus-properties-window.c                   |   34 ++++++-------------
 10 files changed, 34 insertions(+), 55 deletions(-)
---
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c
index 38d7c00..5a29f1f 100644
--- a/eel/eel-gtk-extensions.c
+++ b/eel/eel-gtk-extensions.c
@@ -329,7 +329,8 @@ eel_gtk_message_dialog_set_details_label (GtkMessageDialog *dialog,
        label = gtk_label_new (details_text);
        gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
        gtk_label_set_selectable (GTK_LABEL (label), TRUE);
-       gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+       gtk_label_set_yalign (GTK_LABEL (label), 0.0);
 
        gtk_container_add (GTK_CONTAINER (expander), label);
        gtk_box_pack_start (GTK_BOX (content_area), expander, FALSE, FALSE, 0);
diff --git a/libnautilus-private/nautilus-file-conflict-dialog.c 
b/libnautilus-private/nautilus-file-conflict-dialog.c
index 4ff762c..e48ec54 100644
--- a/libnautilus-private/nautilus-file-conflict-dialog.c
+++ b/libnautilus-private/nautilus-file-conflict-dialog.c
@@ -194,7 +194,8 @@ file_list_ready_cb (GList *files,
        label = gtk_label_new (primary_text);
        gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
        gtk_label_set_line_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD_CHAR);
-       gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+       gtk_label_set_yalign (GTK_LABEL (label), 0.5);
        gtk_box_pack_start (GTK_BOX (details->titles_vbox),
                            label, FALSE, FALSE, 0);
        gtk_widget_show (label);
@@ -210,7 +211,8 @@ file_list_ready_cb (GList *files,
 
        label = gtk_label_new (secondary_text);
        gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-       gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+       gtk_label_set_yalign (GTK_LABEL (label), 0.5);
        gtk_box_pack_start (GTK_BOX (details->titles_vbox),
                            label, FALSE, FALSE, 0);
        gtk_widget_show (label);
@@ -459,7 +461,7 @@ reset_button_clicked_cb (GtkButton *w,
 static void
 nautilus_file_conflict_dialog_init (NautilusFileConflictDialog *fcd)
 {
-       GtkWidget *hbox, *vbox, *vbox2, *alignment;
+       GtkWidget *hbox, *vbox, *vbox2;
        GtkWidget *widget, *dialog_area;
        NautilusFileConflictDialogDetails *details;
        GtkDialog *dialog;
@@ -477,7 +479,6 @@ nautilus_file_conflict_dialog_init (NautilusFileConflictDialog *fcd)
        widget = gtk_image_new_from_icon_name ("dialog-warning",
                                               GTK_ICON_SIZE_DIALOG);
        gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
-       gtk_misc_set_alignment (GTK_MISC (widget), 0.5, 0.0);
 
        /* Setup the vbox containing the dialog body */
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
@@ -489,11 +490,7 @@ nautilus_file_conflict_dialog_init (NautilusFileConflictDialog *fcd)
        details->titles_vbox = widget;
 
        /* Setup the hboxes to pack file infos into */
-       alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
-       g_object_set (alignment, "left-padding", 12, NULL);
        vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-       gtk_container_add (GTK_CONTAINER (alignment), vbox2);
-       gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
 
        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
        gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
@@ -526,9 +523,6 @@ nautilus_file_conflict_dialog_init (NautilusFileConflictDialog *fcd)
        g_signal_connect (widget, "clicked",
                          G_CALLBACK (reset_button_clicked_cb), dialog);
 
-       gtk_widget_show_all (alignment);
-
-
        /* Setup the checkbox to apply the action to all files */
        widget = gtk_check_button_new_with_mnemonic (_("Apply this action to all files"));
        gtk_box_pack_start (GTK_BOX (vbox),
diff --git a/libnautilus-private/nautilus-mime-application-chooser.c 
b/libnautilus-private/nautilus-mime-application-chooser.c
index 9d15946..c598bc5 100644
--- a/libnautilus-private/nautilus-mime-application-chooser.c
+++ b/libnautilus-private/nautilus-mime-application-chooser.c
@@ -287,7 +287,7 @@ nautilus_mime_application_chooser_build_ui (NautilusMimeApplicationChooser *choo
        gtk_box_set_homogeneous (GTK_BOX (chooser), FALSE);
 
        chooser->details->label = gtk_label_new ("");
-       gtk_misc_set_alignment (GTK_MISC (chooser->details->label), 0.0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (chooser->details->label), 0.0);
        gtk_label_set_line_wrap (GTK_LABEL (chooser->details->label), TRUE);
        gtk_label_set_line_wrap_mode (GTK_LABEL (chooser->details->label),
                                      PANGO_WRAP_WORD_CHAR);
diff --git a/src/nautilus-autorun-software.c b/src/nautilus-autorun-software.c
index 3a1eb0a..f4e0dd9 100644
--- a/src/nautilus-autorun-software.c
+++ b/src/nautilus-autorun-software.c
@@ -221,9 +221,7 @@ present_autorun_for_software_dialog (GMount *mount)
                                               gtk_widget_get_scale_factor (GTK_WIDGET (dialog)));
        pixbuf = nautilus_icon_info_get_pixbuf_at_size (icon_info, icon_size);
        image = gtk_image_new_from_pixbuf (pixbuf);
-       gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
-
-       gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), image);
+       gtk_widget_set_valign (image, GTK_ALIGN_START);
 
        gtk_window_set_icon (GTK_WINDOW (dialog), pixbuf);
 
diff --git a/src/nautilus-connect-server-dialog.c b/src/nautilus-connect-server-dialog.c
index 383d2b3..2bb33a7 100644
--- a/src/nautilus-connect-server-dialog.c
+++ b/src/nautilus-connect-server-dialog.c
@@ -562,7 +562,7 @@ nautilus_connect_server_dialog_init (NautilusConnectServerDialog *dialog)
 
        label = gtk_label_new_with_mnemonic (_("_Server Address"));
        boldify_label (GTK_LABEL (label));
-       gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (label), 0.0);
        gtk_grid_attach (GTK_GRID (grid), label, 0, row++, 1, 1);
        gtk_widget_show (label);
 
@@ -576,7 +576,7 @@ nautilus_connect_server_dialog_init (NautilusConnectServerDialog *dialog)
        gtk_widget_show (dialog->details->uri_entry);
 
        label = gtk_label_new (NULL);
-       gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (label), 0.0);
        gtk_grid_attach (GTK_GRID (grid), label, 0, row++, 1, 1);
        gtk_widget_show (label);
        dialog->details->error_label = label;
@@ -586,7 +586,7 @@ nautilus_connect_server_dialog_init (NautilusConnectServerDialog *dialog)
 
        label = gtk_label_new_with_mnemonic (_("_Recent Servers"));
        boldify_label (GTK_LABEL (label));
-       gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (label), 0.0);
        gtk_grid_attach (GTK_GRID (grid), label, 0, row++, 1, 1);
        gtk_widget_show (label);
 
diff --git a/src/nautilus-desktop-item-properties.c b/src/nautilus-desktop-item-properties.c
index e073e8b..30c9b52 100644
--- a/src/nautilus-desktop-item-properties.c
+++ b/src/nautilus-desktop-item-properties.c
@@ -320,7 +320,7 @@ build_grid (GtkWidget *container,
                label = gtk_label_new (label_text);
                gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
                g_free (label_text);
-               gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+               gtk_label_set_xalign (GTK_LABEL (label), 0.0);
                gtk_size_group_add_widget (label_size_group, label);
 
                entry = gtk_entry_new ();
diff --git a/src/nautilus-image-properties-page.c b/src/nautilus-image-properties-page.c
index fb5a34c..2231a54 100644
--- a/src/nautilus-image-properties-page.c
+++ b/src/nautilus-image-properties-page.c
@@ -139,14 +139,16 @@ append_item (NautilusImagePropertiesPage *page,
        pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
        gtk_label_set_attributes (GTK_LABEL (name_label), attrs);
        pango_attr_list_unref (attrs);
-       gtk_misc_set_alignment (GTK_MISC (name_label), 0, 0);
+       gtk_label_set_xalign (GTK_LABEL (name_label), 0.0);
+       gtk_label_set_yalign (GTK_LABEL (name_label), 0.0);
        gtk_container_add (GTK_CONTAINER (page->details->grid), name_label);
        gtk_widget_show (name_label);
 
        if (value != NULL) {
                label = gtk_label_new (value);
                gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-               gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+               gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+               gtk_label_set_yalign (GTK_LABEL (label), 0.0);
                gtk_grid_attach_next_to (GTK_GRID (page->details->grid), label,
                                         name_label, GTK_POS_RIGHT,
                                         1, 1);
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 1b4b36d..82163f9 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -2795,7 +2795,6 @@ create_column_editor (NautilusListView *view)
        GtkWidget *label;
        GtkWidget *box;
        GtkWidget *column_chooser;
-       GtkWidget *alignment;
        NautilusFile *file;
        char *str;
        char *name;
@@ -2817,6 +2816,7 @@ create_column_editor (NautilusListView *view)
        gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);
 
        box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+       gtk_widget_set_margin_start (box, 12);
        gtk_container_set_border_width (GTK_CONTAINER (box), 12);
        gtk_widget_set_hexpand (box, TRUE);
        gtk_widget_show (box);
@@ -2828,21 +2828,18 @@ create_column_editor (NautilusListView *view)
        label = gtk_label_new (NULL);
        gtk_label_set_markup (GTK_LABEL (label), str);
        gtk_label_set_line_wrap (GTK_LABEL (label), FALSE);
-       gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+       gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+       gtk_label_set_yalign (GTK_LABEL (label), 0.0);
        gtk_widget_show (label);
        gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
 
        g_free (str);
 
-       alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
-       gtk_alignment_set_padding (GTK_ALIGNMENT (alignment),
-                                  0, 0, 12, 0);
-       gtk_widget_show (alignment);
-       gtk_box_pack_start (GTK_BOX (box), alignment, TRUE, TRUE, 0);
-
        column_chooser = nautilus_column_chooser_new (file);
+       gtk_widget_set_halign (column_chooser, GTK_ALIGN_CENTER);
+       gtk_widget_set_valign (column_chooser, GTK_ALIGN_CENTER);
        gtk_widget_show (column_chooser);
-       gtk_container_add (GTK_CONTAINER (alignment), column_chooser);
+       gtk_box_pack_start (GTK_BOX (box), column_chooser, TRUE, TRUE, 0);
 
        g_signal_connect (column_chooser, "changed",
                          G_CALLBACK (column_chooser_changed_callback),
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c
index efd8181..18691a8 100644
--- a/src/nautilus-notebook.c
+++ b/src/nautilus-notebook.c
@@ -304,7 +304,6 @@ build_tab_label (NautilusNotebook *nb, NautilusWindowSlot *slot)
        label = gtk_label_new (NULL);
        gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
        gtk_label_set_single_line_mode (GTK_LABEL (label), TRUE);
-       gtk_misc_set_padding (GTK_MISC (label), 0, 0);
        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
        gtk_widget_show (label);
 
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 4ad4d8b..9142c48 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -1263,7 +1263,7 @@ attach_label (GtkGrid *grid,
                gtk_label_set_selectable (GTK_LABEL (label_field), TRUE);
        }
 
-       gtk_misc_set_alignment (GTK_MISC (label_field), 0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (label_field), 0.0);
        gtk_widget_show (label_field);
 
        if (ellipsize_text) {
@@ -1696,7 +1696,6 @@ attach_combo_box (GtkGrid *grid,
                  gboolean three_columns)
 {
        GtkWidget *combo_box;
-       GtkWidget *aligner;
 
        if (!three_columns) {
                combo_box = gtk_combo_box_text_new ();
@@ -1714,6 +1713,7 @@ attach_combo_box (GtkGrid *grid,
                                               "text", 0);
                
        }
+       gtk_widget_set_halign (combo_box, GTK_ALIGN_START);
        gtk_widget_show (combo_box);
 
        gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo_box),
@@ -1721,18 +1721,11 @@ attach_combo_box (GtkGrid *grid,
                                              NULL,
                                              NULL);
 
-       /* Put combo box in alignment to make it left-justified
-        * but minimally sized.
-        */
-       aligner = gtk_alignment_new (0, 0.5, 0, 0);
-       gtk_widget_show (aligner);
-
-       gtk_container_add (GTK_CONTAINER (aligner), combo_box);
-       gtk_grid_attach_next_to (grid, aligner, sibling,
+       gtk_grid_attach_next_to (grid, combo_box, sibling,
                                 GTK_POS_RIGHT, 1, 1);
 
        return GTK_COMBO_BOX (combo_box);
-}                      
+}
 
 static GtkComboBox*
 attach_group_combo_box (GtkGrid *grid,
@@ -2906,7 +2899,6 @@ static void
 create_basic_page (NautilusPropertiesWindow *window)
 {
        GtkGrid *grid;
-       GtkWidget *icon_aligner;
        GtkWidget *icon_pixmap_widget;
        GtkWidget *volume_usage;
        GtkWidget *hbox, *vbox;
@@ -2918,13 +2910,11 @@ create_basic_page (NautilusPropertiesWindow *window)
 
        icon_pixmap_widget = create_image_widget (
                window, should_show_custom_icon_buttons (window));
+       gtk_widget_set_halign (icon_pixmap_widget, GTK_ALIGN_END);
+       gtk_widget_set_valign (icon_pixmap_widget, GTK_ALIGN_START);
        gtk_widget_show (icon_pixmap_widget);
 
-       icon_aligner = gtk_alignment_new (1, 0, 0, 0);
-       gtk_widget_show (icon_aligner);
-       
-       gtk_container_add (GTK_CONTAINER (icon_aligner), icon_pixmap_widget);
-       gtk_box_pack_start (GTK_BOX (hbox), icon_aligner, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (hbox), icon_pixmap_widget, FALSE, FALSE, 0);
 
        window->details->icon_chooser = NULL;
 
@@ -3105,7 +3095,7 @@ start_long_operation (NautilusPropertiesWindow *window)
                /* start long operation */
                GdkCursor * cursor;
                
-               cursor = gdk_cursor_new (GDK_WATCH);
+               cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_WATCH);
                gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), cursor);
                g_object_unref (cursor);
        }
@@ -4186,14 +4176,12 @@ on_change_permissions_clicked (GtkWidget                *button,
                            TRUE, TRUE, 0);
 
        label = gtk_label_new (_("Files"));
-       gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
        gtk_grid_attach (grid, label, 1, 0, 1, 1);
        label = gtk_label_new (_("Folders"));
-       gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
        gtk_grid_attach (grid, label, 2, 0, 1, 1);
 
        label = gtk_label_new (_("Owner:"));
-       gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (label), 0.0);
        gtk_grid_attach (grid, label, 0, 1, 1, 1);
        combo = create_permissions_combo_box (PERMISSION_USER, FALSE);
        window->details->change_permission_combos = g_list_prepend (window->details->change_permission_combos,
@@ -4207,7 +4195,7 @@ on_change_permissions_clicked (GtkWidget                *button,
        gtk_grid_attach (grid, combo, 2, 1, 1, 1);
 
        label = gtk_label_new (_("Group:"));
-       gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (label), 0.0);
        gtk_grid_attach (grid, label, 0, 2, 1, 1);
        combo = create_permissions_combo_box (PERMISSION_GROUP, FALSE);
        window->details->change_permission_combos = g_list_prepend (window->details->change_permission_combos,
@@ -4221,7 +4209,7 @@ on_change_permissions_clicked (GtkWidget                *button,
        gtk_grid_attach (grid, combo, 2, 2, 1, 1);
 
        label = gtk_label_new (_("Others:"));
-       gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+       gtk_label_set_xalign (GTK_LABEL (label), 0.0);
        gtk_grid_attach (grid, label, 0, 3, 1, 1);
        combo = create_permissions_combo_box (PERMISSION_OTHER, FALSE);
        window->details->change_permission_combos = g_list_prepend (window->details->change_permission_combos,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]