inspector: Disable non-functional controls
Some of the features we expose can be hardcoded via environment variables. In that case, don't confuse the user by letting them change settings that have no effect.
This commit is contained in:
@ -15,6 +15,9 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include "general.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
@ -157,6 +160,14 @@ init_touch (GtkInspectorGeneral *gen)
|
||||
gtk_switch_set_active (GTK_SWITCH (gen->priv->touchscreen_switch), (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0);
|
||||
g_signal_connect (gen->priv->touchscreen_switch, "notify::active",
|
||||
G_CALLBACK (update_touchscreen), gen);
|
||||
|
||||
if (g_getenv ("GTK_TEST_TOUCHSCREEN") != 0)
|
||||
{
|
||||
/* hardcoded, nothing we can do */
|
||||
gtk_switch_set_active (GTK_SWITCH (gen->priv->touchscreen_switch), TRUE);
|
||||
gtk_widget_set_sensitive (gen->priv->touchscreen_switch, FALSE);
|
||||
gtk_widget_set_tooltip_text (gen->priv->touchscreen_switch, _("Setting is hardcoded by GTK_TEST_TOUCHSCREEN"));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -15,6 +15,8 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "visual.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
@ -211,6 +213,13 @@ init_theme (GtkInspectorVisual *vis)
|
||||
g_hash_table_destroy (t);
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (vis->priv->theme_combo), pos);
|
||||
|
||||
if (g_getenv ("GTK_THEME") != NULL)
|
||||
{
|
||||
/* theme is hardcoded, nothing we can do */
|
||||
gtk_widget_set_sensitive (vis->priv->theme_combo, FALSE);
|
||||
gtk_widget_set_tooltip_text (vis->priv->theme_combo , _("Theme is hardcoded by GTK_THEME"));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -230,6 +239,13 @@ init_dark (GtkInspectorVisual *vis)
|
||||
g_object_bind_property (vis->priv->dark_switch, "active",
|
||||
gtk_settings_get_default (), "gtk-application-prefer-dark-theme",
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
|
||||
if (g_getenv ("GTK_THEME") != NULL)
|
||||
{
|
||||
/* theme is hardcoded, nothing we can do */
|
||||
gtk_widget_set_sensitive (vis->priv->dark_switch, FALSE);
|
||||
gtk_widget_set_tooltip_text (vis->priv->dark_switch, _("Theme is hardcoded by GTK_THEME"));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user