Compare commits

...

7 Commits

Author SHA1 Message Date
Matthias Clasen
e73c7348c1 Remove the run-only-once implementation
This will be handled differently when we move to gdm.
2011-05-17 09:39:21 -04:00
Matthias Clasen
46e31c67ab Replace set-timezone.[hc] by gdbus-codegen-erated code
This reduces the amound of code copied between the panel
and the setup client and gives us nicer code. We should
probably do this back in the panel, too.
2011-05-16 23:32:12 -04:00
Matthias Clasen
5cb94d7e9d Add an 'Add Account' button
Doesn't do anything yet...
2011-05-13 08:53:47 -04:00
Matthias Clasen
bb194eef06 Initial implementation of the location page
Search and map work; geoip support still missing.
2011-05-13 07:44:18 -04:00
Matthias Clasen
7f27d05172 Remove debug spew 2011-05-13 07:43:52 -04:00
Matthias Clasen
a693366f8b More complete
With this commit, the network and account pages are basically
functional. The copy-paste of the network cell renderers as well
as various bits of the network and user panels should perhaps
be reworked, longer-term.
2011-05-11 00:25:39 -04:00
Matthias Clasen
7352db74ba Start of a first-time-setup tool
This is essentially just a skeleton at this point.
2011-05-09 10:58:45 -04:00
19 changed files with 7568 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
SUBDIRS = po libgnome-control-center shell panels help
DIST_SUBDIRS = po help shell panels libgnome-control-center
SUBDIRS = po libgnome-control-center shell panels setup help
DIST_SUBDIRS = po help shell panels setup libgnome-control-center
DISTCLEANFILES = \
gnome-doc-utils.make

View File

@@ -91,6 +91,7 @@ PKG_CHECK_MODULES(LIBGNOME_CONTROL_CENTER, $COMMON_MODULES gconf-2.0)
PKG_CHECK_MODULES(LIBLANGUAGE, $COMMON_MODULES gnome-desktop-3.0)
PKG_CHECK_MODULES(LIBSHORTCUTS, $COMMON_MODULES x11)
PKG_CHECK_MODULES(SHELL, $COMMON_MODULES libgnome-menu gio-unix-2.0)
PKG_CHECK_MODULES(SETUP, $COMMON_MODULES accountsservice gweather-3.0)
PKG_CHECK_MODULES(BACKGROUND_PANEL, $COMMON_MODULES libxml-2.0 gnome-desktop-3.0
gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION)
PKG_CHECK_MODULES(DATETIME_PANEL, $COMMON_MODULES dbus-glib-1
@@ -200,6 +201,8 @@ fi
AC_SUBST(GLIB_GENMARSHAL)
GLIB_GSETTINGS
dnl =======================================
dnl Panels
dnl =======================================
@@ -370,6 +373,7 @@ panels/user-accounts/data/icons/Makefile
po/Makefile.in
shell/Makefile
shell/gnome-control-center.desktop.in
setup/Makefile
])
dnl due to a bug in intltool we need to expand something from the root last control-center.spec

38
setup/Makefile.am Normal file
View File

@@ -0,0 +1,38 @@
INCLUDES = \
$(SETUP_CFLAGS) \
$(NETWORK_MANAGER_CFLAGS)
LIBS = \
$(SETUP_LIBS) \
$(NETWORK_MANAGER_LIBS)
bin_PROGRAMS = gnome-setup-assistant
gnome_setup_assistant_SOURCES = \
gnome-setup-assistant.c \
panel-cell-renderer-signal.c panel-cell-renderer-signal.h \
panel-cell-renderer-mode.c panel-cell-renderer-mode.h \
panel-cell-renderer-security.c panel-cell-renderer-security.h \
cc-timezone-map.c cc-timezone-map.h \
tz.c tz.h \
dtm.c dtm.h
AM_CPPFLAGS = \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-DUIDIR="\"$(uidir)\"" \
-DDATADIR="\"$(pkgdatadir)/ui/datetime\""
uidir = $(pkgdatadir)/ui/setup
ui_DATA = \
setup.ui
welcome-image.jpg
sysdir = $(datadir)/applications
sys_DATA = gnome-setup-assistant.desktop
EXTRA_DIST = \
$(ui_DATA) \
$(sys_DATA)
-include $(top_srcdir)/git.mk

613
setup/cc-timezone-map.c Normal file
View File

@@ -0,0 +1,613 @@
/*
* Copyright (C) 2010 Intel, Inc
*
* Portions from Ubiquity, Copyright (C) 2009 Canonical Ltd.
* Written by Evan Dandrea <evand@ubuntu.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.
*
* Author: Thomas Wood <thomas.wood@intel.com>
*
*/
#include "cc-timezone-map.h"
#include <math.h>
#include <string.h>
#include "tz.h"
G_DEFINE_TYPE (CcTimezoneMap, cc_timezone_map, GTK_TYPE_WIDGET)
#define TIMEZONE_MAP_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_TIMEZONE_MAP, CcTimezoneMapPrivate))
typedef struct
{
gdouble offset;
guchar red;
guchar green;
guchar blue;
guchar alpha;
} CcTimezoneMapOffset;
struct _CcTimezoneMapPrivate
{
GdkPixbuf *orig_background;
GdkPixbuf *orig_color_map;
GdkPixbuf *background;
GdkPixbuf *color_map;
guchar *visible_map_pixels;
gint visible_map_rowstride;
gdouble selected_offset;
TzDB *tzdb;
TzLocation *location;
};
enum
{
LOCATION_CHANGED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
static CcTimezoneMapOffset color_codes[] =
{
{-11.0, 43, 0, 0, 255 },
{-10.0, 85, 0, 0, 255 },
{-9.5, 102, 255, 0, 255 },
{-9.0, 128, 0, 0, 255 },
{-8.0, 170, 0, 0, 255 },
{-7.0, 212, 0, 0, 255 },
{-6.0, 255, 0, 1, 255 }, // north
{-6.0, 255, 0, 0, 255 }, // south
{-5.0, 255, 42, 42, 255 },
{-4.5, 192, 255, 0, 255 },
{-4.0, 255, 85, 85, 255 },
{-3.5, 0, 255, 0, 255 },
{-3.0, 255, 128, 128, 255 },
{-2.0, 255, 170, 170, 255 },
{-1.0, 255, 213, 213, 255 },
{0.0, 43, 17, 0, 255 },
{1.0, 85, 34, 0, 255 },
{2.0, 128, 51, 0, 255 },
{3.0, 170, 68, 0, 255 },
{3.5, 0, 255, 102, 255 },
{4.0, 212, 85, 0, 255 },
{4.5, 0, 204, 255, 255 },
{5.0, 255, 102, 0, 255 },
{5.5, 0, 102, 255, 255 },
{5.75, 0, 238, 207, 247 },
{6.0, 255, 127, 42, 255 },
{6.5, 204, 0, 254, 254 },
{7.0, 255, 153, 85, 255 },
{8.0, 255, 179, 128, 255 },
{9.0, 255, 204, 170, 255 },
{9.5, 170, 0, 68, 250 },
{10.0, 255, 230, 213, 255 },
{10.5, 212, 124, 21, 250 },
{11.0, 212, 170, 0, 255 },
{11.5, 249, 25, 87, 253 },
{12.0, 255, 204, 0, 255 },
{12.75, 254, 74, 100, 248 },
{13.0, 255, 85, 153, 250 },
{-100, 0, 0, 0, 0 }
};
static void
cc_timezone_map_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_timezone_map_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_timezone_map_dispose (GObject *object)
{
CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (object)->priv;
if (priv->orig_background)
{
g_object_unref (priv->orig_background);
priv->orig_background = NULL;
}
if (priv->orig_color_map)
{
g_object_unref (priv->orig_color_map);
priv->orig_color_map = NULL;
}
if (priv->background)
{
g_object_unref (priv->background);
priv->background = NULL;
}
if (priv->color_map)
{
g_object_unref (priv->color_map);
priv->color_map = NULL;
priv->visible_map_pixels = NULL;
priv->visible_map_rowstride = 0;
}
G_OBJECT_CLASS (cc_timezone_map_parent_class)->dispose (object);
}
static void
cc_timezone_map_finalize (GObject *object)
{
CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (object)->priv;
if (priv->tzdb)
{
tz_db_free (priv->tzdb);
priv->tzdb = NULL;
}
G_OBJECT_CLASS (cc_timezone_map_parent_class)->finalize (object);
}
/* GtkWidget functions */
static void
cc_timezone_map_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
/* choose a minimum size small enough to prevent the window
* from growing horizontally
*/
if (minimum != NULL)
*minimum = 300;
if (natural != NULL)
*natural = 300;
}
static void
cc_timezone_map_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
gint size;
/* The + 20 here is a slight tweak to make the map fill the
* panel better without causing horizontal growing
*/
size = 300 * gdk_pixbuf_get_height (priv->orig_background) / gdk_pixbuf_get_width (priv->orig_background) + 20;
if (minimum != NULL)
*minimum = size;
if (natural != NULL)
*natural = size;
}
static void
cc_timezone_map_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
if (priv->background)
g_object_unref (priv->background);
priv->background = gdk_pixbuf_scale_simple (priv->orig_background,
allocation->width,
allocation->height,
GDK_INTERP_BILINEAR);
if (priv->color_map)
g_object_unref (priv->color_map);
priv->color_map = gdk_pixbuf_scale_simple (priv->orig_color_map,
allocation->width,
allocation->height,
GDK_INTERP_BILINEAR);
priv->visible_map_pixels = gdk_pixbuf_get_pixels (priv->color_map);
priv->visible_map_rowstride = gdk_pixbuf_get_rowstride (priv->color_map);
GTK_WIDGET_CLASS (cc_timezone_map_parent_class)->size_allocate (widget,
allocation);
}
static void
cc_timezone_map_realize (GtkWidget *widget)
{
GdkWindowAttr attr = { 0, };
GtkAllocation allocation;
GdkCursor *cursor;
GdkWindow *window;
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_set_realized (widget, TRUE);
attr.window_type = GDK_WINDOW_CHILD;
attr.wclass = GDK_INPUT_OUTPUT;
attr.width = allocation.width;
attr.height = allocation.height;
attr.x = allocation.x;
attr.y = allocation.y;
attr.event_mask = gtk_widget_get_events (widget)
| GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
window = gdk_window_new (gtk_widget_get_parent_window (widget), &attr,
GDK_WA_X | GDK_WA_Y);
cursor = gdk_cursor_new (GDK_HAND2);
gdk_window_set_cursor (window, cursor);
gdk_window_set_user_data (window, widget);
gtk_widget_set_window (widget, window);
}
static gdouble
convert_longtitude_to_x (gdouble longitude, gint map_width)
{
const gdouble xdeg_offset = -6;
gdouble x;
x = (map_width * (180.0 + longitude) / 360.0)
+ (map_width * xdeg_offset / 180.0);
return x;
}
static gdouble
radians (gdouble degrees)
{
return (degrees / 360.0) * G_PI * 2;
}
static gdouble
convert_latitude_to_y (gdouble latitude, gdouble map_height)
{
gdouble bottom_lat = -59;
gdouble top_lat = 81;
gdouble top_per, y, full_range, top_offset, map_range;
top_per = top_lat / 180.0;
y = 1.25 * log (tan (G_PI_4 + 0.4 * radians (latitude)));
full_range = 4.6068250867599998;
top_offset = full_range * top_per;
map_range = fabs (1.25 * log (tan (G_PI_4 + 0.4 * radians (bottom_lat))) - top_offset);
y = fabs (y - top_offset);
y = y / map_range;
y = y * map_height;
return y;
}
static gboolean
cc_timezone_map_draw (GtkWidget *widget,
cairo_t *cr)
{
CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
GdkPixbuf *hilight, *orig_hilight, *pin;
GtkAllocation alloc;
gchar *file;
GError *err = NULL;
gdouble pointx, pointy;
char buf[16];
gtk_widget_get_allocation (widget, &alloc);
/* paint background */
gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0);
cairo_paint (cr);
/* paint hilight */
file = g_strdup_printf (DATADIR "/timezone_%s.png",
g_ascii_formatd (buf, sizeof (buf),
"%g", priv->selected_offset));
orig_hilight = gdk_pixbuf_new_from_file (file, &err);
g_free (file);
file = NULL;
if (!orig_hilight)
{
g_warning ("Could not load hilight: %s",
(err) ? err->message : "Unknown Error");
if (err)
g_clear_error (&err);
}
else
{
hilight = gdk_pixbuf_scale_simple (orig_hilight, alloc.width,
alloc.height, GDK_INTERP_BILINEAR);
gdk_cairo_set_source_pixbuf (cr, hilight, 0, 0);
cairo_paint (cr);
g_object_unref (hilight);
g_object_unref (orig_hilight);
}
/* load pin icon */
pin = gdk_pixbuf_new_from_file (DATADIR "/pin.png", &err);
if (err)
{
g_warning ("Could not load pin icon: %s", err->message);
g_clear_error (&err);
}
if (priv->location)
{
pointx = convert_longtitude_to_x (priv->location->longitude, alloc.width);
pointy = convert_latitude_to_y (priv->location->latitude, alloc.height);
if (pointy > alloc.height)
pointy = alloc.height;
if (pin)
{
gdk_cairo_set_source_pixbuf (cr, pin, pointx - 8, pointy - 14);
cairo_paint (cr);
}
}
if (pin)
{
g_object_unref (pin);
}
return TRUE;
}
static void
cc_timezone_map_class_init (CcTimezoneMapClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
g_type_class_add_private (klass, sizeof (CcTimezoneMapPrivate));
object_class->get_property = cc_timezone_map_get_property;
object_class->set_property = cc_timezone_map_set_property;
object_class->dispose = cc_timezone_map_dispose;
object_class->finalize = cc_timezone_map_finalize;
widget_class->get_preferred_width = cc_timezone_map_get_preferred_width;
widget_class->get_preferred_height = cc_timezone_map_get_preferred_height;
widget_class->size_allocate = cc_timezone_map_size_allocate;
widget_class->realize = cc_timezone_map_realize;
widget_class->draw = cc_timezone_map_draw;
signals[LOCATION_CHANGED] = g_signal_new ("location-changed",
CC_TYPE_TIMEZONE_MAP,
G_SIGNAL_RUN_FIRST,
0,
NULL,
NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
}
static gint
sort_locations (TzLocation *a,
TzLocation *b)
{
if (a->dist > b->dist)
return 1;
if (a->dist < b->dist)
return -1;
return 0;
}
static void
set_location (CcTimezoneMap *map,
TzLocation *location)
{
CcTimezoneMapPrivate *priv = map->priv;
TzInfo *info;
priv->location = location;
info = tz_info_from_location (priv->location);
priv->selected_offset = tz_location_get_utc_offset (priv->location)
/ (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0);
g_signal_emit (map, signals[LOCATION_CHANGED], 0, priv->location);
tz_info_free (info);
}
static gboolean
button_press_event (GtkWidget *widget,
GdkEventButton *event)
{
CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
gint x, y;
guchar r, g, b, a;
guchar *pixels;
gint rowstride;
gint i;
const GPtrArray *array;
gint width, height;
GList *distances = NULL;
GtkAllocation alloc;
x = event->x;
y = event->y;
rowstride = priv->visible_map_rowstride;
pixels = priv->visible_map_pixels;
r = pixels[(rowstride * y + x * 4)];
g = pixels[(rowstride * y + x * 4) + 1];
b = pixels[(rowstride * y + x * 4) + 2];
a = pixels[(rowstride * y + x * 4) + 3];
for (i = 0; color_codes[i].offset != -100; i++)
{
if (color_codes[i].red == r && color_codes[i].green == g
&& color_codes[i].blue == b && color_codes[i].alpha == a)
{
priv->selected_offset = color_codes[i].offset;
}
}
gtk_widget_queue_draw (widget);
/* work out the co-ordinates */
array = tz_get_locations (priv->tzdb);
gtk_widget_get_allocation (widget, &alloc);
width = alloc.width;
height = alloc.height;
for (i = 0; i < array->len; i++)
{
gdouble pointx, pointy, dx, dy;
TzLocation *loc = array->pdata[i];
pointx = convert_longtitude_to_x (loc->longitude, width);
pointy = convert_latitude_to_y (loc->latitude, height);
dx = pointx - x;
dy = pointy - y;
loc->dist = dx * dx + dy * dy;
distances = g_list_prepend (distances, loc);
}
distances = g_list_sort (distances, (GCompareFunc) sort_locations);
set_location (CC_TIMEZONE_MAP (widget), (TzLocation*) distances->data);
g_list_free (distances);
return TRUE;
}
static void
cc_timezone_map_init (CcTimezoneMap *self)
{
CcTimezoneMapPrivate *priv;
GError *err = NULL;
priv = self->priv = TIMEZONE_MAP_PRIVATE (self);
priv->orig_background = gdk_pixbuf_new_from_file (DATADIR "/bg.png",
&err);
if (!priv->orig_background)
{
g_warning ("Could not load background image: %s",
(err) ? err->message : "Unknown error");
g_clear_error (&err);
}
priv->orig_color_map = gdk_pixbuf_new_from_file (DATADIR "/cc.png",
&err);
if (!priv->orig_color_map)
{
g_warning ("Could not load background image: %s",
(err) ? err->message : "Unknown error");
g_clear_error (&err);
}
priv->tzdb = tz_load_db ();
g_signal_connect (self, "button-press-event", G_CALLBACK (button_press_event),
NULL);
}
CcTimezoneMap *
cc_timezone_map_new (void)
{
return g_object_new (CC_TYPE_TIMEZONE_MAP, NULL);
}
gboolean
cc_timezone_map_set_timezone (CcTimezoneMap *map,
const gchar *timezone)
{
GPtrArray *locations;
guint i;
char *real_tz;
gboolean ret;
real_tz = tz_info_get_clean_name (map->priv->tzdb, timezone);
locations = tz_get_locations (map->priv->tzdb);
ret = FALSE;
for (i = 0; i < locations->len; i++)
{
TzLocation *loc = locations->pdata[i];
if (!g_strcmp0 (loc->zone, real_tz ? real_tz : timezone))
{
set_location (map, loc);
ret = TRUE;
break;
}
}
if (ret)
gtk_widget_queue_draw (GTK_WIDGET (map));
g_free (real_tz);
return ret;
}
TzLocation *
cc_timezone_map_get_location (CcTimezoneMap *map)
{
return map->priv->location;
}

79
setup/cc-timezone-map.h Normal file
View File

@@ -0,0 +1,79 @@
/*
* Copyright (C) 2010 Intel, 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.
*
* Author: Thomas Wood <thomas.wood@intel.com>
*
*/
#ifndef _CC_TIMEZONE_MAP_H
#define _CC_TIMEZONE_MAP_H
#include <gtk/gtk.h>
#include "tz.h"
G_BEGIN_DECLS
#define CC_TYPE_TIMEZONE_MAP cc_timezone_map_get_type()
#define CC_TIMEZONE_MAP(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CC_TYPE_TIMEZONE_MAP, CcTimezoneMap))
#define CC_TIMEZONE_MAP_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CC_TYPE_TIMEZONE_MAP, CcTimezoneMapClass))
#define CC_IS_TIMEZONE_MAP(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CC_TYPE_TIMEZONE_MAP))
#define CC_IS_TIMEZONE_MAP_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CC_TYPE_TIMEZONE_MAP))
#define CC_TIMEZONE_MAP_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CC_TYPE_TIMEZONE_MAP, CcTimezoneMapClass))
typedef struct _CcTimezoneMap CcTimezoneMap;
typedef struct _CcTimezoneMapClass CcTimezoneMapClass;
typedef struct _CcTimezoneMapPrivate CcTimezoneMapPrivate;
struct _CcTimezoneMap
{
GtkWidget parent;
CcTimezoneMapPrivate *priv;
};
struct _CcTimezoneMapClass
{
GtkWidgetClass parent_class;
};
GType cc_timezone_map_get_type (void) G_GNUC_CONST;
CcTimezoneMap *cc_timezone_map_new (void);
gboolean cc_timezone_map_set_timezone (CcTimezoneMap *map,
const gchar *timezone);
TzLocation * cc_timezone_map_get_location (CcTimezoneMap *map);
G_END_DECLS
#endif /* _CC_TIMEZONE_MAP_H */

3085
setup/dtm.c Normal file

File diff suppressed because it is too large Load Diff

473
setup/dtm.h Normal file
View File

@@ -0,0 +1,473 @@
/*
* Generated by gdbus-codegen 2.29.5. DO NOT EDIT.
*
* The license of this code is the same as for the source it was derived from.
*/
#ifndef __DTM_H__
#define __DTM_H__
#include <gio/gio.h>
G_BEGIN_DECLS
/* ------------------------------------------------------------------------ */
/* Declarations for org.gnome.SettingsDaemon.DateTimeMechanism */
#define TYPE_DATE_TIME_MECHANISM (date_time_mechanism_get_type ())
#define DATE_TIME_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DATE_TIME_MECHANISM, DateTimeMechanism))
#define IS_DATE_TIME_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DATE_TIME_MECHANISM))
#define DATE_TIME_MECHANISM_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_DATE_TIME_MECHANISM, DateTimeMechanism))
struct _DateTimeMechanism;
typedef struct _DateTimeMechanism DateTimeMechanism;
typedef struct _DateTimeMechanismIface DateTimeMechanismIface;
struct _DateTimeMechanismIface
{
GTypeInterface parent_iface;
gboolean (*handle_adjust_time) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
gint64 seconds_to_add);
gboolean (*handle_can_set_time) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
gboolean (*handle_can_set_timezone) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
gboolean (*handle_can_set_using_ntp) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
gboolean (*handle_get_hardware_clock_using_utc) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
gboolean (*handle_get_timezone) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
gboolean (*handle_get_using_ntp) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
gboolean (*handle_set_date) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
guint day,
guint month,
guint year);
gboolean (*handle_set_hardware_clock_using_utc) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
gboolean is_using_utc);
gboolean (*handle_set_time) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
gint64 seconds_since_epoch);
gboolean (*handle_set_timezone) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
const gchar *tz);
gboolean (*handle_set_using_ntp) (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
gboolean is_using_ntp);
};
GType date_time_mechanism_get_type (void) G_GNUC_CONST;
GDBusInterfaceInfo *date_time_mechanism_interface_info (void);
/* D-Bus method call completion functions: */
void date_time_mechanism_complete_set_timezone (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
void date_time_mechanism_complete_get_timezone (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
const gchar *timezone);
void date_time_mechanism_complete_can_set_timezone (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
gint value);
void date_time_mechanism_complete_set_date (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
void date_time_mechanism_complete_set_time (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
void date_time_mechanism_complete_can_set_time (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
gint value);
void date_time_mechanism_complete_adjust_time (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
void date_time_mechanism_complete_get_hardware_clock_using_utc (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
gboolean is_using_utc);
void date_time_mechanism_complete_set_hardware_clock_using_utc (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
void date_time_mechanism_complete_get_using_ntp (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
gboolean can_use_ntp,
gboolean is_using_ntp);
void date_time_mechanism_complete_set_using_ntp (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation);
void date_time_mechanism_complete_can_set_using_ntp (
DateTimeMechanism *object,
GDBusMethodInvocation *invocation,
gint value);
/* D-Bus method calls: */
void date_time_mechanism_call_set_timezone (
DateTimeMechanism *proxy,
const gchar *tz,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_set_timezone_finish (
DateTimeMechanism *proxy,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_set_timezone_sync (
DateTimeMechanism *proxy,
const gchar *tz,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_get_timezone (
DateTimeMechanism *proxy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_get_timezone_finish (
DateTimeMechanism *proxy,
gchar **out_timezone,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_get_timezone_sync (
DateTimeMechanism *proxy,
gchar **out_timezone,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_can_set_timezone (
DateTimeMechanism *proxy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_can_set_timezone_finish (
DateTimeMechanism *proxy,
gint *out_value,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_can_set_timezone_sync (
DateTimeMechanism *proxy,
gint *out_value,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_set_date (
DateTimeMechanism *proxy,
guint day,
guint month,
guint year,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_set_date_finish (
DateTimeMechanism *proxy,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_set_date_sync (
DateTimeMechanism *proxy,
guint day,
guint month,
guint year,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_set_time (
DateTimeMechanism *proxy,
gint64 seconds_since_epoch,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_set_time_finish (
DateTimeMechanism *proxy,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_set_time_sync (
DateTimeMechanism *proxy,
gint64 seconds_since_epoch,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_can_set_time (
DateTimeMechanism *proxy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_can_set_time_finish (
DateTimeMechanism *proxy,
gint *out_value,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_can_set_time_sync (
DateTimeMechanism *proxy,
gint *out_value,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_adjust_time (
DateTimeMechanism *proxy,
gint64 seconds_to_add,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_adjust_time_finish (
DateTimeMechanism *proxy,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_adjust_time_sync (
DateTimeMechanism *proxy,
gint64 seconds_to_add,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_get_hardware_clock_using_utc (
DateTimeMechanism *proxy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_get_hardware_clock_using_utc_finish (
DateTimeMechanism *proxy,
gboolean *out_is_using_utc,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_get_hardware_clock_using_utc_sync (
DateTimeMechanism *proxy,
gboolean *out_is_using_utc,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_set_hardware_clock_using_utc (
DateTimeMechanism *proxy,
gboolean is_using_utc,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_set_hardware_clock_using_utc_finish (
DateTimeMechanism *proxy,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_set_hardware_clock_using_utc_sync (
DateTimeMechanism *proxy,
gboolean is_using_utc,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_get_using_ntp (
DateTimeMechanism *proxy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_get_using_ntp_finish (
DateTimeMechanism *proxy,
gboolean *out_can_use_ntp,
gboolean *out_is_using_ntp,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_get_using_ntp_sync (
DateTimeMechanism *proxy,
gboolean *out_can_use_ntp,
gboolean *out_is_using_ntp,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_set_using_ntp (
DateTimeMechanism *proxy,
gboolean is_using_ntp,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_set_using_ntp_finish (
DateTimeMechanism *proxy,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_set_using_ntp_sync (
DateTimeMechanism *proxy,
gboolean is_using_ntp,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_call_can_set_using_ntp (
DateTimeMechanism *proxy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean date_time_mechanism_call_can_set_using_ntp_finish (
DateTimeMechanism *proxy,
gint *out_value,
GAsyncResult *res,
GError **error);
gboolean date_time_mechanism_call_can_set_using_ntp_sync (
DateTimeMechanism *proxy,
gint *out_value,
GCancellable *cancellable,
GError **error);
/* ---- */
#define TYPE_DATE_TIME_MECHANISM_PROXY (date_time_mechanism_proxy_get_type ())
#define DATE_TIME_MECHANISM_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DATE_TIME_MECHANISM_PROXY, DateTimeMechanismProxy))
#define DATE_TIME_MECHANISM_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_DATE_TIME_MECHANISM_PROXY, DateTimeMechanismProxyClass))
#define DATE_TIME_MECHANISM_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DATE_TIME_MECHANISM_PROXY, DateTimeMechanismProxyClass))
#define IS_DATE_TIME_MECHANISM_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DATE_TIME_MECHANISM_PROXY))
#define IS_DATE_TIME_MECHANISM_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DATE_TIME_MECHANISM_PROXY))
typedef struct _DateTimeMechanismProxy DateTimeMechanismProxy;
typedef struct _DateTimeMechanismProxyClass DateTimeMechanismProxyClass;
typedef struct _DateTimeMechanismProxyPrivate DateTimeMechanismProxyPrivate;
struct _DateTimeMechanismProxy
{
GDBusProxy parent_instance;
DateTimeMechanismProxyPrivate *priv;
};
struct _DateTimeMechanismProxyClass
{
GDBusProxyClass parent_class;
};
GType date_time_mechanism_proxy_get_type (void) G_GNUC_CONST;
void date_time_mechanism_proxy_new (
GDBusConnection *connection,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
DateTimeMechanism *date_time_mechanism_proxy_new_finish (
GAsyncResult *res,
GError **error);
DateTimeMechanism *date_time_mechanism_proxy_new_sync (
GDBusConnection *connection,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GError **error);
void date_time_mechanism_proxy_new_for_bus (
GBusType bus_type,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
DateTimeMechanism *date_time_mechanism_proxy_new_for_bus_finish (
GAsyncResult *res,
GError **error);
DateTimeMechanism *date_time_mechanism_proxy_new_for_bus_sync (
GBusType bus_type,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GError **error);
/* ---- */
#define TYPE_DATE_TIME_MECHANISM_SKELETON (date_time_mechanism_skeleton_get_type ())
#define DATE_TIME_MECHANISM_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DATE_TIME_MECHANISM_SKELETON, DateTimeMechanismSkeleton))
#define DATE_TIME_MECHANISM_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_DATE_TIME_MECHANISM_SKELETON, DateTimeMechanismSkeletonClass))
#define DATE_TIME_MECHANISM_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DATE_TIME_MECHANISM_SKELETON, DateTimeMechanismSkeletonClass))
#define IS_DATE_TIME_MECHANISM_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DATE_TIME_MECHANISM_SKELETON))
#define IS_DATE_TIME_MECHANISM_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DATE_TIME_MECHANISM_SKELETON))
typedef struct _DateTimeMechanismSkeleton DateTimeMechanismSkeleton;
typedef struct _DateTimeMechanismSkeletonClass DateTimeMechanismSkeletonClass;
typedef struct _DateTimeMechanismSkeletonPrivate DateTimeMechanismSkeletonPrivate;
struct _DateTimeMechanismSkeleton
{
GDBusInterfaceSkeleton parent_instance;
DateTimeMechanismSkeletonPrivate *priv;
};
struct _DateTimeMechanismSkeletonClass
{
GDBusInterfaceSkeletonClass parent_class;
};
GType date_time_mechanism_skeleton_get_type (void) G_GNUC_CONST;
DateTimeMechanism *date_time_mechanism_skeleton_new (void);
G_END_DECLS
#endif /* __DTM_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
[Desktop Entry]
Name=System Setup
Icon=preferences-system
Exec=gnome-system-setup
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;System;
OnlyShowIn=GNOME;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gdm
X-GNOME-Bugzilla-Component=setup
X-GNOME-Bugzilla-Version=unknown

View File

@@ -0,0 +1,145 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "nm-device.h"
#include "panel-cell-renderer-mode.h"
enum {
PROP_0,
PROP_MODE,
PROP_LAST
};
G_DEFINE_TYPE (PanelCellRendererMode, panel_cell_renderer_mode, GTK_TYPE_CELL_RENDERER_PIXBUF)
static gpointer parent_class = NULL;
/**
* panel_cell_renderer_mode_get_property:
**/
static void
panel_cell_renderer_mode_get_property (GObject *object, guint param_id,
GValue *value, GParamSpec *pspec)
{
PanelCellRendererMode *renderer = PANEL_CELL_RENDERER_MODE (object);
switch (param_id) {
case PROP_MODE:
g_value_set_uint (value, renderer->mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
/**
* panel_cell_renderer_set_name:
**/
static void
panel_cell_renderer_set_name (PanelCellRendererMode *renderer)
{
const gchar *icon_name = NULL;
if (renderer->mode == NM_802_11_MODE_ADHOC)
icon_name = "network-workgroup-symbolic";
g_object_set (renderer, "icon-name", icon_name, NULL);
}
/**
* panel_cell_renderer_mode_set_property:
**/
static void
panel_cell_renderer_mode_set_property (GObject *object, guint param_id,
const GValue *value, GParamSpec *pspec)
{
PanelCellRendererMode *renderer = PANEL_CELL_RENDERER_MODE (object);
switch (param_id) {
case PROP_MODE:
renderer->mode = g_value_get_uint (value);
panel_cell_renderer_set_name (renderer);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
/**
* panel_cell_renderer_finalize:
**/
static void
panel_cell_renderer_finalize (GObject *object)
{
PanelCellRendererMode *renderer;
renderer = PANEL_CELL_RENDERER_MODE (object);
g_free (renderer->icon_name);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
/**
* panel_cell_renderer_mode_class_init:
**/
static void
panel_cell_renderer_mode_class_init (PanelCellRendererModeClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = panel_cell_renderer_finalize;
parent_class = g_type_class_peek_parent (class);
object_class->get_property = panel_cell_renderer_mode_get_property;
object_class->set_property = panel_cell_renderer_mode_set_property;
g_object_class_install_property (object_class, PROP_MODE,
g_param_spec_uint ("mode", NULL,
NULL,
0, G_MAXUINT, 0,
G_PARAM_READWRITE));
}
/**
* panel_cell_renderer_mode_init:
**/
static void
panel_cell_renderer_mode_init (PanelCellRendererMode *renderer)
{
renderer->mode = 0;
renderer->icon_name = NULL;
}
/**
* panel_cell_renderer_mode_new:
**/
GtkCellRenderer *
panel_cell_renderer_mode_new (void)
{
return g_object_new (PANEL_TYPE_CELL_RENDERER_MODE, NULL);
}

View File

@@ -0,0 +1,58 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef PANEL_CELL_RENDERER_MODE_H
#define PANEL_CELL_RENDERER_MODE_H
#include <glib-object.h>
#include <gtk/gtk.h>
#define PANEL_TYPE_CELL_RENDERER_MODE (panel_cell_renderer_mode_get_type())
#define PANEL_CELL_RENDERER_MODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererMode))
#define PANEL_CELL_RENDERER_MODE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererModeClass))
#define PANEL_IS_CELL_RENDERER_MODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_MODE))
#define PANEL_IS_CELL_RENDERER_MODE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_MODE))
#define PANEL_CELL_RENDERER_MODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererModeClass))
G_BEGIN_DECLS
typedef struct _PanelCellRendererMode PanelCellRendererMode;
typedef struct _PanelCellRendererModeClass PanelCellRendererModeClass;
struct _PanelCellRendererMode
{
GtkCellRendererPixbuf parent;
guint mode;
gchar *icon_name;
};
struct _PanelCellRendererModeClass
{
GtkCellRendererPixbufClass parent_class;
};
GType panel_cell_renderer_mode_get_type (void);
GtkCellRenderer *panel_cell_renderer_mode_new (void);
G_END_DECLS
#endif /* PANEL_CELL_RENDERER_MODE_H */

View File

@@ -0,0 +1,155 @@
/* -*- Security: C; tab-width: 8; indent-tabs-security: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2011 Red Hat, Inc
*
* Licensed under the GNU General Public License Version 2
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "panel-cell-renderer-security.h"
enum {
PROP_0,
PROP_SECURITY,
PROP_LAST
};
G_DEFINE_TYPE (PanelCellRendererSecurity, panel_cell_renderer_security, GTK_TYPE_CELL_RENDERER_PIXBUF)
static gpointer parent_class = NULL;
/**
* panel_cell_renderer_security_get_property:
**/
static void
panel_cell_renderer_security_get_property (GObject *object, guint param_id,
GValue *value, GParamSpec *pspec)
{
PanelCellRendererSecurity *renderer = PANEL_CELL_RENDERER_SECURITY (object);
switch (param_id) {
case PROP_SECURITY:
g_value_set_uint (value, renderer->security);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
/**
* panel_cell_renderer_set_name:
**/
static void
panel_cell_renderer_set_name (PanelCellRendererSecurity *renderer)
{
const gchar *icon_name = NULL;
if (renderer->security != NM_AP_SEC_UNKNOWN &&
renderer->security != NM_AP_SEC_NONE)
icon_name = "network-wireless-encrypted-symbolic";
if (icon_name != NULL) {
g_object_set (renderer,
"icon-name", icon_name,
"visible", TRUE,
NULL);
} else {
g_object_set (renderer,
"icon-name", NULL,
"visible", FALSE,
NULL);
}
}
/**
* panel_cell_renderer_security_set_property:
**/
static void
panel_cell_renderer_security_set_property (GObject *object, guint param_id,
const GValue *value, GParamSpec *pspec)
{
PanelCellRendererSecurity *renderer = PANEL_CELL_RENDERER_SECURITY (object);
switch (param_id) {
case PROP_SECURITY:
renderer->security = g_value_get_uint (value);
panel_cell_renderer_set_name (renderer);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
/**
* panel_cell_renderer_finalize:
**/
static void
panel_cell_renderer_finalize (GObject *object)
{
PanelCellRendererSecurity *renderer;
renderer = PANEL_CELL_RENDERER_SECURITY (object);
g_free (renderer->icon_name);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
/**
* panel_cell_renderer_security_class_init:
**/
static void
panel_cell_renderer_security_class_init (PanelCellRendererSecurityClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = panel_cell_renderer_finalize;
parent_class = g_type_class_peek_parent (class);
object_class->get_property = panel_cell_renderer_security_get_property;
object_class->set_property = panel_cell_renderer_security_set_property;
g_object_class_install_property (object_class, PROP_SECURITY,
g_param_spec_uint ("security", NULL,
NULL,
0, G_MAXUINT, 0,
G_PARAM_READWRITE));
}
/**
* panel_cell_renderer_security_init:
**/
static void
panel_cell_renderer_security_init (PanelCellRendererSecurity *renderer)
{
renderer->security = 0;
renderer->icon_name = NULL;
}
/**
* panel_cell_renderer_security_new:
**/
GtkCellRenderer *
panel_cell_renderer_security_new (void)
{
return g_object_new (PANEL_TYPE_CELL_RENDERER_SECURITY, NULL);
}

View File

@@ -0,0 +1,66 @@
/* -*- Security: C; tab-width: 8; indent-tabs-security: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2011 Red Hat, Inc
*
* Licensed under the GNU General Public License Version 2
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef PANEL_CELL_RENDERER_SECURITY_H
#define PANEL_CELL_RENDERER_SECURITY_H
#include <glib-object.h>
#include <gtk/gtk.h>
#define PANEL_TYPE_CELL_RENDERER_SECURITY (panel_cell_renderer_security_get_type())
#define PANEL_CELL_RENDERER_SECURITY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_SECURITY, PanelCellRendererSecurity))
#define PANEL_CELL_RENDERER_SECURITY_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_SECURITY, PanelCellRendererSecurityClass))
#define PANEL_IS_CELL_RENDERER_SECURITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_SECURITY))
#define PANEL_IS_CELL_RENDERER_SECURITY_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_SECURITY))
#define PANEL_CELL_RENDERER_SECURITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_SECURITY, PanelCellRendererSecurityClass))
G_BEGIN_DECLS
typedef struct _PanelCellRendererSecurity PanelCellRendererSecurity;
typedef struct _PanelCellRendererSecurityClass PanelCellRendererSecurityClass;
typedef enum {
NM_AP_SEC_UNKNOWN,
NM_AP_SEC_NONE,
NM_AP_SEC_WEP,
NM_AP_SEC_WPA,
NM_AP_SEC_WPA2
} NMAccessPointSecurity;
struct _PanelCellRendererSecurity
{
GtkCellRendererPixbuf parent;
guint security;
gchar *icon_name;
};
struct _PanelCellRendererSecurityClass
{
GtkCellRendererPixbufClass parent_class;
};
GType panel_cell_renderer_security_get_type (void);
GtkCellRenderer *panel_cell_renderer_security_new (void);
G_END_DECLS
#endif /* PANEL_CELL_RENDERER_SECURITY_H */

View File

@@ -0,0 +1,161 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-signal: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "panel-cell-renderer-signal.h"
enum {
PROP_0,
PROP_SIGNAL,
PROP_LAST
};
G_DEFINE_TYPE (PanelCellRendererSignal, panel_cell_renderer_signal, GTK_TYPE_CELL_RENDERER_PIXBUF)
static gpointer parent_class = NULL;
/**
* panel_cell_renderer_signal_get_property:
**/
static void
panel_cell_renderer_signal_get_property (GObject *object, guint param_id,
GValue *value, GParamSpec *pspec)
{
PanelCellRendererSignal *renderer = PANEL_CELL_RENDERER_SIGNAL (object);
switch (param_id) {
case PROP_SIGNAL:
g_value_set_uint (value, renderer->signal);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
/**
* panel_cell_renderer_set_name:
**/
static void
panel_cell_renderer_set_name (PanelCellRendererSignal *renderer)
{
const gchar *icon_name = NULL;
GIcon *icon;
/* the 'Other...' entry */
if (renderer->signal == 0) {
g_object_set (renderer, "gicon", NULL, NULL);
return;
}
if (renderer->signal < 20)
icon_name = "network-wireless-signal-none-symbolic";
else if (renderer->signal < 40)
icon_name = "network-wireless-signal-weak-symbolic";
else if (renderer->signal < 50)
icon_name = "network-wireless-signal-ok-symbolic";
else if (renderer->signal < 80)
icon_name = "network-wireless-signal-good-symbolic";
else
icon_name = "network-wireless-signal-excellent-symbolic";
icon = g_themed_icon_new_with_default_fallbacks (icon_name);
g_object_set (renderer, "gicon", icon, NULL);
g_object_unref (icon);
}
/**
* panel_cell_renderer_signal_set_property:
**/
static void
panel_cell_renderer_signal_set_property (GObject *object, guint param_id,
const GValue *value, GParamSpec *pspec)
{
PanelCellRendererSignal *renderer = PANEL_CELL_RENDERER_SIGNAL (object);
switch (param_id) {
case PROP_SIGNAL:
renderer->signal = g_value_get_uint (value);
panel_cell_renderer_set_name (renderer);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
/**
* panel_cell_renderer_finalize:
**/
static void
panel_cell_renderer_finalize (GObject *object)
{
PanelCellRendererSignal *renderer;
renderer = PANEL_CELL_RENDERER_SIGNAL (object);
g_free (renderer->icon_name);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
/**
* panel_cell_renderer_signal_class_init:
**/
static void
panel_cell_renderer_signal_class_init (PanelCellRendererSignalClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = panel_cell_renderer_finalize;
parent_class = g_type_class_peek_parent (class);
object_class->get_property = panel_cell_renderer_signal_get_property;
object_class->set_property = panel_cell_renderer_signal_set_property;
g_object_class_install_property (object_class, PROP_SIGNAL,
g_param_spec_uint ("signal", NULL,
NULL,
0, G_MAXUINT, 0,
G_PARAM_READWRITE));
}
/**
* panel_cell_renderer_signal_init:
**/
static void
panel_cell_renderer_signal_init (PanelCellRendererSignal *renderer)
{
renderer->signal = 0;
renderer->icon_name = NULL;
}
/**
* panel_cell_renderer_signal_new:
**/
GtkCellRenderer *
panel_cell_renderer_signal_new (void)
{
return g_object_new (PANEL_TYPE_CELL_RENDERER_SIGNAL, NULL);
}

View File

@@ -0,0 +1,58 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-signal: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef PANEL_CELL_RENDERER_SIGNAL_H
#define PANEL_CELL_RENDERER_SIGNAL_H
#include <glib-object.h>
#include <gtk/gtk.h>
#define PANEL_TYPE_CELL_RENDERER_SIGNAL (panel_cell_renderer_signal_get_type())
#define PANEL_CELL_RENDERER_SIGNAL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignal))
#define PANEL_CELL_RENDERER_SIGNAL_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignalClass))
#define PANEL_IS_CELL_RENDERER_SIGNAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL))
#define PANEL_IS_CELL_RENDERER_SIGNAL_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_SIGNAL))
#define PANEL_CELL_RENDERER_SIGNAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignalClass))
G_BEGIN_DECLS
typedef struct _PanelCellRendererSignal PanelCellRendererSignal;
typedef struct _PanelCellRendererSignalClass PanelCellRendererSignalClass;
struct _PanelCellRendererSignal
{
GtkCellRendererPixbuf parent;
guint signal;
gchar *icon_name;
};
struct _PanelCellRendererSignalClass
{
GtkCellRendererPixbufClass parent_class;
};
GType panel_cell_renderer_signal_get_type (void);
GtkCellRenderer *panel_cell_renderer_signal_new (void);
G_END_DECLS
#endif /* PANEL_CELL_RENDERER_SIGNAL_H */

629
setup/setup.ui Normal file
View File

@@ -0,0 +1,629 @@
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkListStore" id="liststore-wireless">
<columns>
<column type="gchararray"/> <!-- column-name id -->
<column type="gchararray"/> <!-- column-name title -->
<column type="gchararray"/> <!-- column-name sortable -->
<column type="guint"/> <!-- column-name strength -->
<column type="guint"/> <!-- column-name mode -->
<column type="guint"/> <!-- column-name security -->
<column type="gboolean"/> <!-- column-name activating -->
<column type="gboolean"/> <!-- column-name active -->
<column type="guint"/> <!-- column-name pulse -->
</columns>
</object>
<object class="GtkAssistant" id="gnome-setup-assistant">
<!-- interface-naming-policy toplevel-contextual -->
<property name="border-width">12</property>
<property name="title"></property>
<property name="icon_name">preferences-system</property>
<property name="visible">False</property>
<property name="deletable">False</property>
<property name="resizable">False</property>
<child>
<object class="GtkGrid" id="welcome-page">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="welcome-title">
<property name="visible">True</property>
<property name="label" translatable="yes">Welcome to GNOME</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="margin-bottom">18</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="welcome-image">
<property name="visible">True</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="file">welcome-image.jpg</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="welcome-subtitle">
<property name="visible">True</property>
<property name="label" translatable="yes">Now let's set up some essentials for your account.</property>
<property name="halign">start</property>
<property name="xalign">0.0</property>
<property name="margin-top">18</property>
<property name="margin-bottom">18</property>
<property name="wrap">True</property>
<property name="width-chars">50</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="title" translatable="yes">Introduction</property>
<property name="page-type">intro</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="network-page">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="network-title">
<property name="visible">True</property>
<property name="label" translatable="yes">Connect to the Network</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="margin-bottom">18</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="network-subtitle">
<property name="visible">True</property>
<property name="label" translatable="yes">Select a wireless network</property>
<property name="margin-bottom">12</property>
<property name="halign">start</property>
<property name="valign">start</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="network-scrolledwindow">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="margin-top">0</property>
<property name="margin-bottom">32</property>
<property name="margin-right">64</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="network-list">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="model">liststore-wireless</property>
<property name="headers-visible">False</property>
<property name="search-column">2</property>
<property name="show-expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="network-list-selection">
<property name="mode">single</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="network-list-column"/>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="no-network-grid">
<property name="visible">True</property>
<property name="halign">start</property>
<property name="valign">start</property>
<child>
<object class="GtkSpinner" id="no-network-spinner">
<property name="visible">True</property>
<property name="active">True</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="margin-left">6</property>
<property name="margin-right">6</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="no-network-label">
<property name="visible">True</property>
<property name="label">No text</property>
<property name="halign">start</property>
<property name="valign">center</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="title" translatable="yes">Network</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="account-page">
<property name="visible">True</property>
<property name="row-spacing">6</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel" id="account-title">
<property name="visible">True</property>
<property name="label" translatable="yes">Create an Account</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="margin-bottom">12</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="account-fullname-label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Fullname</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">account-fullname-entry</property>
<property name="halign">end</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="account-fullname-entry">
<property name="visible">True</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="account-username-label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Username</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">account-username-entry</property>
<property name="halign">end</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="account-username-entry">
<property name="visible">True</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="account-password-check">
<property name="visible">True</property>
<property name="label" translatable="yes">_Require a password to use this account</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="account-password-label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Password</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">account-password-entry</property>
<property name="halign">end</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="account-password-entry">
<property name="visible">True</property>
<property name="halign">start</property>
<property name="visibility">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="account-confirm-label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Confirm Password</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">account-confirm-entry</property>
<property name="halign">end</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="account-confirm-entry">
<property name="visible">True</property>
<property name="halign">start</property>
<property name="visibility">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="account-admin-check">
<property name="visible">True</property>
<property name="label" translatable="yes">_Act as administrator of this computer</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">6</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="title" translatable="yes">Account</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="location-page">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="location-title">
<property name="visible">True</property>
<property name="label" translatable="yes">Select your Location</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="margin-bottom">18</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="location-auto-check">
<property name="visible">True</property>
<property name="label" translatable="yes">_Determine your location automatically</property>
<property name="use_underline">True</property>
<property name="halign">start</property>
<property name="margin-right">24</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkAspectFrame" id="location-map-frame">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="location-info-grid">
<property name="visible">True</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="row-spacing">12</property>
<property name="column-spacing">6</property>
<child>
<object class="GtkLabel" id="location-label">
<property name="visible">True</property>
<property name="label" translatable="yes">Location</property>
<property name="halign">end</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="current-location-label">
<property name="visible">True</property>
<property name="label">Boston, MA</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="timezone-label">
<property name="visible">True</property>
<property name="label" translatable="yes">Timezone</property>
<property name="halign">end</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="current-timezone-label">
<property name="visible">True</property>
<property name="label">America / New York</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
<packing>
<property name="title" translatable="yes">Location</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="online-page">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="online-title">
<property name="visible">True</property>
<property name="label" translatable="yes">Web Accounts</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="margin-bottom">18</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="online-subtitle">
<property name="visible">True</property>
<property name="label" translatable="yes">Associate your new account with your existing online accounts</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="margin-bottom">18</property>
<property name="xalign">0.0</property>
<property name="wrap">True</property>
<property name="width-chars">50</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="online-add-button">
<property name="visible">True</property>
<property name="label">_Add Account</property>
<property name="use_underline">True</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="margin-top">24</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="title" translatable="yes">Web Accounts</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="page6">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="summary-title">
<property name="visible">True</property>
<property name="label" translatable="yes">Enjoy GNOME !</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="margin-bottom">18</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="summary-details">
<property name="visible">True</property>
<property name="xalign">0.0</property>
<property name="label" translatable="yes">Your new account is ready to use. You may change any of these options at any time in the System Settings.</property>
<property name="wrap">True</property>
<property name="halign">start</property>
<property name="valign">start</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="title" translatable="yes">Summary</property>
<property name="page-type">summary</property>
</packing>
</child>
</object>
</interface>

475
setup/tz.c Normal file
View File

@@ -0,0 +1,475 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Generic timezone utilities.
*
* Copyright (C) 2000-2001 Ximian, Inc.
*
* Authors: Hans Petter Jansson <hpj@ximian.com>
*
* Largely based on Michael Fulbright's work on Anaconda.
*
* 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 <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include "tz.h"
/* Forward declarations for private functions */
static float convert_pos (gchar *pos, int digits);
static int compare_country_names (const void *a, const void *b);
static void sort_locations_by_country (GPtrArray *locations);
static gchar * tz_data_file_get (void);
static void load_backward_tz (TzDB *tz_db);
/* ---------------- *
* Public interface *
* ---------------- */
TzDB *
tz_load_db (void)
{
gchar *tz_data_file;
TzDB *tz_db;
FILE *tzfile;
char buf[4096];
tz_data_file = tz_data_file_get ();
if (!tz_data_file) {
g_warning ("Could not get the TimeZone data file name");
return NULL;
}
tzfile = fopen (tz_data_file, "r");
if (!tzfile) {
g_warning ("Could not open *%s*\n", tz_data_file);
g_free (tz_data_file);
return NULL;
}
tz_db = g_new0 (TzDB, 1);
tz_db->locations = g_ptr_array_new ();
while (fgets (buf, sizeof(buf), tzfile))
{
gchar **tmpstrarr;
gchar *latstr, *lngstr, *p;
TzLocation *loc;
if (*buf == '#') continue;
g_strchomp(buf);
tmpstrarr = g_strsplit(buf,"\t", 6);
latstr = g_strdup (tmpstrarr[1]);
p = latstr + 1;
while (*p != '-' && *p != '+') p++;
lngstr = g_strdup (p);
*p = '\0';
loc = g_new0 (TzLocation, 1);
loc->country = g_strdup (tmpstrarr[0]);
loc->zone = g_strdup (tmpstrarr[2]);
loc->latitude = convert_pos (latstr, 2);
loc->longitude = convert_pos (lngstr, 3);
#ifdef __sun
if (tmpstrarr[3] && *tmpstrarr[3] == '-' && tmpstrarr[4])
loc->comment = g_strdup (tmpstrarr[4]);
if (tmpstrarr[3] && *tmpstrarr[3] != '-' && !islower(loc->zone)) {
TzLocation *locgrp;
/* duplicate entry */
locgrp = g_new0 (TzLocation, 1);
locgrp->country = g_strdup (tmpstrarr[0]);
locgrp->zone = g_strdup (tmpstrarr[3]);
locgrp->latitude = convert_pos (latstr, 2);
locgrp->longitude = convert_pos (lngstr, 3);
locgrp->comment = (tmpstrarr[4]) ? g_strdup (tmpstrarr[4]) : NULL;
g_ptr_array_add (tz_db->locations, (gpointer) locgrp);
}
#else
loc->comment = (tmpstrarr[3]) ? g_strdup(tmpstrarr[3]) : NULL;
#endif
g_ptr_array_add (tz_db->locations, (gpointer) loc);
g_free (latstr);
g_free (lngstr);
g_strfreev (tmpstrarr);
}
fclose (tzfile);
/* now sort by country */
sort_locations_by_country (tz_db->locations);
g_free (tz_data_file);
/* Load up the hashtable of backward links */
load_backward_tz (tz_db);
return tz_db;
}
static void
tz_location_free (TzLocation *loc)
{
g_free (loc->country);
g_free (loc->zone);
g_free (loc->comment);
g_free (loc);
}
void
tz_db_free (TzDB *db)
{
g_ptr_array_foreach (db->locations, (GFunc) tz_location_free, NULL);
g_ptr_array_free (db->locations, TRUE);
g_hash_table_destroy (db->backward);
g_free (db);
}
GPtrArray *
tz_get_locations (TzDB *db)
{
return db->locations;
}
gchar *
tz_location_get_country (TzLocation *loc)
{
return loc->country;
}
gchar *
tz_location_get_zone (TzLocation *loc)
{
return loc->zone;
}
gchar *
tz_location_get_comment (TzLocation *loc)
{
return loc->comment;
}
void
tz_location_get_position (TzLocation *loc, double *longitude, double *latitude)
{
*longitude = loc->longitude;
*latitude = loc->latitude;
}
glong
tz_location_get_utc_offset (TzLocation *loc)
{
TzInfo *tz_info;
glong offset;
tz_info = tz_info_from_location (loc);
offset = tz_info->utc_offset;
tz_info_free (tz_info);
return offset;
}
TzInfo *
tz_info_from_location (TzLocation *loc)
{
TzInfo *tzinfo;
time_t curtime;
struct tm *curzone;
g_return_val_if_fail (loc != NULL, NULL);
g_return_val_if_fail (loc->zone != NULL, NULL);
setenv ("TZ", loc->zone, 1);
#if 0
tzset ();
#endif
tzinfo = g_new0 (TzInfo, 1);
curtime = time (NULL);
curzone = localtime (&curtime);
#ifndef __sun
/* Currently this solution doesnt seem to work - I get that */
/* America/Phoenix uses daylight savings, which is wrong */
tzinfo->tzname_normal = g_strdup (curzone->tm_zone);
if (curzone->tm_isdst)
tzinfo->tzname_daylight =
g_strdup (&curzone->tm_zone[curzone->tm_isdst]);
else
tzinfo->tzname_daylight = NULL;
tzinfo->utc_offset = curzone->tm_gmtoff;
#else
tzinfo->tzname_normal = NULL;
tzinfo->tzname_daylight = NULL;
tzinfo->utc_offset = 0;
#endif
tzinfo->daylight = curzone->tm_isdst;
setenv ("TZ", "", 1);
return tzinfo;
}
void
tz_info_free (TzInfo *tzinfo)
{
g_return_if_fail (tzinfo != NULL);
if (tzinfo->tzname_normal) g_free (tzinfo->tzname_normal);
if (tzinfo->tzname_daylight) g_free (tzinfo->tzname_daylight);
g_free (tzinfo);
}
struct {
const char *orig;
const char *dest;
} aliases[] = {
{ "Asia/Istanbul", "Europe/Istanbul" }, /* Istanbul is in both Europe and Asia */
{ "Europe/Nicosia", "Asia/Nicosia" }, /* Ditto */
{ "EET", "Europe/Istanbul" }, /* Same tz as the 2 above */
{ "HST", "Pacific/Honolulu" },
{ "WET", "Europe/Brussels" }, /* Other name for the mainland Europe tz */
{ "CET", "Europe/Brussels" }, /* ditto */
{ "MET", "Europe/Brussels" },
{ "Etc/Zulu", "Etc/GMT" },
{ "Etc/UTC", "Etc/GMT" },
{ "GMT", "Etc/GMT" },
{ "Greenwich", "Etc/GMT" },
{ "Etc/UCT", "Etc/GMT" },
{ "Etc/GMT0", "Etc/GMT" },
{ "Etc/GMT+0", "Etc/GMT" },
{ "Etc/GMT-0", "Etc/GMT" },
{ "Etc/Universal", "Etc/GMT" },
{ "PST8PDT", "America/Los_Angeles" }, /* Other name for the Atlantic tz */
{ "EST", "America/New_York" }, /* Other name for the Eastern tz */
{ "EST5EDT", "America/New_York" }, /* ditto */
{ "CST6CDT", "America/Chicago" }, /* Other name for the Central tz */
{ "MST", "America/Denver" }, /* Other name for the mountain tz */
{ "MST7MDT", "America/Denver" }, /* ditto */
};
static gboolean
compare_timezones (const char *a,
const char *b)
{
if (g_str_equal (a, b))
return TRUE;
if (strchr (b, '/') == NULL) {
char *prefixed;
prefixed = g_strdup_printf ("/%s", b);
if (g_str_has_suffix (a, prefixed)) {
g_free (prefixed);
return TRUE;
}
g_free (prefixed);
}
return FALSE;
}
char *
tz_info_get_clean_name (TzDB *tz_db,
const char *tz)
{
char *ret;
const char *timezone;
guint i;
gboolean replaced;
/* Remove useless prefixes */
if (g_str_has_prefix (tz, "right/"))
tz = tz + strlen ("right/");
else if (g_str_has_prefix (tz, "posix/"))
tz = tz + strlen ("posix/");
/* Here start the crazies */
replaced = FALSE;
for (i = 0; i < G_N_ELEMENTS (aliases); i++) {
if (compare_timezones (tz, aliases[i].orig)) {
replaced = TRUE;
timezone = aliases[i].dest;
break;
}
}
/* Try again! */
if (!replaced) {
/* Ignore crazy solar times from the '80s */
if (g_str_has_prefix (tz, "Asia/Riyadh") ||
g_str_has_prefix (tz, "Mideast/Riyadh")) {
timezone = "Asia/Riyadh";
replaced = TRUE;
}
}
if (!replaced)
timezone = tz;
ret = g_hash_table_lookup (tz_db->backward, timezone);
if (ret == NULL)
return g_strdup (timezone);
return g_strdup (ret);
}
/* ----------------- *
* Private functions *
* ----------------- */
static gchar *
tz_data_file_get (void)
{
gchar *file;
file = g_strdup (TZ_DATA_FILE);
return file;
}
static float
convert_pos (gchar *pos, int digits)
{
gchar whole[10];
gchar *fraction;
gint i;
float t1, t2;
if (!pos || strlen(pos) < 4 || digits > 9) return 0.0;
for (i = 0; i < digits + 1; i++) whole[i] = pos[i];
whole[i] = '\0';
fraction = pos + digits + 1;
t1 = g_strtod (whole, NULL);
t2 = g_strtod (fraction, NULL);
if (t1 >= 0.0) return t1 + t2/pow (10.0, strlen(fraction));
else return t1 - t2/pow (10.0, strlen(fraction));
}
#if 0
/* Currently not working */
static void
free_tzdata (TzLocation *tz)
{
if (tz->country)
g_free(tz->country);
if (tz->zone)
g_free(tz->zone);
if (tz->comment)
g_free(tz->comment);
g_free(tz);
}
#endif
static int
compare_country_names (const void *a, const void *b)
{
const TzLocation *tza = * (TzLocation **) a;
const TzLocation *tzb = * (TzLocation **) b;
return strcmp (tza->zone, tzb->zone);
}
static void
sort_locations_by_country (GPtrArray *locations)
{
qsort (locations->pdata, locations->len, sizeof (gpointer),
compare_country_names);
}
static void
load_backward_tz (TzDB *tz_db)
{
GError *error = NULL;
char **lines, *contents;
guint i;
tz_db->backward = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
if (g_file_get_contents (GNOMECC_DATA_DIR "/datetime/backward", &contents, NULL, &error) == FALSE)
{
g_warning ("Failed to load 'backward' file: %s", error->message);
return;
}
lines = g_strsplit (contents, "\n", -1);
g_free (contents);
for (i = 0; lines[i] != NULL; i++)
{
char **items;
guint j;
char *real, *alias;
if (g_ascii_strncasecmp (lines[i], "Link\t", 5) != 0)
continue;
items = g_strsplit (lines[i], "\t", -1);
real = NULL;
alias = NULL;
/* Skip the "Link<tab>" part */
for (j = 1; items[j] != NULL; j++)
{
if (items[j][0] == '\0')
continue;
if (real == NULL)
{
real = items[j];
continue;
}
alias = items[j];
break;
}
if (real == NULL || alias == NULL)
g_warning ("Could not parse line: %s", lines[i]);
/* We don't need more than one name for it */
if (g_str_equal (real, "Etc/UTC") ||
g_str_equal (real, "Etc/UCT"))
real = "Etc/GMT";
g_hash_table_insert (tz_db->backward, g_strdup (alias), g_strdup (real));
g_strfreev (items);
}
g_strfreev (lines);
}

89
setup/tz.h Normal file
View File

@@ -0,0 +1,89 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Generic timezone utilities.
*
* Copyright (C) 2000-2001 Ximian, Inc.
*
* Authors: Hans Petter Jansson <hpj@ximian.com>
*
* Largely based on Michael Fulbright's work on Anaconda.
*
* 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 _E_TZ_H
#define _E_TZ_H
#include <glib.h>
#ifndef __sun
# define TZ_DATA_FILE "/usr/share/zoneinfo/zone.tab"
#else
# define TZ_DATA_FILE "/usr/share/lib/zoneinfo/tab/zone_sun.tab"
#endif
typedef struct _TzDB TzDB;
typedef struct _TzLocation TzLocation;
typedef struct _TzInfo TzInfo;
struct _TzDB
{
GPtrArray *locations;
GHashTable *backward;
};
struct _TzLocation
{
gchar *country;
gdouble latitude;
gdouble longitude;
gchar *zone;
gchar *comment;
gdouble dist; /* distance to clicked point for comparison */
};
/* see the glibc info page information on time zone information */
/* tzname_normal is the default name for the timezone */
/* tzname_daylight is the name of the zone when in daylight savings */
/* utc_offset is offset in seconds from utc */
/* daylight if non-zero then location obeys daylight savings */
struct _TzInfo
{
gchar *tzname_normal;
gchar *tzname_daylight;
glong utc_offset;
gint daylight;
};
TzDB *tz_load_db (void);
void tz_db_free (TzDB *db);
char * tz_info_get_clean_name (TzDB *tz_db,
const char *tz);
GPtrArray *tz_get_locations (TzDB *db);
void tz_location_get_position (TzLocation *loc,
double *longitude, double *latitude);
char *tz_location_get_country (TzLocation *loc);
gchar *tz_location_get_zone (TzLocation *loc);
gchar *tz_location_get_comment (TzLocation *loc);
glong tz_location_get_utc_offset (TzLocation *loc);
gint tz_location_set_locally (TzLocation *loc);
TzInfo *tz_info_from_location (TzLocation *loc);
void tz_info_free (TzInfo *tz_info);
#endif

BIN
setup/welcome-image.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB