summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnestas Kulik <ernestask@gnome.org>2018-07-10 12:17:39 +0300
committerAntónio Fernandes <antoniof@gnome.org>2021-08-15 21:37:12 +0100
commit59040d0d6128956e63c2374eabd513ecd5241d1b (patch)
tree5442fd8722977054b74b8ba6d5fb81fba8d8da71
parent27f80a356b80b319fc12985ba028a64dc156cdf0 (diff)
downloadnautilus-59040d0d6128956e63c2374eabd513ecd5241d1b.tar.gz
general: Use GtkButton as a container
GtkButton lost its GtkImage-related API in GTK4, and should be used as a regular container. Rebased and ammended by António Fernandes <antoniof@gnome.org>
-rw-r--r--src/nautilus-file-conflict-dialog.c3
-rw-r--r--src/nautilus-progress-info-widget.c12
-rw-r--r--src/nautilus-x-content-bar.c17
-rw-r--r--src/resources/ui/nautilus-progress-info-widget.ui11
4 files changed, 24 insertions, 19 deletions
diff --git a/src/nautilus-file-conflict-dialog.c b/src/nautilus-file-conflict-dialog.c
index 678f96323..56e4ca9d3 100644
--- a/src/nautilus-file-conflict-dialog.c
+++ b/src/nautilus-file-conflict-dialog.c
@@ -339,9 +339,6 @@ nautilus_file_conflict_dialog_init (NautilusFileConflictDialog *fcd)
gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
widget = gtk_button_new_with_label (_("Reset"));
- gtk_button_set_image (GTK_BUTTON (widget),
- gtk_image_new_from_icon_name ("edit-undo",
- GTK_ICON_SIZE_MENU));
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 6);
g_signal_connect (widget, "clicked",
G_CALLBACK (reset_button_clicked_cb), dialog);
diff --git a/src/nautilus-progress-info-widget.c b/src/nautilus-progress-info-widget.c
index 3d241336f..fd70d9781 100644
--- a/src/nautilus-progress-info-widget.c
+++ b/src/nautilus-progress-info-widget.c
@@ -32,7 +32,7 @@ struct _NautilusProgressInfoWidgetPrivate
GtkWidget *details; /* GtkLabel */
GtkWidget *progress_bar;
GtkWidget *button;
- GtkWidget *done_image;
+ GtkWidget *image;
};
enum
@@ -49,7 +49,9 @@ G_DEFINE_TYPE_WITH_PRIVATE (NautilusProgressInfoWidget, nautilus_progress_info_w
static void
info_finished (NautilusProgressInfoWidget *self)
{
- gtk_button_set_image (GTK_BUTTON (self->priv->button), self->priv->done_image);
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->image),
+ "object-select-symbolic",
+ GTK_ICON_SIZE_BUTTON);
gtk_widget_set_sensitive (self->priv->button, FALSE);
}
@@ -125,7 +127,9 @@ nautilus_progress_info_widget_constructed (GObject *obj)
if (nautilus_progress_info_get_is_finished (self->priv->info))
{
- gtk_button_set_image (GTK_BUTTON (self->priv->button), self->priv->done_image);
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->image),
+ "object-select-symbolic",
+ GTK_ICON_SIZE_BUTTON);
}
gtk_widget_set_sensitive (self->priv->button,
@@ -213,7 +217,7 @@ nautilus_progress_info_widget_class_init (NautilusProgressInfoWidgetClass *klass
gtk_widget_class_bind_template_child_private (widget_class, NautilusProgressInfoWidget, details);
gtk_widget_class_bind_template_child_private (widget_class, NautilusProgressInfoWidget, progress_bar);
gtk_widget_class_bind_template_child_private (widget_class, NautilusProgressInfoWidget, button);
- gtk_widget_class_bind_template_child_private (widget_class, NautilusProgressInfoWidget, done_image);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusProgressInfoWidget, image);
}
GtkWidget *
diff --git a/src/nautilus-x-content-bar.c b/src/nautilus-x-content-bar.c
index f37c84668..a7bbce15e 100644
--- a/src/nautilus-x-content-bar.c
+++ b/src/nautilus-x-content-bar.c
@@ -157,6 +157,7 @@ nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar,
GAppInfo *app;
gboolean has_app;
guint i;
+ GtkWidget *box;
default_app = g_ptr_array_index (apps, n);
has_app = FALSE;
@@ -187,13 +188,17 @@ nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar,
}
name = g_app_info_get_name (default_app);
- button = gtk_info_bar_add_button (GTK_INFO_BAR (bar),
- name,
- n);
+ button = gtk_info_bar_add_button (GTK_INFO_BAR (bar), name, n);
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+
+ if (image != NULL)
+ {
+ gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
+ }
+ gtk_box_pack_start (GTK_BOX (box), gtk_label_new (name), FALSE, FALSE, 0);
+
+ gtk_container_add (GTK_CONTAINER (button), box);
- gtk_button_set_image (GTK_BUTTON (button), image);
- gtk_button_set_always_show_image (GTK_BUTTON (button), TRUE);
- gtk_button_set_label (GTK_BUTTON (button), name);
gtk_widget_show (button);
}
diff --git a/src/resources/ui/nautilus-progress-info-widget.ui b/src/resources/ui/nautilus-progress-info-widget.ui
index 72c18e850..3dda2fcd4 100644
--- a/src/resources/ui/nautilus-progress-info-widget.ui
+++ b/src/resources/ui/nautilus-progress-info-widget.ui
@@ -51,10 +51,14 @@
<property name="receives_default">True</property>
<property name="valign">center</property>
<property name="margin_start">20</property>
- <property name="image">cancel_image</property>
<style>
<class name="circular"/>
</style>
+ <child>
+ <object class="GtkImage" id="image">
+ <property name="icon-name">window-close-symbolic</property>
+ </object>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -84,9 +88,4 @@
</packing>
</child>
</template>
- <object class="GtkImage" id="done_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">object-select-symbolic</property>
- </object>
</interface>