diff --git a/configure.ac b/configure.ac index b6ae3ce41..eb521e06a 100644 --- a/configure.ac +++ b/configure.ac @@ -369,6 +369,8 @@ panels/sound/data/icons/scalable/Makefile panels/sound/data/icons/scalable/apps/Makefile panels/sound/data/icons/scalable/devices/Makefile panels/sound/data/sounds/Makefile +panels/screen/Makefile +panels/screen/gnome-screen-panel.desktop.in panels/universal-access/Makefile panels/universal-access/gnome-universal-access-panel.desktop.in panels/user-accounts/Makefile diff --git a/panels/Makefile.am b/panels/Makefile.am index e71040e95..69bce7d6e 100644 --- a/panels/Makefile.am +++ b/panels/Makefile.am @@ -1,5 +1,6 @@ SUBDIRS= \ background \ + screen \ display \ mouse \ region \ diff --git a/panels/screen/Makefile.am b/panels/screen/Makefile.am new file mode 100644 index 000000000..8c0694aa8 --- /dev/null +++ b/panels/screen/Makefile.am @@ -0,0 +1,31 @@ +INCLUDES = \ + $(PANEL_CFLAGS) \ + $(GNOMECC_CAPPLETS_CFLAGS) \ + -DGNOMECC_UI_DIR="\"$(uidir)\"" \ + -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ + -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \ + $(NULL) + +ccpanelsdir = $(PANELS_DIR) +ccpanels_LTLIBRARIES = libscreen.la + +libscreen_la_SOURCES = \ + screen-module.c \ + cc-screen-panel.c \ + cc-screen-panel.h + +libscreen_la_LIBADD = $(PANEL_LIBS) +libscreen_la_LDFLAGS = $(PANEL_LDFLAGS) + +uidir = $(pkgdatadir)/ui +dist_ui_DATA = screen.ui + +@INTLTOOL_DESKTOP_RULE@ + +desktopdir = $(datadir)/applications +desktop_in_files = gnome-screen-panel.desktop.in +desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) + +CLEANFILES = $(desktop_in_files) $(desktop_DATA) + +-include $(top_srcdir)/git.mk diff --git a/panels/screen/cc-screen-panel.c b/panels/screen/cc-screen-panel.c new file mode 100644 index 000000000..e79820bc2 --- /dev/null +++ b/panels/screen/cc-screen-panel.c @@ -0,0 +1,153 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2010 Red Hat, Inc + * Copyright (C) 2008 William Jon McCann + * + * 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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include "cc-screen-panel.h" + +#define WID(b, w) (GtkWidget *) gtk_builder_get_object (b, w) + +G_DEFINE_DYNAMIC_TYPE (CcScreenPanel, cc_screen_panel, CC_TYPE_PANEL) + +#define SCREEN_PANEL_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SCREEN_PANEL, CcScreenPanelPrivate)) + +struct _CcScreenPanelPrivate +{ + GSettings *lock_settings; +}; + + +static void +cc_screen_panel_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +cc_screen_panel_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +cc_screen_panel_dispose (GObject *object) +{ + CcScreenPanelPrivate *priv = CC_SCREEN_PANEL (object)->priv; + + if (priv->lock_settings) + { + g_object_unref (priv->lock_settings); + priv->lock_settings = NULL; + } + + G_OBJECT_CLASS (cc_screen_panel_parent_class)->dispose (object); +} + +static void +cc_screen_panel_finalize (GObject *object) +{ + G_OBJECT_CLASS (cc_screen_panel_parent_class)->finalize (object); +} + +static void +on_lock_settings_changed (GSettings *settings, + const char *key, + CcScreenPanel *panel) +{ +} + +static void +cc_screen_panel_class_init (CcScreenPanelClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (CcScreenPanelPrivate)); + + object_class->get_property = cc_screen_panel_get_property; + object_class->set_property = cc_screen_panel_set_property; + object_class->dispose = cc_screen_panel_dispose; + object_class->finalize = cc_screen_panel_finalize; +} + +static void +cc_screen_panel_class_finalize (CcScreenPanelClass *klass) +{ +} + +static void +cc_screen_panel_init (CcScreenPanel *self) +{ + GError *error; + GtkBuilder *builder; + GtkWidget *widget; + + self->priv = SCREEN_PANEL_PRIVATE (self); + + builder = gtk_builder_new (); + + error = NULL; + gtk_builder_add_from_file (builder, + GNOMECC_UI_DIR "/screen.ui", + &error); + + if (error != NULL) + { + g_warning ("Could not load interface file: %s", error->message); + g_error_free (error); + + g_object_unref (builder); + + return; + } + + self->priv->lock_settings = g_settings_new ("org.gnome.desktop.interface"); + g_signal_connect (self->priv->lock_settings, + "changed", + G_CALLBACK (on_lock_settings_changed), + self); + + widget = WID (builder, "screen_vbox"); + + gtk_widget_reparent (widget, (GtkWidget *) self); +} + +void +cc_screen_panel_register (GIOModule *module) +{ + cc_screen_panel_register_type (G_TYPE_MODULE (module)); + g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT, + CC_TYPE_SCREEN_PANEL, + "screen", 0); +} + diff --git a/panels/screen/cc-screen-panel.h b/panels/screen/cc-screen-panel.h new file mode 100644 index 000000000..851a20795 --- /dev/null +++ b/panels/screen/cc-screen-panel.h @@ -0,0 +1,73 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2010 Red Hat, Inc + * + * 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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + + +#ifndef _CC_SCREEN_PANEL_H +#define _CC_SCREEN_PANEL_H + +#include + +G_BEGIN_DECLS + +#define CC_TYPE_SCREEN_PANEL cc_screen_panel_get_type() + +#define CC_SCREEN_PANEL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + CC_TYPE_SCREEN_PANEL, CcScreenPanel)) + +#define CC_SCREEN_PANEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + CC_TYPE_SCREEN_PANEL, CcScreenPanelClass)) + +#define CC_IS_SCREEN_PANEL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + CC_TYPE_SCREEN_PANEL)) + +#define CC_IS_SCREEN_PANEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + CC_TYPE_SCREEN_PANEL)) + +#define CC_SCREEN_PANEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + CC_TYPE_SCREEN_PANEL, CcScreenPanelClass)) + +typedef struct _CcScreenPanel CcScreenPanel; +typedef struct _CcScreenPanelClass CcScreenPanelClass; +typedef struct _CcScreenPanelPrivate CcScreenPanelPrivate; + +struct _CcScreenPanel +{ + CcPanel parent; + + CcScreenPanelPrivate *priv; +}; + +struct _CcScreenPanelClass +{ + CcPanelClass parent_class; +}; + +GType cc_screen_panel_get_type (void) G_GNUC_CONST; + +void cc_screen_panel_register (GIOModule *module); + +G_END_DECLS + +#endif /* _CC_SCREEN_PANEL_H */ diff --git a/panels/screen/gnome-screen-panel.desktop.in.in b/panels/screen/gnome-screen-panel.desktop.in.in new file mode 100644 index 000000000..51b7bc060 --- /dev/null +++ b/panels/screen/gnome-screen-panel.desktop.in.in @@ -0,0 +1,15 @@ +[Desktop Entry] +_Name=Screen +_Comment=Screen brightness and lock settings +Exec=gnome-control-center screen +Icon=preferences-desktop-screensaver +Terminal=false +Type=Application +StartupNotify=true +Categories=GNOME;GTK;Settings;DesktopSettings;X-GNOME-Settings-Panel; +OnlyShowIn=GNOME; +X-GNOME-Bugzilla-Bugzilla=GNOME +X-GNOME-Bugzilla-Product=gnome-control-center +X-GNOME-Bugzilla-Component=screen +X-GNOME-Bugzilla-Version=@VERSION@ +X-GNOME-Settings-Panel=screen diff --git a/panels/screen/screen-module.c b/panels/screen/screen-module.c new file mode 100644 index 000000000..afa67dc0f --- /dev/null +++ b/panels/screen/screen-module.c @@ -0,0 +1,41 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2010 Red Hat, Inc + * + * 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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + */ + +#include + +#include "cc-screen-panel.h" + +#include + +void +g_io_module_load (GIOModule *module) +{ + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + + /* register the panel */ + cc_screen_panel_register (module); +} + +void +g_io_module_unload (GIOModule *module) +{ +} diff --git a/panels/screen/screen.ui b/panels/screen/screen.ui new file mode 100644 index 000000000..c31cd03a2 --- /dev/null +++ b/panels/screen/screen.ui @@ -0,0 +1,350 @@ + + + + + + + + + + + + + + Screen turns off + 0 + + + 1 minute + 60 + + + 2 minutes + 120 + + + 3 minutes + 180 + + + 5 minutes + 300 + + + 10 minutes + 600 + + + 30 minutes + 1800 + + + 1 hour + 3600 + + + + + + + + + + + + + 1 minute + 60 + + + 2 minutes + 120 + + + 3 minutes + 180 + + + 5 minutes + 300 + + + 10 minutes + 600 + + + 30 minutes + 1800 + + + 1 hour + 3600 + + + + + + + True + vertical + + + True + 10 + vertical + 12 + + + True + 0 + none + + + True + 12 + + + True + vertical + 6 + + + True + True + 0 + False + bottom + + + 0 + + + + + Automatically dim + True + True + False + True + + + False + 1 + + + + + True + 6 + + + True + 0 + Turn off after: + + + False + False + 0 + + + + + True + screen_brightness_liststore + + + False + False + 1 + + + + + False + False + 2 + + + + + + + + + True + Brightness + True + + + + + + + + False + 0 + + + + + True + 0 + none + + + True + 12 + + + True + vertical + 6 + + + True + + + On + True + True + False + True + True + + + False + 0 + + + + + Off + True + True + False + True + screen_lock_on_radiobutton + + + False + 1 + + + + + False + False + 0 + + + + + True + 6 + + + True + 0 + Lock screen after: + + + False + False + 0 + + + + + True + lock_liststore + + + False + False + 1 + + + + + False + False + 1 + + + + + True + + + Don't lock when at home + True + True + False + True + + + 0 + + + + + Locations... + True + True + True + none + right + http://glade.gnome.org + + + False + 1 + + + + + 2 + + + + + + + + + True + Lock + True + + + + + + + + False + 1 + + + + + 0 + + + + + + + + + + + + + + + + + +