Uncrustified new code
This commit is contained in:
parent
9ef2d957ff
commit
56a388b86a
@ -5,7 +5,7 @@ G_DEFINE_TYPE(AgSettings, ag_settings, G_TYPE_OBJECT);
|
|||||||
#define AG_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), AG_TYPE_SETTINGS, AgSettingsPrivate))
|
#define AG_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), AG_TYPE_SETTINGS, AgSettingsPrivate))
|
||||||
|
|
||||||
#define SETTINGS_SCHEMA_ID_WINDOW "eu.polonkai.gergely.Astrognome.state.window"
|
#define SETTINGS_SCHEMA_ID_WINDOW "eu.polonkai.gergely.Astrognome.state.window"
|
||||||
#define SETTINGS_SCHEMA_ID_CHART "eu.polonkai.gergely.Astrognome.state.chart"
|
#define SETTINGS_SCHEMA_ID_CHART "eu.polonkai.gergely.Astrognome.state.chart"
|
||||||
|
|
||||||
static AgSettings *singleton = NULL;
|
static AgSettings *singleton = NULL;
|
||||||
|
|
||||||
@ -17,9 +17,9 @@ struct _AgSettingsPrivate {
|
|||||||
static void
|
static void
|
||||||
ag_settings_init(AgSettings *settings)
|
ag_settings_init(AgSettings *settings)
|
||||||
{
|
{
|
||||||
settings->priv = AG_SETTINGS_GET_PRIVATE(settings);
|
settings->priv = AG_SETTINGS_GET_PRIVATE(settings);
|
||||||
settings->priv->settings_window = g_settings_new(SETTINGS_SCHEMA_ID_WINDOW);
|
settings->priv->settings_window = g_settings_new(SETTINGS_SCHEMA_ID_WINDOW);
|
||||||
settings->priv->settings_chart = g_settings_new(SETTINGS_SCHEMA_ID_CHART);
|
settings->priv->settings_chart = g_settings_new(SETTINGS_SCHEMA_ID_CHART);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -46,7 +46,7 @@ ag_settings_class_init(AgSettingsClass *klass)
|
|||||||
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
|
||||||
|
|
||||||
g_type_class_add_private(gobject_class, sizeof(AgSettingsPrivate));
|
g_type_class_add_private(gobject_class, sizeof(AgSettingsPrivate));
|
||||||
gobject_class->dispose = ag_settings_dispose;
|
gobject_class->dispose = ag_settings_dispose;
|
||||||
gobject_class->finalize = ag_settings_finalize;
|
gobject_class->finalize = ag_settings_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ G_BEGIN_DECLS
|
|||||||
#define AG_IS_SETTINGS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), AG_TYPE_SETTINGS))
|
#define AG_IS_SETTINGS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), AG_TYPE_SETTINGS))
|
||||||
#define AG_SETTINGS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), AG_TYPE_SETTINGS, AgSettingsClass))
|
#define AG_SETTINGS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), AG_TYPE_SETTINGS, AgSettingsClass))
|
||||||
|
|
||||||
typedef struct _AgSettings AgSettings;
|
typedef struct _AgSettings AgSettings;
|
||||||
typedef struct _AgSettingsClass AgSettingsClass;
|
typedef struct _AgSettingsClass AgSettingsClass;
|
||||||
typedef struct _AgSettingsPrivate AgSettingsPrivate;
|
typedef struct _AgSettingsPrivate AgSettingsPrivate;
|
||||||
|
|
||||||
struct _AgSettings {
|
struct _AgSettings {
|
||||||
|
@ -559,24 +559,24 @@ ag_window_get_uri(AgWindow *window)
|
|||||||
void
|
void
|
||||||
ag_window_settings_restore(GtkWindow *window, GSettings *settings)
|
ag_window_settings_restore(GtkWindow *window, GSettings *settings)
|
||||||
{
|
{
|
||||||
gint width,
|
gint width,
|
||||||
height;
|
height;
|
||||||
gboolean maximized;
|
gboolean maximized;
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
|
|
||||||
width = g_settings_get_int(settings, "width");
|
width = g_settings_get_int(settings, "width");
|
||||||
height = g_settings_get_int(settings, "height");
|
height = g_settings_get_int(settings, "height");
|
||||||
maximized = g_settings_get_boolean(settings, "maximized");
|
maximized = g_settings_get_boolean(settings, "maximized");
|
||||||
|
|
||||||
if ((width > 1) && (height > 1)) {
|
if ((width > 1) && (height > 1)) {
|
||||||
gint max_width,
|
gint max_width,
|
||||||
max_height;
|
max_height;
|
||||||
|
|
||||||
screen = gtk_widget_get_screen(GTK_WIDGET(window));
|
screen = gtk_widget_get_screen(GTK_WIDGET(window));
|
||||||
max_width = gdk_screen_get_width(screen);
|
max_width = gdk_screen_get_width(screen);
|
||||||
max_height = gdk_screen_get_height(screen);
|
max_height = gdk_screen_get_height(screen);
|
||||||
|
|
||||||
width = CLAMP(width, 0, max_width);
|
width = CLAMP(width, 0, max_width);
|
||||||
height = CLAMP(height, 0, max_height);
|
height = CLAMP(height, 0, max_height);
|
||||||
|
|
||||||
gtk_window_set_default_size(window, width, height);
|
gtk_window_set_default_size(window, width, height);
|
||||||
|
@ -41,7 +41,8 @@ void ag_window_update_from_chart(AgWindow *window);
|
|||||||
void ag_window_set_uri(AgWindow *window,
|
void ag_window_set_uri(AgWindow *window,
|
||||||
const gchar *uri);
|
const gchar *uri);
|
||||||
gchar *ag_window_get_uri(AgWindow *window);
|
gchar *ag_window_get_uri(AgWindow *window);
|
||||||
void ag_window_settings_restore(GtkWindow *window, GSettings *settings);
|
void ag_window_settings_restore(GtkWindow *window,
|
||||||
|
GSettings *settings);
|
||||||
|
|
||||||
#define AG_WINDOW_ERROR (ag_window_error_quark())
|
#define AG_WINDOW_ERROR (ag_window_error_quark())
|
||||||
GQuark ag_window_error_quark(void);
|
GQuark ag_window_error_quark(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user