display: use the setting for 12/24 time in the panel
This commit is contained in:
parent
78d625b5d9
commit
1a4d551780
1 changed files with 14 additions and 0 deletions
|
@ -35,11 +35,15 @@
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <dbus/dbus-glib.h>
|
#include <dbus/dbus-glib.h>
|
||||||
#include <dbus/dbus-glib-bindings.h>
|
#include <dbus/dbus-glib-bindings.h>
|
||||||
|
#include <gsettings-desktop-schemas/gdesktop-enums.h>
|
||||||
|
|
||||||
#include "xrandr-capplet.h"
|
#include "xrandr-capplet.h"
|
||||||
|
|
||||||
#define TOP_BAR_HEIGHT 10
|
#define TOP_BAR_HEIGHT 10
|
||||||
|
|
||||||
|
#define CLOCK_SCHEMA "org.gnome.desktop.interface"
|
||||||
|
#define CLOCK_FORMAT_KEY "clock-format"
|
||||||
|
|
||||||
typedef struct App App;
|
typedef struct App App;
|
||||||
typedef struct GrabInfo GrabInfo;
|
typedef struct GrabInfo GrabInfo;
|
||||||
|
|
||||||
|
@ -50,6 +54,7 @@ struct App
|
||||||
GnomeRRLabeler *labeler;
|
GnomeRRLabeler *labeler;
|
||||||
GnomeRROutputInfo *current_output;
|
GnomeRROutputInfo *current_output;
|
||||||
|
|
||||||
|
GSettings *clock_settings;
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
|
|
||||||
GtkWidget *panel;
|
GtkWidget *panel;
|
||||||
|
@ -1918,6 +1923,7 @@ paint_output (App *app, cairo_t *cr, int i)
|
||||||
char *text;
|
char *text;
|
||||||
gboolean use_24;
|
gboolean use_24;
|
||||||
GDateTime *dt;
|
GDateTime *dt;
|
||||||
|
GDesktopClockFormat value;
|
||||||
|
|
||||||
/* top bar */
|
/* top bar */
|
||||||
cairo_rectangle (cr, x, y, w * scale + 0.5, TOP_BAR_HEIGHT);
|
cairo_rectangle (cr, x, y, w * scale + 0.5, TOP_BAR_HEIGHT);
|
||||||
|
@ -1931,6 +1937,8 @@ paint_output (App *app, cairo_t *cr, int i)
|
||||||
|
|
||||||
/* clock */
|
/* clock */
|
||||||
/* FIXME: set 12/24 hour */
|
/* FIXME: set 12/24 hour */
|
||||||
|
value = g_settings_get_enum (app->clock_settings, CLOCK_FORMAT_KEY);
|
||||||
|
use_24 = value == G_DESKTOP_CLOCK_FORMAT_24H;
|
||||||
if (use_24)
|
if (use_24)
|
||||||
clock_format = _("%a %R");
|
clock_format = _("%a %R");
|
||||||
else
|
else
|
||||||
|
@ -2455,6 +2463,10 @@ destroy_app (App *app)
|
||||||
{
|
{
|
||||||
g_object_unref (app->screen);
|
g_object_unref (app->screen);
|
||||||
g_object_unref (app->builder);
|
g_object_unref (app->builder);
|
||||||
|
|
||||||
|
if (app->clock_settings != NULL)
|
||||||
|
g_object_unref (app->clock_settings);
|
||||||
|
|
||||||
gnome_rr_labeler_hide (app->labeler);
|
gnome_rr_labeler_hide (app->labeler);
|
||||||
g_object_unref (app->labeler);
|
g_object_unref (app->labeler);
|
||||||
|
|
||||||
|
@ -2497,6 +2509,8 @@ run_application (void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app->clock_settings = g_settings_new (CLOCK_SCHEMA);
|
||||||
|
|
||||||
app->panel = _gtk_builder_get_widget (builder, "display-panel");
|
app->panel = _gtk_builder_get_widget (builder, "display-panel");
|
||||||
|
|
||||||
if (!app->panel)
|
if (!app->panel)
|
||||||
|
|
Loading…
Add table
Reference in a new issue