diff options
author | Stefano Karapetsas <[email protected]> | 2014-02-11 12:39:41 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-02-11 12:39:41 +0100 |
commit | b6a1f74ebf64a116ae92e6ff88b9a8a398113e2a (patch) | |
tree | 3ab91641dfd6e93a376fae6122690acdcec946cc | |
parent | e3e3007adbccea95e9619aa5272fe98ff3351453 (diff) | |
download | mate-control-center-b6a1f74ebf64a116ae92e6ff88b9a8a398113e2a.tar.bz2 mate-control-center-b6a1f74ebf64a116ae92e6ff88b9a8a398113e2a.tar.xz |
windows: Add metacity support
-rw-r--r-- | capplets/windows/Makefile.am | 4 | ||||
-rw-r--r-- | capplets/windows/mate-metacity-support.c | 69 | ||||
-rw-r--r-- | capplets/windows/mate-metacity-support.h | 27 | ||||
-rw-r--r-- | capplets/windows/mate-window-properties.c | 13 | ||||
-rw-r--r-- | po/POTFILES.in | 1 |
5 files changed, 113 insertions, 1 deletions
diff --git a/capplets/windows/Makefile.am b/capplets/windows/Makefile.am index 1f50f073..1327573e 100644 --- a/capplets/windows/Makefile.am +++ b/capplets/windows/Makefile.am @@ -6,7 +6,9 @@ bin_PROGRAMS = mate-window-properties mate_window_properties_LDADD = $(MATECC_CAPPLETS_LIBS) \ $(top_builddir)/libwindow-settings/libmate-window-settings.la -mate_window_properties_SOURCES = \ +mate_window_properties_SOURCES = \ + mate-metacity-support.h \ + mate-metacity-support.c \ mate-window-properties.c @INTLTOOL_DESKTOP_RULE@ diff --git a/capplets/windows/mate-metacity-support.c b/capplets/windows/mate-metacity-support.c new file mode 100644 index 00000000..554f5860 --- /dev/null +++ b/capplets/windows/mate-metacity-support.c @@ -0,0 +1,69 @@ +/* mate-metacity-support.c + * Copyright (C) 2014 Stefano Karapetsas + * + * Written by: Stefano Karapetsas <[email protected]> + * + * 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_vbox_new (FALSE, 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); + gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5); + 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); +} diff --git a/capplets/windows/mate-metacity-support.h b/capplets/windows/mate-metacity-support.h new file mode 100644 index 00000000..1e19f504 --- /dev/null +++ b/capplets/windows/mate-metacity-support.h @@ -0,0 +1,27 @@ +/* metacity.h + * Copyright (C) 2014 Stefano Karapetsas + * + * Written by: Stefano Karapetsas <[email protected]> + * + * 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. + */ + +#ifndef MATE_METACITY_SUPPORT_H +#define MATE_METACITY_SUPPORT_H + +void mate_metacity_config_tool (void); + +#endif /* MATE_METACITY_SUPPORT_H */ diff --git a/capplets/windows/mate-window-properties.c b/capplets/windows/mate-window-properties.c index c653c9db..d51895b7 100644 --- a/capplets/windows/mate-window-properties.c +++ b/capplets/windows/mate-window-properties.c @@ -32,6 +32,10 @@ #include <string.h> #include <mate-wm-manager.h> +#include <gdk/gdkx.h> + +#include "mate-metacity-support.h" +#include "wm-common.h" #include "capplet-util.h" typedef struct @@ -426,6 +430,7 @@ main (int argc, char **argv) MateWMSettings new_settings; GtkBuilder *builder; GError *error = NULL; + const char *name; int rc = 0; int i; @@ -442,6 +447,14 @@ main (int argc, char **argv) current_wm = mate_wm_manager_get_current (screen); if (current_wm == NULL) { + /* metacity support */ + name = gdk_x11_screen_get_window_manager_name (screen); + if (g_strcmp0 (name, WM_COMMON_METACITY) == 0) { + mate_metacity_config_tool (); + return 0; + } + + /* other window managers */ try_spawn_config_tool (screen); goto out; } diff --git a/po/POTFILES.in b/po/POTFILES.in index fc6d887f..e65ed027 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -67,6 +67,7 @@ capplets/mouse/mate-settings-mouse.desktop.in.in capplets/network/mate-network-properties.c capplets/network/mate-network-properties.desktop.in.in [type: gettext/glade]capplets/network/mate-network-properties.ui +capplets/windows/mate-metacity-support.c capplets/windows/mate-window-properties.c [type: gettext/glade]capplets/windows/mate-window-properties.ui capplets/windows/mate-window-properties.desktop.in.in |