[gnome-software/1065-gs-details-page-gsinfobar-doesn-t-pains-in-the-details-page: 1864/1864] gs-details-page: GsInfoBar doesn't paint in the details page
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1065-gs-details-page-gsinfobar-doesn-t-pains-in-the-details-page: 1864/1864] gs-details-page: GsInfoBar doesn't paint in the details page
- Date: Thu, 7 Oct 2021 10:29:41 +0000 (UTC)
commit ac453280d648548f88effc71e9e8bf8245785cbd
Author: Milan Crha <mcrha redhat com>
Date: Fri Sep 18 10:17:14 2020 +0200
gs-details-page: GsInfoBar doesn't paint in the details page
An info bar packed in the middle of the window requires its own window,
to be drawn properly.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1065
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/510
src/gs-details-page.ui | 4 ++++
src/gs-info-bar.c | 42 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 45 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-details-page.ui b/src/gs-details-page.ui
index 4dfe50530..cbe9427f7 100644
--- a/src/gs-details-page.ui
+++ b/src/gs-details-page.ui
@@ -603,6 +603,7 @@
<child>
<object class="GsInfoBar" id="infobar_details_app_repo">
<property name="visible">True</property>
+ <property name="has-window">True</property>
<property name="margin_top">20</property>
<property name="title" translatable="yes">Software Repository
Included</property>
<property name="body" translatable="yes">This application includes a
software repository which provides updates, as well as access to other software.</property>
@@ -622,6 +623,7 @@
<child>
<object class="GsInfoBar" id="infobar_details_app_norepo">
<property name="visible">True</property>
+ <property name="has-window">True</property>
<property name="margin_top">20</property>
<property name="title" translatable="yes">No Software Repository
Included</property>
<property name="body" translatable="yes">This application does not include a
software repository. It will not be updated with new versions.</property>
@@ -641,6 +643,7 @@
<child>
<object class="GsInfoBar" id="infobar_details_package_baseos">
<property name="visible">True</property>
+ <property name="has-window">True</property>
<property name="message_type">warning</property>
<property name="margin_top">20</property>
<property name="title" translatable="yes">This software is already provided
by your distribution and should not be replaced.</property>
@@ -660,6 +663,7 @@
<child>
<object class="GsInfoBar" id="infobar_details_repo">
<property name="visible">True</property>
+ <property name="has-window">True</property>
<property name="margin_top">20</property>
<property name="title" translatable="yes" comments="Translators: a
repository file used for installing software has been discovered.">Software Repository Identified</property>
<property name="body" translatable="yes">Adding this software repository
will give you access to additional software and upgrades.</property>
diff --git a/src/gs-info-bar.c b/src/gs-info-bar.c
index caac2ece6..2c37d2cc8 100644
--- a/src/gs-info-bar.c
+++ b/src/gs-info-bar.c
@@ -17,6 +17,7 @@ struct _GsInfoBar
GtkWidget *label_title;
GtkWidget *label_body;
GtkWidget *label_warning;
+ gboolean has_window;
};
G_DEFINE_TYPE (GsInfoBar, gs_info_bar, GTK_TYPE_INFO_BAR)
@@ -25,9 +26,23 @@ enum {
PROP_0,
PROP_TITLE,
PROP_BODY,
- PROP_WARNING
+ PROP_WARNING,
+ PROP_HAS_WINDOW
};
+static gboolean
+gs_info_bar_get_has_window (GsInfoBar *bar)
+{
+ return bar->has_window;
+}
+
+static void
+gs_info_bar_set_has_window (GsInfoBar *bar,
+ gboolean has_window)
+{
+ bar->has_window = has_window;
+}
+
static void
gs_info_bar_get_property (GObject *object,
guint prop_id,
@@ -46,6 +61,9 @@ gs_info_bar_get_property (GObject *object,
case PROP_WARNING:
g_value_set_string (value, gs_info_bar_get_warning (infobar));
break;
+ case PROP_HAS_WINDOW:
+ g_value_set_boolean (value, gs_info_bar_get_has_window (infobar));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -70,12 +88,25 @@ gs_info_bar_set_property (GObject *object,
case PROP_WARNING:
gs_info_bar_set_warning (infobar, g_value_get_string (value));
break;
+ case PROP_HAS_WINDOW:
+ gs_info_bar_set_has_window (infobar, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
+static void
+gs_info_bar_constructed (GObject *object)
+{
+ GsInfoBar *bar = GS_INFO_BAR (object);
+
+ G_OBJECT_CLASS (gs_info_bar_parent_class)->constructed (object);
+
+ gtk_widget_set_has_window (GTK_WIDGET (object), bar->has_window);
+}
+
static void
gs_info_bar_init (GsInfoBar *infobar)
{
@@ -91,6 +122,7 @@ gs_info_bar_class_init (GsInfoBarClass *klass)
object_class->get_property = gs_info_bar_get_property;
object_class->set_property = gs_info_bar_set_property;
+ object_class->constructed = gs_info_bar_constructed;
g_object_class_install_property (object_class, PROP_TITLE,
g_param_spec_string ("title",
@@ -113,6 +145,14 @@ gs_info_bar_class_init (GsInfoBarClass *klass)
NULL,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_HAS_WINDOW,
+ g_param_spec_boolean ("has-window",
+ "Has Window",
+ "Private property, whether the info bar needs its own window",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-info-bar.ui");
gtk_widget_class_bind_template_child (widget_class,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]