Commit a51bd57b authored by Milan Crha's avatar Milan Crha

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 #1065
Closes !510
parent f71cf36f
Pipeline #214770 passed with stage
in 4 minutes and 8 seconds
......@@ -383,6 +383,7 @@
<object class="GsInfoBar" id="infobar_details_app_repo">
<property name="visible">True</property>
<property name="margin_top">20</property>
<property name="has-window">True</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>
</object>
......@@ -391,6 +392,7 @@
<object class="GsInfoBar" id="infobar_details_app_norepo">
<property name="visible">True</property>
<property name="margin_top">20</property>
<property name="has-window">True</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>
</object>
......@@ -400,6 +402,7 @@
<property name="visible">True</property>
<property name="message_type">warning</property>
<property name="margin_top">20</property>
<property name="has-window">True</property>
<property name="title" translatable="yes">This software is already provided by your distribution and should not be replaced.</property>
</object>
</child>
......@@ -407,6 +410,7 @@
<object class="GsInfoBar" id="infobar_details_repo">
<property name="visible">True</property>
<property name="margin_top">20</property>
<property name="has-window">True</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>
<property name="warning" translatable="yes">Only use software repositories that you trust.</property>
......
......@@ -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,
......
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