Commit a6e64f1a authored by William Jon McCann's avatar William Jon McCann

[screen] Add screen brightness and lock panel

Not yet wired up.
parent c09c82b2
......@@ -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
......
SUBDIRS= \
background \
screen \
display \
mouse \
region \
......
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
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2010 Red Hat, Inc
* Copyright (C) 2008 William Jon McCann <jmccann@redhat.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 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);
}
/* -*- 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 <libgnome-control-center/cc-panel.h>
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 */
[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
/* -*- 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 <config.h>
#include "cc-screen-panel.h"
#include <glib/gi18n-lib.h>
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)
{
}
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkListStore" id="lock_liststore">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name value -->
<column type="gint"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Screen turns off</col>
<col id="1">0</col>
</row>
<row>
<col id="0" translatable="yes">1 minute</col>
<col id="1">60</col>
</row>
<row>
<col id="0" translatable="yes">2 minutes</col>
<col id="1">120</col>
</row>
<row>
<col id="0" translatable="yes">3 minutes</col>
<col id="1">180</col>
</row>
<row>
<col id="0" translatable="yes">5 minutes</col>
<col id="1">300</col>
</row>
<row>
<col id="0" translatable="yes">10 minutes</col>
<col id="1">600</col>
</row>
<row>
<col id="0" translatable="yes">30 minutes</col>
<col id="1">1800</col>
</row>
<row>
<col id="0" translatable="yes">1 hour</col>
<col id="1">3600</col>
</row>
</data>
</object>
<object class="GtkListStore" id="screen_brightness_liststore">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name value -->
<column type="gint"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">1 minute</col>
<col id="1">60</col>
</row>
<row>
<col id="0" translatable="yes">2 minutes</col>
<col id="1">120</col>
</row>
<row>
<col id="0" translatable="yes">3 minutes</col>
<col id="1">180</col>
</row>
<row>
<col id="0" translatable="yes">5 minutes</col>
<col id="1">300</col>
</row>
<row>
<col id="0" translatable="yes">10 minutes</col>
<col id="1">600</col>
</row>
<row>
<col id="0" translatable="yes">30 minutes</col>
<col id="1">1800</col>
</row>
<row>
<col id="0" translatable="yes">1 hour</col>
<col id="1">3600</col>
</row>
</data>
</object>
<object class="GtkWindow" id="window1">
<child>
<object class="GtkVBox" id="screen_vbox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkVBox" id="vbox9">
<property name="visible">True</property>
<property name="border_width">10</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkHScale" id="screen_brightness_hscale">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="digits">0</property>
<property name="draw_value">False</property>
<property name="value_pos">bottom</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="screen_auto_reduce_checkbutton">
<property name="label" translatable="yes">Automatically dim</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox9">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="turn_off_after_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Turn off after:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="screen_brightness_combobox">
<property name="visible">True</property>
<property name="model">screen_brightness_liststore</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">Brightness</property>
<property name="use_markup">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<child>
<object class="GtkRadioButton" id="screen_lock_on_radiobutton">
<property name="label" translatable="yes">On</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="screen_lock_off_radiobutton">
<property name="label" translatable="yes">Off</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">screen_lock_on_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="lock_screen_after_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Lock screen after:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="screen_lock_combobox">
<property name="visible">True</property>
<property name="model">lock_liststore</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<child>
<object class="GtkCheckButton" id="screen_lock_not_home_checkbutton">
<property name="label" translatable="yes">Don't lock when at home</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLinkButton" id="screen_locations_linkbutton">
<property name="label" translatable="yes">Locations...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<property name="image_position">right</property>
<property name="uri">http://glade.gnome.org</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>