tests: Drop the visuals test

This was just a different way to load a ui file
and try it with dark mode. This can be done
with gtk-builder-tool preview and GTK_THEME.
This commit is contained in:
Matthias Clasen 2020-05-12 15:56:46 -04:00
parent e7bf4a3de8
commit fe6238d1c4
8 changed files with 0 additions and 596 deletions

View File

@ -153,5 +153,3 @@ if get_option('profiler')
executable('testperf', 'testperf.c',
dependencies: [profiler_dep, platform_gio_dep, libm])
endif
subdir('visuals')

View File

@ -1,148 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="default_width">600</property>
<property name="default_height">600</property>
<child>
<object class="GtkBox" id="box1">
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="visible">True</property>
<property name="vexpand">True</property>
<property name="hexpand">True</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="row_spacing">12</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label">Continuous values</property>
</object>
</child>
<child>
<object class="GtkLevelBar" id="str1">
<property name="visible">True</property>
<property name="hexpand">true</property>
<property name="value">0.09</property>
<offsets>
<offset name="low" value="0.09"/>
<offset name="high" value="0.65"/>
</offsets>
</object>
</child>
<child>
<object class="GtkLevelBar" id="str2">
<property name="visible">True</property>
<property name="hexpand">true</property>
<property name="value">0.20</property>
</object>
</child>
<child>
<object class="GtkLevelBar" id="str3">
<property name="visible">True</property>
<property name="hexpand">true</property>
<property name="value">0.5</property>
</object>
</child>
<child>
<object class="GtkLevelBar" id="str4">
<property name="visible">True</property>
<property name="hexpand">true</property>
<property name="value">1.0</property>
</object>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label">Discrete values</property>
</object>
</child>
<child>
<object class="GtkLevelBar" id="str1d">
<property name="visible">True</property>
<property name="hexpand">true</property>
<property name="value">2.8</property>
<property name="min_value">0.0</property>
<property name="max_value">5.0</property>
<property name="mode">discrete</property>
<offsets>
<offset name="low" value="1.0"/>
<offset name="high" value="4.0"/>
</offsets>
</object>
</child>
</object>
</child>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
<property name="column_spacing">12</property>
<property name="halign">center</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label">Continuous values</property>
</object>
</child>
<child>
<object class="GtkLevelBar" id="str5">
<property name="visible">True</property>
<property name="vexpand">true</property>
<property name="orientation">vertical</property>
<property name="value">0.09</property>
</object>
</child>
<child>
<object class="GtkLevelBar" id="str6">
<property name="visible">True</property>
<property name="vexpand">true</property>
<property name="orientation">vertical</property>
<property name="value">0.2</property>
</object>
</child>
<child>
<object class="GtkLevelBar" id="str7">
<property name="visible">True</property>
<property name="vexpand">true</property>
<property name="orientation">vertical</property>
<property name="value">0.5</property>
</object>
</child>
<child>
<object class="GtkLevelBar" id="str8">
<property name="visible">True</property>
<property name="vexpand">true</property>
<property name="orientation">vertical</property>
<property name="value">1.0</property>
</object>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label">Discrete values</property>
</object>
</child>
<child>
<object class="GtkLevelBar" id="str2d">
<property name="visible">True</property>
<property name="vexpand">true</property>
<property name="orientation">vertical</property>
<property name="value">15.0</property>
<property name="min_value">10.0</property>
<property name="max_value">15.0</property>
<property name="mode">discrete</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="default_width">600</property>
<property name="default_height">600</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
<property name="valign">center</property>
<property name="halign">center</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Hi, I am a button</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label" translatable="yes">And I'm another button</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
</child>
<child>
<object class="GtkButton" id="button3">
<property name="label" translatable="yes">This is a button party!</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="default_width">600</property>
<property name="default_height">600</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="valign">center</property>
<property name="halign">center</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Hi, I am a button</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label" translatable="yes">And I'm another button</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
</child>
<child>
<object class="GtkButton" id="button3">
<property name="label" translatable="yes">This is a button party!</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1 +0,0 @@
executable('visuals', 'visuals.c', dependencies: libgtk_dep)

View File

@ -1,168 +0,0 @@
<interface>
<object class="GtkWindow" id="window1">
<property name="default_width">600</property>
<property name="default_height">600</property>
<child>
<object class="GtkOverlay" id="overlay1">
<child>
<object class="GtkDrawingArea" id="filler"/>
</child>
<child type="overlay">
<object class="GtkToolbar" id="bottom_toolbar">
<property name="show_arrow">0</property>
<property name="halign">center</property>
<property name="valign">end</property>
<property name="margin_bottom">24</property>
<style>
<class name="osd"/>
</style>
<child>
<object class="GtkToolItem" id="left_item">
<child>
<object class="GtkBox" id="left_box">
<child>
<object class="GtkToggleButton" id="camera">
<child>
<object class="GtkImage" id="camera_icon">
<property name="icon_name">camera-web-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToggleButton" id="volume">
<property name="active">1</property>
<child>
<object class="GtkImage" id="volume_icon">
<property name="icon_name">audio-volume-medium-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToggleButton" id="microphone">
<property name="sensitive">0</property>
<child>
<object class="GtkImage" id="microphone_icon">
<property name="icon_name">audio-input-microphone-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToggleButton" id="bt">
<property name="sensitive">0</property>
<property name="active">1</property>
<child>
<object class="GtkImage" id="bt_icon">
<property name="icon_name">bluetooth-active-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparatorToolItem" id="toolbutton2">
<property name="expand-item">True</property>
<property name="draw">0</property>
</object>
</child>
<child>
<object class="GtkToolItem" id="toolitem4">
<child>
<object class="GtkLabel" id="status_label">
<property name="label">OSD Toolbar</property>
<property name="margin_start">10</property>
<property name="margin_end">10</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolItem" id="right_item">
<child>
<object class="GtkBox" id="right_box">
<child>
<object class="GtkToggleButton" id="opt">
<child>
<object class="GtkImage" id="opt_icon">
<property name="icon_name">media-optical-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToggleButton" id="hdd">
<property name="active">1</property>
<child>
<object class="GtkImage" id="hdd_icon">
<property name="icon_name">drive-harddisk-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToggleButton" id="joy">
<property name="sensitive">0</property>
<child>
<object class="GtkImage" id="joy_icon">
<property name="icon_name">input-gaming-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="overlay">
<object class="GtkToolbar" id="top_toolbar">
<property name="show_arrow">0</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="margin_top">24</property>
<style>
<class name="osd"/>
</style>
<child>
<object class="GtkToggleToolButton" id="tb1">
<property name="icon_name">edit-undo-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton" id="tb2">
<property name="icon_name">edit-redo-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton" id="tb3">
<property name="icon_name">start-here-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton" id="tb4">
<property name="icon_name">applications-science-symbolic</property>
</object>
</child>
<child>
<object class="GtkToolItem" id="tb5">
<child>
<object class="GtkLabel" id="tb5_label">
<property name="label">Another kind of OSD toolbar</property>
<property name="margin_start">10</property>
<property name="margin_end">10</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="default_width">600</property>
<property name="default_height">600</property>
<child>
<object class="GtkBox" id="containerbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="valign">center</property>
<property name="halign">center</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
<property name="valign">center</property>
<property name="halign">center</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Hi, I am a button</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="button2">
<property name="label" translatable="yes">And I'm the suggested action</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<style>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolbar" id="toolbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
<style>
<class name="selection-mode"/>
<class name="menubar"/>
</style>
<child>
<object class="GtkToggleToolButton" id="toolbutton7">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Inside selection mode</property>
<property name="use_underline">True</property>
<property name="is_important">True</property>
<style>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,95 +0,0 @@
/* visuals: UI runner for visual GtkBuilder files
*
* Copyright (C) 2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
*
* Author: Cosimo Cecchi <cosimoc@gnome.org>
*
*/
#include <gtk/gtk.h>
static void
dark_button_toggled_cb (GtkToggleButton *button,
gpointer user_data)
{
gboolean active = gtk_toggle_button_get_active (button);
GtkSettings *settings = gtk_settings_get_default ();
g_object_set (settings,
"gtk-application-prefer-dark-theme", active,
NULL);
}
static void
create_dark_popup (GtkWidget *parent)
{
GtkWidget *popup = gtk_window_new ();
GtkWidget *button = gtk_toggle_button_new_with_label ("Dark");
gtk_window_set_decorated (GTK_WINDOW (popup), FALSE);
gtk_widget_set_size_request (popup, 100, 100);
gtk_window_set_resizable (GTK_WINDOW (popup), FALSE);
gtk_window_set_hide_on_close (GTK_WINDOW (popup), TRUE);
gtk_window_set_child (GTK_WINDOW (popup), button);
g_signal_connect (button, "toggled",
G_CALLBACK (dark_button_toggled_cb), NULL);
gtk_window_set_transient_for (GTK_WINDOW (popup), GTK_WINDOW (parent));
gtk_widget_show (popup);
}
static void
quit_cb (GtkWidget *widget,
gpointer data)
{
gboolean *done = data;
*done = TRUE;
g_main_context_wakeup (NULL);
}
int
main (int argc, char *argv[])
{
GtkBuilder *builder;
GtkWidget *window;
const gchar *filename;
gboolean done = FALSE;
gtk_init ();
if (argc < 2)
return 1;
filename = argv[1];
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, filename, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
g_object_unref (G_OBJECT (builder));
g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
gtk_widget_show (window);
create_dark_popup (window);
while (!done)
g_main_context_iteration (NULL, TRUE);
return 0;
}