Compare commits
16 Commits
42.3
...
gsoc2011/l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd4d344466 | ||
|
|
30cc7383ad | ||
|
|
d97962722a | ||
|
|
d5cf248a05 | ||
|
|
7f418dc729 | ||
|
|
621503cb84 | ||
|
|
086fac304c | ||
|
|
a0e9b3990b | ||
|
|
9b16268fe1 | ||
|
|
329828fb15 | ||
|
|
c38fc46243 | ||
|
|
3b8cd2c21d | ||
|
|
cabfddad05 | ||
|
|
a8fe550f65 | ||
|
|
75447db955 | ||
|
|
ab65280445 |
@@ -109,6 +109,7 @@ PKG_CHECK_MODULES(PRINTERS_PANEL, $COMMON_MODULES dbus-glib-1
|
||||
PKG_CHECK_MODULES(REGION_PANEL, $COMMON_MODULES libgnomekbd >= 2.91.91
|
||||
libxklavier >= 5.1 libgnomekbdui >= 2.91.91)
|
||||
PKG_CHECK_MODULES(SCREEN_PANEL, $COMMON_MODULES)
|
||||
PKG_CHECK_MODULES(LOCATION_PANEL, $COMMON_MODULES)
|
||||
PKG_CHECK_MODULES(SOUND_PANEL, $COMMON_MODULES libxml-2.0
|
||||
libcanberra-gtk3 >= $CANBERRA_REQUIRED_VERSION
|
||||
libpulse >= $PA_REQUIRED_VERSION
|
||||
@@ -361,6 +362,8 @@ panels/sound/data/icons/scalable/devices/Makefile
|
||||
panels/sound/data/sounds/Makefile
|
||||
panels/screen/Makefile
|
||||
panels/screen/gnome-screen-panel.desktop.in
|
||||
panels/location/Makefile
|
||||
panels/location/gnome-location-panel.desktop.in
|
||||
panels/info/Makefile
|
||||
panels/info/gnome-info-panel.desktop.in
|
||||
panels/power/Makefile
|
||||
|
||||
@@ -14,7 +14,8 @@ SUBDIRS= \
|
||||
keyboard \
|
||||
universal-access \
|
||||
user-accounts \
|
||||
datetime
|
||||
datetime \
|
||||
location
|
||||
|
||||
if BUILD_PRINTERS
|
||||
SUBDIRS += printers
|
||||
|
||||
38
panels/location/Makefile.am
Normal file
38
panels/location/Makefile.am
Normal file
@@ -0,0 +1,38 @@
|
||||
cappletname = location
|
||||
|
||||
INCLUDES = \
|
||||
$(PANEL_CFLAGS) \
|
||||
$(LOCATION_PANEL_CFLAGS) \
|
||||
-DGNOMECC_UI_DIR="\"$(uidir)\"" \
|
||||
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
|
||||
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
|
||||
$(NULL)
|
||||
|
||||
ccpanelsdir = $(PANELS_DIR)
|
||||
ccpanels_LTLIBRARIES = liblocation.la
|
||||
|
||||
liblocation_la_SOURCES = \
|
||||
location-module.c \
|
||||
location-utils.h \
|
||||
location-utils.c \
|
||||
cc-location-panel.c \
|
||||
cc-location-panel.h
|
||||
|
||||
liblocation_la_LIBADD = $(PANEL_LIBS) $(LOCATION_PANEL_LIBS)
|
||||
liblocation_la_LDFLAGS = $(PANEL_LDFLAGS)
|
||||
|
||||
uidir = $(pkgdatadir)/ui/location
|
||||
dist_ui_DATA = \
|
||||
add-location.ui \
|
||||
location.ui \
|
||||
data/bg.png
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
desktopdir = $(datadir)/applications
|
||||
desktop_in_files = gnome-location-panel.desktop.in
|
||||
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
|
||||
|
||||
CLEANFILES = $(desktop_in_files) $(desktop_DATA)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
161
panels/location/add-location.ui
Normal file
161
panels/location/add-location.ui
Normal file
@@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkDialog" id="add-location-dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Add a location</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">6</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<property name="n_columns">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">City:</property>
|
||||
<property name="justify">right</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="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">Country:</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="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">Timezone:</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>
|
||||
<child>
|
||||
<object class="GtkEntry" id="city-entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</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>
|
||||
<child>
|
||||
<object class="GtkEntry" id="country-entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</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="GtkEntry" id="tz-entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-6">button2</action-widget>
|
||||
<action-widget response="-5">button1</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
299
panels/location/cc-location-panel.c
Normal file
299
panels/location/cc-location-panel.c
Normal file
@@ -0,0 +1,299 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
- use geocode-glib to ask for locations ;
|
||||
- use an indicator for the home location (add a pixbuf column) ;
|
||||
- fallback to libgweather locations.xml when no Internet available ;
|
||||
- draw pretty Cairos shapes to spot locations on the map (otherwise the map is useless) ;
|
||||
- think about how to handle timezone change (are they just an hour offset?) ;
|
||||
- think about how location change affect manual timing ;
|
||||
- who takes care of daylight saving and summer time and all the fun stuff? ;
|
||||
- think about where does my panel fit (seperate panel? replace date & time?) ;
|
||||
- define a nice schema for GSettings ;
|
||||
*/
|
||||
|
||||
#include "cc-location-panel.h"
|
||||
#include "location-utils.h"
|
||||
#include <gdesktop-enums.h>
|
||||
|
||||
#define CLOCK_SCHEMA "org.gnome.desktop.interface"
|
||||
#define CLOCK_FORMAT_KEY "clock-format"
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (CcLocationPanel, cc_location_panel, CC_TYPE_PANEL)
|
||||
|
||||
#define LOCATION_PANEL_PRIVATE(o) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_LOCATION_PANEL, CcLocationPanelPrivate))
|
||||
|
||||
#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, s))
|
||||
|
||||
struct _CcLocationPanelPrivate
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GSettings *settings;
|
||||
GSettings *location_settings;
|
||||
GVariant *locations;
|
||||
GDesktopClockFormat clock_format;
|
||||
|
||||
GtkListStore *location_store;
|
||||
/* that's where private vars go I guess */
|
||||
};
|
||||
|
||||
static void
|
||||
populate_locations (GtkListStore *store,
|
||||
GVariant *locations)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GVariantIter viter;
|
||||
GVariant *dict;
|
||||
GVariant *value;
|
||||
|
||||
g_variant_iter_init (&viter, locations);
|
||||
while ((dict = g_variant_iter_next_value (&viter))) {
|
||||
gtk_list_store_append (store, &iter);
|
||||
value = g_variant_lookup_value (dict,
|
||||
"city",
|
||||
G_VARIANT_TYPE_STRING);
|
||||
gtk_list_store_set (store, &iter, 0, g_variant_get_string (value, NULL), -1);
|
||||
|
||||
value = g_variant_lookup_value (dict,
|
||||
"country",
|
||||
G_VARIANT_TYPE_STRING);
|
||||
gtk_list_store_set (store, &iter, 1, g_variant_get_string (value, NULL), -1);
|
||||
|
||||
value = g_variant_lookup_value (dict,
|
||||
"timezone",
|
||||
G_VARIANT_TYPE_INT16);
|
||||
int timezone = g_variant_get_int16 (value);
|
||||
char *tz;
|
||||
if (timezone > 0)
|
||||
tz = g_strdup_printf ("GMT +%i", timezone);
|
||||
else
|
||||
tz = g_strdup_printf ("GMT -%i", timezone);
|
||||
gtk_list_store_set (store, &iter, 2, tz, -1);
|
||||
g_free (tz);
|
||||
|
||||
gtk_list_store_set (store, &iter, 3, "20:00", -1);
|
||||
|
||||
/*value = g_variant_lookup_value (dict,
|
||||
"longitude",
|
||||
G_VARIANT_TYPE_DOUBLE);
|
||||
gtk_list_store_set (store, &iter, 1, g_variant_get_double (value), -1);
|
||||
|
||||
value = g_variant_lookup_value (dict,
|
||||
"latitude",
|
||||
G_VARIANT_TYPE_DOUBLE);
|
||||
gtk_list_store_set (store, &iter, 1, g_variant_get_double (value), -1);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_on_add_location (GtkToolButton *bt,
|
||||
CcLocationPanel *self)
|
||||
{
|
||||
CcLocationPanelPrivate *priv = self->priv;
|
||||
GError *e = NULL;
|
||||
|
||||
gtk_builder_add_from_file (self->priv->builder, GNOMECC_UI_DIR "/add-location.ui", &e);
|
||||
g_assert_no_error (e);
|
||||
|
||||
GtkWidget *dialog = WID ("add-location-dialog");
|
||||
int res = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
switch (res) {
|
||||
case GTK_RESPONSE_OK:
|
||||
printf ("Dialog response OK\n");
|
||||
// FIXME: column ids
|
||||
const char *city = gtk_entry_get_text (GTK_ENTRY (WID ("city-entry")));
|
||||
const char *ctry = gtk_entry_get_text (GTK_ENTRY (WID ("country-entry")));
|
||||
//const char *tz = gtk_entry_get_text (GTK_ENTRY (WID ("tz-entry")));
|
||||
const double longitude = 0.23;
|
||||
const double latitude = 0.32;
|
||||
GVariant *newloc = g_variant_location_new (city, ctry,
|
||||
3, longitude, latitude);
|
||||
priv->locations = g_variant_array_add_value (priv->locations, newloc);
|
||||
g_assert (g_settings_set_value (priv->location_settings,
|
||||
"locations",
|
||||
priv->locations));
|
||||
|
||||
gtk_list_store_clear (priv->location_store);
|
||||
populate_locations (priv->location_store,
|
||||
priv->locations);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
_on_24hr_time_switch (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
CcLocationPanel *self)
|
||||
{
|
||||
CcLocationPanelPrivate *priv = self->priv;
|
||||
GDesktopClockFormat value;
|
||||
|
||||
//g_signal_handlers_block_by_func (priv->settings, clock_settings_changed_cb,
|
||||
// panel);
|
||||
|
||||
if (gtk_switch_get_active (GTK_SWITCH (WID ("24h_time_switch"))))
|
||||
value = G_DESKTOP_CLOCK_FORMAT_24H;
|
||||
else
|
||||
value = G_DESKTOP_CLOCK_FORMAT_12H;
|
||||
|
||||
g_settings_set_enum (priv->settings, CLOCK_FORMAT_KEY, value);
|
||||
priv->clock_format = value;
|
||||
|
||||
/* update_time (panel); */
|
||||
|
||||
/* g_signal_handlers_unblock_by_func (priv->settings, clock_settings_changed_cb, */
|
||||
/* panel); */
|
||||
}
|
||||
|
||||
static void
|
||||
cc_location_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_location_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_location_panel_dispose (GObject *object)
|
||||
{
|
||||
CcLocationPanelPrivate *priv = CC_LOCATION_PANEL (object)->priv;
|
||||
G_OBJECT_CLASS (cc_location_panel_parent_class)->dispose (object);
|
||||
|
||||
if (priv->settings) {
|
||||
g_object_unref (priv->settings);
|
||||
priv->settings = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cc_location_panel_finalize (GObject *object)
|
||||
{
|
||||
CcLocationPanelPrivate *priv = CC_LOCATION_PANEL (object)->priv;
|
||||
G_OBJECT_CLASS (cc_location_panel_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_location_panel_class_init (CcLocationPanelClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (CcLocationPanelPrivate));
|
||||
|
||||
object_class->get_property = cc_location_panel_get_property;
|
||||
object_class->set_property = cc_location_panel_set_property;
|
||||
object_class->dispose = cc_location_panel_dispose;
|
||||
object_class->finalize = cc_location_panel_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
cc_location_panel_class_finalize (CcLocationPanelClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
cc_location_panel_init (CcLocationPanel *self)
|
||||
{
|
||||
GError *error;
|
||||
GtkWidget *widget;
|
||||
GtkStyleContext *context;
|
||||
self->priv = LOCATION_PANEL_PRIVATE (self);
|
||||
|
||||
self->priv->settings = g_settings_new (CLOCK_SCHEMA);
|
||||
self->priv->builder = gtk_builder_new ();
|
||||
self->priv->location_settings = g_settings_new ("org.gnome.desktop.location");
|
||||
|
||||
error = NULL;
|
||||
gtk_builder_add_from_file (self->priv->builder,
|
||||
GNOMECC_UI_DIR "/location.ui",
|
||||
&error);
|
||||
|
||||
if (error != NULL)
|
||||
{
|
||||
g_warning ("Could not load interface file: %s", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_builder_connect_signals (self->priv->builder, NULL);
|
||||
|
||||
self->priv->location_store = (GtkListStore *) gtk_builder_get_object (self->priv->builder,
|
||||
"locations-store");
|
||||
widget = WID ("locations-scrolledwindow");
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
|
||||
|
||||
widget = WID ("location-edit-toolbar");
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_add_class (context, "inline-toolbar");
|
||||
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
|
||||
|
||||
widget = WID ("24h_time_switch");
|
||||
gtk_switch_set_active (GTK_SWITCH (widget),
|
||||
g_settings_get_enum (self->priv->settings, CLOCK_FORMAT_KEY) ==
|
||||
G_DESKTOP_CLOCK_FORMAT_24H);
|
||||
g_signal_connect (widget, "notify::active",
|
||||
G_CALLBACK (_on_24hr_time_switch), self);
|
||||
|
||||
widget = WID ("location-add-button");
|
||||
g_signal_connect (widget, "clicked",
|
||||
G_CALLBACK (_on_add_location), self);
|
||||
|
||||
widget = WID ("location-vbox");
|
||||
gtk_widget_reparent (widget, (GtkWidget *) self);
|
||||
|
||||
self->priv->locations = g_settings_get_value (self->priv->location_settings,
|
||||
"locations");
|
||||
populate_locations (self->priv->location_store, self->priv->locations);
|
||||
}
|
||||
|
||||
void
|
||||
cc_location_panel_register (GIOModule *module)
|
||||
{
|
||||
cc_location_panel_register_type (G_TYPE_MODULE (module));
|
||||
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
|
||||
CC_TYPE_LOCATION_PANEL,
|
||||
"location", 0);
|
||||
}
|
||||
73
panels/location/cc-location-panel.h
Normal file
73
panels/location/cc-location-panel.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
||||
*
|
||||
* Copyright (C) 2010 Red Hat, Inc
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CC_LOCATION_PANEL_H
|
||||
#define _CC_LOCATION_PANEL_H
|
||||
|
||||
#include <libgnome-control-center/cc-panel.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CC_TYPE_LOCATION_PANEL cc_location_panel_get_type()
|
||||
|
||||
#define CC_LOCATION_PANEL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
CC_TYPE_LOCATION_PANEL, CcLocationPanel))
|
||||
|
||||
#define CC_LOCATION_PANEL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
CC_TYPE_LOCATION_PANEL, CcLocationPanelClass))
|
||||
|
||||
#define CC_IS_LOCATION_PANEL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
||||
CC_TYPE_LOCATION_PANEL))
|
||||
|
||||
#define CC_IS_LOCATION_PANEL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
||||
CC_TYPE_LOCATION_PANEL))
|
||||
|
||||
#define CC_LOCATION_PANEL_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||
CC_TYPE_LOCATION_PANEL, CcLocationPanelClass))
|
||||
|
||||
typedef struct _CcLocationPanel CcLocationPanel;
|
||||
typedef struct _CcLocationPanelClass CcLocationPanelClass;
|
||||
typedef struct _CcLocationPanelPrivate CcLocationPanelPrivate;
|
||||
|
||||
struct _CcLocationPanel
|
||||
{
|
||||
CcPanel parent;
|
||||
|
||||
CcLocationPanelPrivate *priv;
|
||||
};
|
||||
|
||||
struct _CcLocationPanelClass
|
||||
{
|
||||
CcPanelClass parent_class;
|
||||
};
|
||||
|
||||
GType cc_location_panel_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void cc_location_panel_register (GIOModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _CC_LOCATION_PANEL_H */
|
||||
BIN
panels/location/data/bg.png
Normal file
BIN
panels/location/data/bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 168 KiB |
17
panels/location/gnome-location-panel.desktop.in.in
Normal file
17
panels/location/gnome-location-panel.desktop.in.in
Normal file
@@ -0,0 +1,17 @@
|
||||
[Desktop Entry]
|
||||
_Name=Location
|
||||
_Comment=Geographical locations and timezones
|
||||
Exec=gnome-control-center location
|
||||
Icon=start-here
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
Categories=GNOME;GTK;Settings;DesktopSettings;X-GNOME-Settings-Panel;X-GNOME-PersonalSettings
|
||||
OnlyShowIn=GNOME;Unity;
|
||||
X-GNOME-Bugzilla-Bugzilla=GNOME
|
||||
X-GNOME-Bugzilla-Product=gnome-control-center
|
||||
X-GNOME-Bugzilla-Component=location
|
||||
X-GNOME-Bugzilla-Version=@VERSION@
|
||||
X-GNOME-Settings-Panel=location
|
||||
# Translators: those are keywords for the brightness and lock control-center panel
|
||||
_X-GNOME-Keywords=Location;Region;Date;Time;Weather;Timezone;
|
||||
41
panels/location/location-module.c
Normal file
41
panels/location/location-module.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
||||
*
|
||||
* Copyright (C) 2010 Red Hat, Inc
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cc-location-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_location_panel_register (module);
|
||||
}
|
||||
|
||||
void
|
||||
g_io_module_unload (GIOModule *module)
|
||||
{
|
||||
}
|
||||
65
panels/location/location-utils.c
Normal file
65
panels/location/location-utils.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright 2009-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 3 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 "location-utils.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
GVariant *
|
||||
g_variant_location_new (const char *city,
|
||||
const char *country,
|
||||
const int timezone,
|
||||
const double latitude,
|
||||
const double longitude)
|
||||
{
|
||||
g_debug ("Creating a new GVariant");
|
||||
GVariantBuilder *builder = g_variant_builder_new (G_VARIANT_TYPE_DICTIONARY);
|
||||
|
||||
g_variant_builder_add_parsed (builder, "{'city', <%s>}", city);
|
||||
g_variant_builder_add_parsed (builder, "{'country', <%s>}", country);
|
||||
g_variant_builder_add_parsed (builder, "{'timezone', <%n>}", timezone);
|
||||
g_variant_builder_add_parsed (builder, "{'longitude', <%d>}", longitude);
|
||||
g_variant_builder_add_parsed (builder, "{'latitude', <%d>}", latitude);
|
||||
|
||||
GVariant *val = g_variant_builder_end (builder);
|
||||
return val;
|
||||
}
|
||||
|
||||
GVariant *
|
||||
g_variant_array_add_value (GVariant *container,
|
||||
GVariant *value)
|
||||
{
|
||||
GVariantBuilder *builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
|
||||
GVariantIter iter;
|
||||
GVariant *val;
|
||||
|
||||
g_variant_iter_init (&iter, container);
|
||||
while ((val = g_variant_iter_next_value (&iter))) {
|
||||
g_variant_builder_add_value (builder, val);
|
||||
}
|
||||
g_variant_builder_add_value (builder, value);
|
||||
|
||||
GVariant *res = g_variant_builder_end (builder);
|
||||
g_variant_builder_unref (builder);
|
||||
|
||||
g_variant_ref_sink (res);
|
||||
return res;
|
||||
}
|
||||
43
panels/location/location-utils.h
Normal file
43
panels/location/location-utils.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright 2009-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 3 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 __LOCATION_UTILS_H__
|
||||
#define __LOCATION_UTILS_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GVariant *
|
||||
g_variant_location_new (const char *city,
|
||||
const char *country,
|
||||
const int timezone,
|
||||
const double latitude,
|
||||
const double longitude);
|
||||
|
||||
GVariant *
|
||||
g_variant_array_add_value (GVariant *container,
|
||||
GVariant *value);
|
||||
|
||||
void
|
||||
g_variant_location_print (GVariant *location);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __LOCATION_UTILS_H */
|
||||
306
panels/location/location.ui
Normal file
306
panels/location/location.ui
Normal file
@@ -0,0 +1,306 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkListStore" id="locations-store">
|
||||
<columns>
|
||||
<!-- column-name city-name -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name country -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name timezone -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name time -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkWindow" id="main-window">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="resizable">False</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="location-vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="pixbuf">bg.png</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">12</property>
|
||||
<property name="margin_right">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="networktime-switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Automatically set time</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="conf_button">
|
||||
<property name="label" translatable="yes">Configure time...</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Use 24-hour time</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="24h_time_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="locations-scrolledwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="min_content_height">133</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">locations-store</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="headers_clickable">False</property>
|
||||
<property name="search_column">0</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="citynamecolumn">
|
||||
<property name="title" translatable="yes">city</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="countrycolumn">
|
||||
<property name="title" translatable="yes">country</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext2">
|
||||
<property name="style">oblique</property>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="tzcolumn">
|
||||
<property name="title" translatable="yes">tz</property>
|
||||
<property name="expand">True</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext3">
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="text">3</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="timecolumn">
|
||||
<property name="title" translatable="yes">time</property>
|
||||
<property name="alignment">1</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext4">
|
||||
<property name="xpad">26</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="scale">1.3300000000000001</property>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="text">2</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="location-edit-toolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_size">1</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="location-add-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label">AddPrinter</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">list-add-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="location-remove-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label">RemovePrinter</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">list-remove-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="location-mark-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">HomeLocation</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">user-home-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">12</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
Reference in New Issue
Block a user