Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

Closes #3104

See merge request GNOME/gtk!2507
This commit is contained in:
Matthias Clasen 2020-08-30 22:01:45 +00:00
commit dc8b88393d
6 changed files with 71 additions and 8 deletions

View File

@ -210,6 +210,14 @@
fun:FcFontSetList fun:FcFontSetList
} }
{
FcPatternObjectInsertElt
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:FcPatternObjectInsertElt
}
{ {
FcFontRenderPrepare FcFontRenderPrepare
Memcheck:Leak Memcheck:Leak

View File

@ -51,3 +51,11 @@
stacksidebar.object-details { stacksidebar.object-details {
border-top: 1px solid lightgray; border-top: 1px solid lightgray;
} }
picture.dark {
background: gray;
}
picture.light {
background: white;
}

View File

@ -782,6 +782,9 @@ describe_expression (GtkExpression *expression)
g_value_init (&dest, G_TYPE_STRING); g_value_init (&dest, G_TYPE_STRING);
if (g_value_transform (value, &dest)) if (g_value_transform (value, &dest))
{ {
/* Translators: %s is a type name, for example
* GtkPropertyExpression with value \"2.5\"
*/
char *res = g_strdup_printf (_("%s with value \"%s\""), char *res = g_strdup_printf (_("%s with value \"%s\""),
g_type_name (G_TYPE_FROM_INSTANCE (expression)), g_type_name (G_TYPE_FROM_INSTANCE (expression)),
g_value_get_string (&dest)); g_value_get_string (&dest));
@ -790,6 +793,9 @@ describe_expression (GtkExpression *expression)
} }
else else
{ {
/* Translators: Both %s are type names, for example
* GtkPropertyExpression with type GObject
*/
return g_strdup_printf (_("%s with type %s"), return g_strdup_printf (_("%s with type %s"),
g_type_name (G_TYPE_FROM_INSTANCE (expression)), g_type_name (G_TYPE_FROM_INSTANCE (expression)),
g_type_name (G_VALUE_TYPE (value))); g_type_name (G_VALUE_TYPE (value)));
@ -800,12 +806,14 @@ describe_expression (GtkExpression *expression)
gpointer obj = gtk_object_expression_get_object (expression); gpointer obj = gtk_object_expression_get_object (expression);
if (obj) if (obj)
/* Translators: Both %s are type names, for example
* GtkObjectExpression for GtkStringObject 0x23456789
*/
return g_strdup_printf (_("%s for %s %p"), return g_strdup_printf (_("%s for %s %p"),
g_type_name (G_TYPE_FROM_INSTANCE (expression)), g_type_name (G_TYPE_FROM_INSTANCE (expression)),
G_OBJECT_TYPE_NAME (obj), obj); G_OBJECT_TYPE_NAME (obj), obj);
else else
return g_strdup_printf (_("%s"), return g_strdup (g_type_name (G_TYPE_FROM_INSTANCE (expression)));
g_type_name (G_TYPE_FROM_INSTANCE (expression)));
} }
else if (G_TYPE_CHECK_INSTANCE_TYPE (expression, GTK_TYPE_PROPERTY_EXPRESSION)) else if (G_TYPE_CHECK_INSTANCE_TYPE (expression, GTK_TYPE_PROPERTY_EXPRESSION))
{ {
@ -815,6 +823,10 @@ describe_expression (GtkExpression *expression)
char *res; char *res;
str = describe_expression (expr); str = describe_expression (expr);
/* Translators: The first %s is a type name, %s:%s is a qualified
* property name, and is a value, for example
* GtkPropertyExpression for property GtkLabellabel on: GObjectExpression ...
*/
res = g_strdup_printf ("%s for property %s:%s on: %s", res = g_strdup_printf ("%s for property %s:%s on: %s",
g_type_name (G_TYPE_FROM_INSTANCE (expression)), g_type_name (G_TYPE_FROM_INSTANCE (expression)),
g_type_name (pspec->owner_type), g_type_name (pspec->owner_type),
@ -824,6 +836,9 @@ describe_expression (GtkExpression *expression)
return res; return res;
} }
else else
/* Translators: Both %s are type names, for example
* GtkPropertyExpression with value type: gchararray
*/
return g_strdup_printf (_("%s with value type %s"), return g_strdup_printf (_("%s with value type %s"),
g_type_name (G_TYPE_FROM_INSTANCE (expression)), g_type_name (G_TYPE_FROM_INSTANCE (expression)),
g_type_name (gtk_expression_get_value_type (expression))); g_type_name (gtk_expression_get_value_type (expression)));
@ -1248,7 +1263,7 @@ attribute_bind_item (GtkSignalListItemFactory *factory,
g_free (text); g_free (text);
} }
else else
gtk_label_set_label (GTK_LABEL (label), _("None")); gtk_label_set_label (GTK_LABEL (label), C_("column number", "None"));
gtk_list_item_set_selectable (item, holder->sensitive); gtk_list_item_set_selectable (item, holder->sensitive);
gtk_widget_set_sensitive (label, holder->sensitive); gtk_widget_set_sensitive (label, holder->sensitive);
@ -1389,6 +1404,9 @@ action_editor (GObject *object,
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
if (owner) if (owner)
{ {
/* Translators: %s is a type name, for example
* Action from 0x2345678 (GtkApplicationWindow)
*/
text = g_strdup_printf (_("Action from: %p (%s)"), text = g_strdup_printf (_("Action from: %p (%s)"),
owner, g_type_name_from_instance ((GTypeInstance *)owner)); owner, g_type_name_from_instance ((GTypeInstance *)owner));
gtk_box_append (GTK_BOX (box), gtk_label_new (text)); gtk_box_append (GTK_BOX (box), gtk_label_new (text));
@ -1452,20 +1470,20 @@ add_gtk_settings_info (GtkInspectorPropEditor *self)
switch (_gtk_settings_get_setting_source (GTK_SETTINGS (object), name)) switch (_gtk_settings_get_setting_source (GTK_SETTINGS (object), name))
{ {
case GTK_SETTINGS_SOURCE_DEFAULT: case GTK_SETTINGS_SOURCE_DEFAULT:
source = _("Default"); source = C_("GtkSettings source", "Default");
break; break;
case GTK_SETTINGS_SOURCE_THEME: case GTK_SETTINGS_SOURCE_THEME:
source = _("Theme"); source = C_("GtkSettings source", "Theme");
break; break;
case GTK_SETTINGS_SOURCE_XSETTING: case GTK_SETTINGS_SOURCE_XSETTING:
source = _("XSettings"); source = C_("GtkSettings source", "XSettings");
break; break;
case GTK_SETTINGS_SOURCE_APPLICATION: case GTK_SETTINGS_SOURCE_APPLICATION:
gtk_widget_set_sensitive (button, TRUE); gtk_widget_set_sensitive (button, TRUE);
source = _("Application"); source = C_("GtkSettings source", "Application");
break; break;
default: default:
source = _("Unknown"); source = C_("GtkSettings source", "Unknown");
break; break;
} }
gtk_box_append (GTK_BOX (row), gtk_label_new (_("Source:"))); gtk_box_append (GTK_BOX (row), gtk_label_new (_("Source:")));

View File

@ -1021,6 +1021,25 @@ render_node_save (GtkButton *button,
gtk_widget_show (dialog); gtk_widget_show (dialog);
} }
static void
toggle_dark_mode (GtkToggleButton *button,
GParamSpec *pspec,
gpointer data)
{
GtkWidget *picture = data;
if (gtk_toggle_button_get_active (button))
{
gtk_widget_add_css_class (picture, "dark");
gtk_widget_remove_css_class (picture, "light");
}
else
{
gtk_widget_remove_css_class (picture, "dark");
gtk_widget_add_css_class (picture, "light");
}
}
static GtkWidget * static GtkWidget *
gtk_inspector_recorder_recordings_list_create_widget (gpointer item, gtk_inspector_recorder_recordings_list_create_widget (gpointer item,
gpointer user_data) gpointer user_data)
@ -1216,6 +1235,7 @@ gtk_inspector_recorder_class_init (GtkInspectorRecorderClass *klass)
gtk_widget_class_bind_template_callback (widget_class, recordings_list_row_selected); gtk_widget_class_bind_template_callback (widget_class, recordings_list_row_selected);
gtk_widget_class_bind_template_callback (widget_class, render_node_save); gtk_widget_class_bind_template_callback (widget_class, render_node_save);
gtk_widget_class_bind_template_callback (widget_class, node_property_activated); gtk_widget_class_bind_template_callback (widget_class, node_property_activated);
gtk_widget_class_bind_template_callback (widget_class, toggle_dark_mode);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
} }

View File

@ -37,6 +37,14 @@
<property name="hexpand">1</property> <property name="hexpand">1</property>
</object> </object>
</child> </child>
<child>
<object class="GtkToggleButton" id="dark_mode_button">
<property name="has-frame">0</property>
<property name="icon-name">display-brightness-symbolic</property>
<property name="tooltip-text" translatable="yes">Use a dark background</property>
<signal name="notify::active" handler="toggle_dark_mode" swapped="0" object="render_node_view"/>
</object>
</child>
<child> <child>
<object class="GtkButton" id="render_node_save_button"> <object class="GtkButton" id="render_node_save_button">
<property name="has-frame">0</property> <property name="has-frame">0</property>

View File

@ -551,6 +551,7 @@ button {
&.circular { &.circular {
min-height: 24px; min-height: 24px;
padding: 4px;
} }
} }