summaryrefslogtreecommitdiff
path: root/capplets/windows/mate-metacity-support.c
blob: 079b18d10affa8f84f299ac743f7cf202adebd57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* mate-metacity-support.c
 * Copyright (C) 2014 Stefano Karapetsas
 *
 * Written by: Stefano Karapetsas <stefano@karapetsas.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

#include <glib/gi18n.h>
#include <gio/gio.h>
#include <gtk/gtk.h>

#define METACITY_SCHEMA "org.gnome.metacity"
#define COMPOSITING_KEY "compositing-manager"

void
mate_metacity_config_tool ()
{
    GSettings *settings;
    GtkDialog *dialog;
    GtkWidget *vbox;
    GtkWidget *widget;
    gchar *str;

    settings = g_settings_new (METACITY_SCHEMA);

    dialog = GTK_DIALOG (gtk_dialog_new_with_buttons(_("Metacity Preferences"),
                                                     NULL,
                                                     GTK_DIALOG_MODAL,
                                                     GTK_STOCK_CLOSE,
                                                     GTK_RESPONSE_CLOSE,
                                                     NULL));
    gtk_window_set_icon_name (GTK_WINDOW (dialog), "preferences-system-windows");
    gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 150);

    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);

    str = g_strdup_printf ("<b>%s</b>", _("Compositing Manager"));
    widget = gtk_label_new (str);
    g_free (str);
    gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
    gtk_label_set_xalign (GTK_LABEL (widget), 0.0);
#else
    gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
#endif
    gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);

    widget = gtk_check_button_new_with_label (_("Enable software _compositing window manager"));
    gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
    g_settings_bind (settings, COMPOSITING_KEY, widget, "active", G_SETTINGS_BIND_DEFAULT);

    gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), vbox, TRUE, TRUE, 0);

    g_signal_connect (dialog, "response", G_CALLBACK (gtk_main_quit), dialog);
    gtk_widget_show_all (GTK_WIDGET (dialog));
    gtk_main ();

    g_object_unref (settings);
}