Added skeleton for the preferences code
This commit is contained in:
parent
d5011879f9
commit
8313b4c2a6
@ -12,11 +12,12 @@ BUILT_SOURCES = \
|
||||
$(NULL)
|
||||
|
||||
astrognome_source_files = \
|
||||
ag-app.c \
|
||||
ag-window.c \
|
||||
ag-chart.c \
|
||||
ag-settings.c \
|
||||
astrognome.c \
|
||||
ag-app.c \
|
||||
ag-window.c \
|
||||
ag-chart.c \
|
||||
ag-settings.c \
|
||||
ag-preferences.c \
|
||||
astrognome.c \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "ag-app.h"
|
||||
#include "ag-window.h"
|
||||
#include "ag-chart.h"
|
||||
#include "ag-preferences.h"
|
||||
#include "config.h"
|
||||
#include "astrognome.h"
|
||||
|
||||
@ -65,7 +66,7 @@ new_window_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
|
||||
static void
|
||||
preferences_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
|
||||
{
|
||||
//ag_preferences_show_dialog();
|
||||
ag_preferences_show_dialog();
|
||||
}
|
||||
|
||||
static void
|
||||
|
43
src/ag-preferences.c
Normal file
43
src/ag-preferences.c
Normal file
@ -0,0 +1,43 @@
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "ag-settings.h"
|
||||
|
||||
typedef struct {
|
||||
GtkWidget *dialog;
|
||||
AgSettings *settings;
|
||||
} AgPreferences;
|
||||
|
||||
static AgPreferences *prefs;
|
||||
|
||||
static void
|
||||
ag_preferences_init(void)
|
||||
{
|
||||
GApplication *app;
|
||||
|
||||
if (prefs) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((app = g_application_get_default()) == NULL) {
|
||||
g_warning("Cannot launch preferences: No default application found");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
prefs = g_new0(AgPreferences, 1);
|
||||
prefs->settings = ag_settings_get();
|
||||
}
|
||||
|
||||
void
|
||||
ag_preferences_show_dialog(void)
|
||||
{
|
||||
ag_preferences_init();
|
||||
|
||||
if (prefs->dialog != NULL) {
|
||||
gtk_window_present(GTK_WINDOW(prefs->dialog));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
13
src/ag-preferences.h
Normal file
13
src/ag-preferences.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __AG_PREFERENCES_H__
|
||||
#define __AG_PREFERENCES_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void ag_preferences_show_dialog(void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __AG_PREFERENCES_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user