static void
cc_region_panel_init (CcRegionPanel * self)
{
	CcRegionPanelPrivate *priv;
	GtkWidget *prefs_widget;
	const char *desktop;
	GError *error = NULL;

	priv = self->priv = REGION_PANEL_PRIVATE (self);

	desktop = g_getenv ("XDG_CURRENT_DESKTOP");

	priv->builder = gtk_builder_new ();
	gtk_builder_add_from_file (priv->builder,
				   CINNAMONCC_UI_DIR "/cinnamon-region-panel.ui",
				   &error);
	if (error != NULL) {
		g_warning ("Error loading UI file: %s", error->message);
		g_error_free (error);
		return;
	}

    prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder, "vbox1");

	gtk_widget_set_size_request (GTK_WIDGET (prefs_widget), -1, 400);

	gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));

    setup_xkb_tabs (priv->builder);
        
}
Ejemplo n.º 2
0
static void
cc_region_panel_init (CcRegionPanel * self)
{
	CcRegionPanelPrivate *priv;
	GtkWidget *prefs_widget;
	const char *desktop;
	GError *error = NULL;

	priv = self->priv = REGION_PANEL_PRIVATE (self);

	desktop = g_getenv ("XDG_CURRENT_DESKTOP");

	priv->builder = gtk_builder_new ();

	gtk_builder_add_from_file (priv->builder,
				   GNOMECC_UI_DIR "/gnome-region-panel.ui",
				   &error);
	if (error != NULL) {
		g_warning ("Error loading UI file: %s", error->message);
		g_error_free (error);
		return;
	}

	if (!g_strcmp0 (desktop, "GNOME")) {
		prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
								     "region_notebook");
	} else {
		prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
								     "vbox1");
	}

	gtk_widget_set_size_request (GTK_WIDGET (prefs_widget), -1, 400);

	gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));

	setup_xkb_tabs (priv->builder);
	if (!g_strcmp0 (desktop, "GNOME")) {
		setup_language (priv->builder);
		setup_formats (priv->builder);
		setup_system (priv->builder);
	}
}
static void
setup_dialog (GtkBuilder * dialog)
{
	gchar *monitor;

	g_settings_bind (keyboard_settings,
					 "repeat",
					 WID ("repeat_toggle"),
					 "active",
					 G_SETTINGS_BIND_DEFAULT);
	g_settings_bind (keyboard_settings,
					 "repeat",
					 WID ("repeat_table"),
					 "sensitive",
					 G_SETTINGS_BIND_DEFAULT);

	g_settings_bind (keyboard_settings,
					 "delay",
					 gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_delay_scale"))),
					 "value",
					 G_SETTINGS_BIND_DEFAULT);
	g_settings_bind (keyboard_settings,
					 "rate",
					 gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_speed_scale"))),
					 "value",
					 G_SETTINGS_BIND_DEFAULT);

	g_settings_bind (interface_settings,
					 "cursor-blink",
					 WID ("cursor_toggle"),
					 "active",
					 G_SETTINGS_BIND_DEFAULT);
	g_settings_bind (interface_settings,
					 "cursor-blink",
					 WID ("cursor_hbox"),
					 "sensitive",
					 G_SETTINGS_BIND_DEFAULT);
	g_settings_bind (interface_settings,
					 "cursor-blink-time",
					 gtk_range_get_adjustment (GTK_RANGE (WID ("cursor_blink_time_scale"))),
					 "value",
					 G_SETTINGS_BIND_DEFAULT);

	/* Ergonomics */
	monitor = g_find_program_in_path ("mate-typing-monitor");
	if (monitor != NULL) {
		g_free (monitor);

		g_settings_bind (typing_break_settings,
						 "enabled",
						 WID ("break_enabled_toggle"),
						 "active",
						 G_SETTINGS_BIND_DEFAULT);
		g_settings_bind (typing_break_settings,
						 "enabled",
						 WID ("break_details_table"),
						 "sensitive",
						 G_SETTINGS_BIND_DEFAULT);
		g_settings_bind (typing_break_settings,
						 "type-time",
						 WID ("break_enabled_spin"),
						 "value",
						 G_SETTINGS_BIND_DEFAULT);
		g_settings_bind (typing_break_settings,
						 "break-time",
						 WID ("break_interval_spin"),
						 "value",
						 G_SETTINGS_BIND_DEFAULT);
		g_settings_bind (typing_break_settings,
						 "allow-postpone",
						 WID ("break_postponement_toggle"),
						 "active",
						 G_SETTINGS_BIND_DEFAULT);

	} else {
		/* don't show the typing break tab if the daemon is not available */
		GtkNotebook *nb = GTK_NOTEBOOK (WID ("keyboard_notebook"));
		gint tb_page = gtk_notebook_page_num (nb, WID ("break_enabled_toggle"));
		gtk_notebook_remove_page (nb, tb_page);
	}

#if !GTK_CHECK_VERSION (3, 0, 0)
	gtk_range_set_update_policy (GTK_RANGE (WID ("cursor_blink_time_scale")), GTK_UPDATE_DISCONTINUOUS);
#endif

	g_signal_connect (WID ("keyboard_dialog"), "response",
			  (GCallback) dialog_response, NULL);

	setup_xkb_tabs (dialog);
	setup_a11y_tabs (dialog);
}