summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnestas Kulik <ernestask@gnome.org>2018-07-10 12:17:39 +0300
committerErnestas Kulik <ekulik@redhat.com>2019-06-29 14:33:40 +0200
commit6dd2f245172c47b3c37656544fa78e236d11f8f5 (patch)
treeee712799fd4f6160c6e10c11c4ff0f9c3458e5ae
parentea575141c9e4caf675c8f66ee1873b3c9ae6d1c2 (diff)
downloadnautilus-6dd2f245172c47b3c37656544fa78e236d11f8f5.tar.gz
general: Use GtkButton as a container
GtkButton lost its GtkImage-related API, and should be used as a regular container.
-rw-r--r--src/nautilus-file-conflict-dialog.c5
-rw-r--r--src/nautilus-progress-info-widget.c8
-rw-r--r--src/nautilus-x-content-bar.c17
-rw-r--r--src/resources/ui/nautilus-progress-info-widget.ui11
4 files changed, 22 insertions, 19 deletions
diff --git a/src/nautilus-file-conflict-dialog.c b/src/nautilus-file-conflict-dialog.c
index fe0230210..e7d05e5ed 100644
--- a/src/nautilus-file-conflict-dialog.c
+++ b/src/nautilus-file-conflict-dialog.c
@@ -307,9 +307,8 @@ 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_container_add (GTK_CONTAINER (widget),
+ gtk_image_new_from_icon_name ("edit-undo"));
gtk_widget_set_margin_end (widget, 6);
gtk_widget_set_margin_start (widget, 6);
gtk_box_pack_start (GTK_BOX (hbox), widget);
diff --git a/src/nautilus-progress-info-widget.c b/src/nautilus-progress-info-widget.c
index 3d241336f..d2b4a3ff4 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,7 @@ 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_widget_set_sensitive (self->priv->button, FALSE);
}
@@ -125,7 +125,7 @@ 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_widget_set_sensitive (self->priv->button,
@@ -213,7 +213,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 ff6e10c64..4096df73c 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_container_add (GTK_CONTAINER (box), image);
+ }
+ gtk_container_add (GTK_CONTAINER (box), gtk_label_new (name));
+
+ 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 0e250abc4..da907567c 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="nautilus-circular-button"/>
</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>
@@ -81,9 +85,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>