Second commit.
Adding actions.
This commit is contained in:
+69
@@ -1,2 +1,71 @@
|
|||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
.deps
|
||||||
|
.libs
|
||||||
|
ABOUT-NLS
|
||||||
|
ChangeLog
|
||||||
|
INSTALL
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
aclocal.m4
|
||||||
|
autom4te.cache
|
||||||
|
config.h
|
||||||
|
config.h.in
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
config
|
||||||
|
configure
|
||||||
|
data/gnome-documents-search-provider.ini
|
||||||
|
data/gnome-documents.desktop
|
||||||
|
data/gnome-documents.desktop.in
|
||||||
|
data/org.gnome.Documents.GDataMiner.service
|
||||||
|
data/org.gnome.documents.gschema.valid
|
||||||
|
data/org.gnome.documents.gschema.xml
|
||||||
|
intltool-extract.in
|
||||||
|
intltool-merge.in
|
||||||
|
intltool-update.in
|
||||||
|
libtool
|
||||||
|
m4/
|
||||||
|
omf.make
|
||||||
|
po/*.gmo
|
||||||
|
po/*.header
|
||||||
|
po/*.sed
|
||||||
|
po/*.sin
|
||||||
|
po/.intltool-merge-cache
|
||||||
|
po/Makefile.in.in
|
||||||
|
po/Makevars.template
|
||||||
|
po/POTFILES
|
||||||
|
po/Rules-quot
|
||||||
|
po/stamp-it
|
||||||
|
src/*.gir
|
||||||
|
src/*.typelib
|
||||||
|
src/Makefile
|
||||||
|
src/Makefile.in
|
||||||
|
src/gd-tracker-gdata-miner
|
||||||
|
src/gnome-documents
|
||||||
|
src/gnome-documents-debug
|
||||||
|
src/gnome-documents-search-provider
|
||||||
|
src/path.js
|
||||||
|
src/org.gnome.Documents.SearchProvider.service
|
||||||
|
stamp-h1
|
||||||
|
xmldocs.make
|
||||||
|
*~
|
||||||
|
*.patch
|
||||||
|
*.sw?
|
||||||
|
.emacs.desktop*
|
||||||
|
/data/gnome-calendar.desktop
|
||||||
|
/data/gnome-calendar.desktop.in
|
||||||
|
/data/org.gnome.calendar.gschema.valid
|
||||||
|
/data/org.gnome.calendar.gschema.xml
|
||||||
|
/src/gnome-calendar
|
||||||
|
gnome-calendar.anjuta
|
||||||
.anjuta*
|
.anjuta*
|
||||||
gnome_calendar.anjuta
|
gnome_calendar.anjuta
|
||||||
|
/config.guess
|
||||||
|
/config.sub
|
||||||
|
/depcomp
|
||||||
|
/install-sh
|
||||||
|
/ltmain.sh
|
||||||
|
/missing
|
||||||
|
/mkinstalldirs
|
||||||
|
|||||||
+9
-8
@@ -1,14 +1,10 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
||||||
## Created by Anjuta
|
|
||||||
|
|
||||||
SUBDIRS = src po
|
SUBDIRS = src po doc
|
||||||
|
|
||||||
gnome_calendardocdir = ${prefix}/doc/gnome_calendar
|
gnome_calendardocdir = ${prefix}/doc/gnome_calendar
|
||||||
gnome_calendardoc_DATA = \
|
gnome_calendardoc_DATA = \
|
||||||
README\
|
README\
|
||||||
COPYING\
|
|
||||||
AUTHORS\
|
|
||||||
ChangeLog\
|
|
||||||
INSTALL\
|
INSTALL\
|
||||||
NEWS
|
NEWS
|
||||||
|
|
||||||
@@ -17,8 +13,13 @@ INTLTOOL_FILES = intltool-extract.in \
|
|||||||
intltool-merge.in \
|
intltool-merge.in \
|
||||||
intltool-update.in
|
intltool-update.in
|
||||||
|
|
||||||
EXTRA_DIST = $(gnome_calendardoc_DATA) \
|
EXTRA_DIST = \
|
||||||
$(INTLTOOL_FILES)
|
$(gnome_calendardoc_DATA) \
|
||||||
|
$(INTLTOOL_FILES) \
|
||||||
|
THANKS \
|
||||||
|
TODO \
|
||||||
|
autogen.sh
|
||||||
|
|
||||||
|
|
||||||
DISTCLEANFILES = intltool-extract \
|
DISTCLEANFILES = intltool-extract \
|
||||||
intltool-merge \
|
intltool-merge \
|
||||||
|
|||||||
+67
-19
@@ -1,17 +1,23 @@
|
|||||||
AC_INIT(gnome_calendar, 0.0.1)
|
dnl -*- mode: m4 -*-
|
||||||
|
AC_PREREQ(2.63)
|
||||||
|
AC_INIT([gnome-calendar],[0.0.2],[],[gnome-calendar])
|
||||||
|
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AM_CONFIG_HEADER(config/config.h)
|
||||||
|
AC_CONFIG_SRCDIR([src/main.c])
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
AC_CONFIG_AUX_DIR([config])
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.11])
|
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||||
|
|
||||||
AM_SILENT_RULES([yes])
|
# require automake 1.11
|
||||||
|
AM_INIT_AUTOMAKE([1.11 dist-xz no-dist-gzip tar-ustar foreign])
|
||||||
AC_PROG_CC
|
AM_MAINTAINER_MODE([enable])
|
||||||
|
|
||||||
dnl ***************************************************************************
|
dnl ***************************************************************************
|
||||||
dnl Internationalization
|
dnl Internationalization
|
||||||
dnl ***************************************************************************
|
dnl ***************************************************************************
|
||||||
IT_PROG_INTLTOOL([0.35.0])
|
IT_PROG_INTLTOOL([0.35.0])
|
||||||
|
PKG_PROG_PKG_CONFIG([0.22])
|
||||||
|
|
||||||
GETTEXT_PACKAGE=gnome_calendar
|
GETTEXT_PACKAGE=gnome_calendar
|
||||||
AC_SUBST(GETTEXT_PACKAGE)
|
AC_SUBST(GETTEXT_PACKAGE)
|
||||||
@@ -19,20 +25,62 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
|
|||||||
|
|
||||||
AM_GLIB_GNU_GETTEXT
|
AM_GLIB_GNU_GETTEXT
|
||||||
|
|
||||||
|
## don't rerun to this point if we abort
|
||||||
|
AC_CACHE_SAVE
|
||||||
|
|
||||||
|
AC_PROG_CC
|
||||||
|
AM_PROG_CC_C_O
|
||||||
|
AC_PROG_CXX
|
||||||
|
AC_ISC_POSIX
|
||||||
|
AC_HEADER_STDC
|
||||||
|
|
||||||
|
# no stupid static libraries
|
||||||
|
AM_DISABLE_STATIC
|
||||||
|
# enable libtool
|
||||||
|
AC_PROG_LIBTOOL
|
||||||
|
# avoid libtool for LTCOMPILE, use it only to link
|
||||||
|
|
||||||
|
## don't rerun to this point if we abort
|
||||||
|
AC_CACHE_SAVE
|
||||||
|
|
||||||
LT_INIT
|
LT_INIT
|
||||||
|
|
||||||
PKG_CHECK_MODULES(GNOME_CALENDAR,
|
GLIB_GSETTINGS
|
||||||
[gio-2.0
|
|
||||||
glib-2.0
|
|
||||||
gtk+-3.0 >= 3.4
|
|
||||||
clutter-1.0
|
|
||||||
clutter-gtk-1.0
|
|
||||||
libedataserver-1.2
|
|
||||||
libedataserverui-3.0
|
|
||||||
libecal-1.2])
|
|
||||||
|
|
||||||
AC_OUTPUT([
|
GLIB_MIN_VERSION=2.30.0
|
||||||
Makefile
|
GTK_MIN_VERSION=3.4.0
|
||||||
src/Makefile
|
CLUTTER_MIN_VERSION=1.10
|
||||||
po/Makefile.in
|
CLUTTER_GTK_MIN_VERSION=1.2
|
||||||
|
ECAL_REQUIRED=3.1.5
|
||||||
|
EDATASERVER_REQUIRED=3.1.5
|
||||||
|
EDATASERVERUI_REQUIRED=3.1.5
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES(CALENDAR,
|
||||||
|
glib-2.0 >= $GLIB_MIN_VERSION
|
||||||
|
gtk+-3.0 >= $GTK_MIN_VERSION
|
||||||
|
clutter-1.0 >= CLUTTER_MIN_VERSION
|
||||||
|
clutter-gtk-1.0 >= CLUTTER_GTK_MIN_VERSION
|
||||||
|
libecal-1.2 >= $ECAL_REQUIRED
|
||||||
|
libedataserver-1.2 >= EDATASERVER_REQUIRED
|
||||||
|
libedataserverui-3.0 >= EDATASERVERUI_REQUIRED)
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([
|
||||||
|
Makefile
|
||||||
|
src/Makefile
|
||||||
|
po/Makefile.in
|
||||||
|
doc/Makefile
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AC_OUTPUT
|
||||||
|
|
||||||
|
dnl ==========================================================================
|
||||||
|
echo "
|
||||||
|
|
||||||
|
gnome-calendar $VERSION
|
||||||
|
==================
|
||||||
|
|
||||||
|
prefix: ${prefix}
|
||||||
|
compiler: ${CC}
|
||||||
|
|
||||||
|
Now type 'make' to build $PACKAGE
|
||||||
|
"
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
Some words about how do we work so far:
|
||||||
|
|
||||||
|
1. We load calendar sources from Online Accounts.
|
||||||
|
(So we'll need a view for adding sources, since I refuse
|
||||||
|
to read some gconf key from evolution to load some others.
|
||||||
|
Maybe that's will be the way eventually, but well)
|
||||||
|
|
||||||
|
2. Using sexp for getting objects between two dates:
|
||||||
|
(occur-in-time-range? (make-time "20001116T230000Z") (make-time "20001217T230000Z") "America/New_York")
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
These are some of the flows followed inside the application.
|
||||||
|
|
||||||
|
Adding calendar (gcal_store_add_source)
|
||||||
|
Sources are added defined by an URI, at least for now. I think there's
|
||||||
|
been done on improving this, but for now, there and URI defining every
|
||||||
|
source we're adding.
|
||||||
|
|
||||||
|
- Check if the URI already existed
|
||||||
|
(here will have to take into account relative and absolute URIs)
|
||||||
|
- If it isn't new end processing.
|
||||||
|
- Create the ECalClient, add it to the list.
|
||||||
|
- Open the ECalClient (e_client_open)
|
||||||
|
- Retrieve capabilities ? (ask IRC, what's this) //FIXME this wil be later implemented, when needed
|
||||||
|
- Get Object list based on the existing query
|
||||||
|
- Create ECalClientView using the existing query.
|
||||||
|
- Hook to ECalClientView signals
|
||||||
|
|
||||||
|
Setting a view in the main window (MainWindow.set_view)
|
||||||
|
This will work for setting a new view (the app hasn't instanced a view
|
||||||
|
of that type yet), or for updating an old view with a new time lapse
|
||||||
|
|
||||||
|
- Update GSettings key for keeping active-view-type
|
||||||
|
- Create/Update the view with the active date from MainWindow._date
|
||||||
|
- Retrieve new time range from view.
|
||||||
|
- Update time range in MainWindow._store (a GcalStore)
|
||||||
|
- Hook up to signals emitted from GcalStore to read new events
|
||||||
|
from updated time range
|
||||||
|
- Hook up to signals emitted from GcalStore to get events
|
||||||
|
updates lively
|
||||||
|
- Update MainWindow._view_type
|
||||||
+118
@@ -0,0 +1,118 @@
|
|||||||
|
Rough description of some internals of Gnome Calendar Application
|
||||||
|
|
||||||
|
|
||||||
|
+ mainToolbar object:
|
||||||
|
|
||||||
|
Has 3 states:
|
||||||
|
1. Overview
|
||||||
|
2. View Event
|
||||||
|
3. Edit Event (this one could act as New Event View, or even as New anything view)
|
||||||
|
|
||||||
|
|
||||||
|
+ Global
|
||||||
|
|
||||||
|
Has dconf-key attribute
|
||||||
|
For keeping the last view and last day selected
|
||||||
|
|
||||||
|
Has GcalStore object
|
||||||
|
For managingn source and events, and everything else
|
||||||
|
|
||||||
|
Has a SourceManager object
|
||||||
|
|
||||||
|
|
||||||
|
+ SourceManager
|
||||||
|
|
||||||
|
It's the javascript counter part of GcalStore objects. It will handle adding
|
||||||
|
sources to GcalStore.
|
||||||
|
|
||||||
|
|
||||||
|
+ GcalStore
|
||||||
|
|
||||||
|
Has a list of GcalSToreUnit,
|
||||||
|
Containing:
|
||||||
|
Esource, ECalClient,ECalClientView
|
||||||
|
|
||||||
|
Has a list of ESourceGroup
|
||||||
|
|
||||||
|
Has GDate *initial_date, *final_date
|
||||||
|
For defining a range to get events from
|
||||||
|
Could have an active query representing the range (s-exp)
|
||||||
|
|
||||||
|
Has a list of Events in the active range (a list of ECalComponent)
|
||||||
|
|
||||||
|
Emit signals for:
|
||||||
|
- objects-added (wrapping ECalClientView)
|
||||||
|
- objects-removed (wrapping ECalClientView)
|
||||||
|
- events-retrieved (for time range changing)
|
||||||
|
|
||||||
|
|
||||||
|
+ GcalSource
|
||||||
|
|
||||||
|
Has a base_uri
|
||||||
|
Has a relative uri
|
||||||
|
Has a color
|
||||||
|
|
||||||
|
|
||||||
|
+ GcalApplication
|
||||||
|
|
||||||
|
Has command-line option
|
||||||
|
For opening on the day specified
|
||||||
|
|
||||||
|
|
||||||
|
+ GcalView
|
||||||
|
|
||||||
|
Has NavigationPane
|
||||||
|
Has GDate: selected_date attribute
|
||||||
|
|
||||||
|
Has child classes
|
||||||
|
1. GcalDayView
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
+ GcalEvent
|
||||||
|
|
||||||
|
Has one source
|
||||||
|
|
||||||
|
|
||||||
|
+ GcalMainWindow
|
||||||
|
|
||||||
|
Design
|
||||||
|
|
||||||
|
+- GtkClutter.Embed::ClutterBox(BoxLayout) ----------------------------------+
|
||||||
|
| |
|
||||||
|
| +- _bodyContainer::ClutterBox(BoxLayout) -----------------------------+ |
|
||||||
|
| | | |
|
||||||
|
| | +- _mainToolbar ------------------------------------------------+ | |
|
||||||
|
| | | | | |
|
||||||
|
| | +---------------------------------------------------------------+ | |
|
||||||
|
| | +- _contentsContainer::ClutterBox(BinLayout) -------------------+ | |
|
||||||
|
| | | | | |
|
||||||
|
| | | +- _sourcesView ------------------------------------------+ | | |
|
||||||
|
| | | | | | | |
|
||||||
|
| | | +---------------------------------------------------------+ | | |
|
||||||
|
| | | | | |
|
||||||
|
| | | +- _notebookActor ----------------------------------------+ | | |
|
||||||
|
| | | | | | | |
|
||||||
|
| | | | | | | |
|
||||||
|
| | | | | | | |
|
||||||
|
| | | +---------------------------------------------------------+ | | |
|
||||||
|
| | +---------------------------------------------------------------+ | |
|
||||||
|
| | | |
|
||||||
|
| +---------------------------------------------------------------------+ |
|
||||||
|
+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
Has an active_view attribute
|
||||||
|
For keeping the type view is actually showing
|
||||||
|
|
||||||
|
Has views
|
||||||
|
1. GcalDayView
|
||||||
|
2. GcalWeekView
|
||||||
|
3. GcalMonthView
|
||||||
|
...
|
||||||
|
|
||||||
|
Has GDate attribute
|
||||||
|
For keeping actual date
|
||||||
|
|
||||||
|
Has set_view/update_view method
|
||||||
|
For updating the view content by talking to GcalStore
|
||||||
|
about events an dates of the view
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
EXTRA_DIST= \
|
||||||
|
Assumptions \
|
||||||
|
Flows \
|
||||||
|
Internals
|
||||||
+4
-3
@@ -2,13 +2,13 @@ AM_CPPFLAGS = \
|
|||||||
-DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
|
-DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
|
||||||
-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
|
-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
|
||||||
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
|
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
|
||||||
$(GNOME_CALENDAR_CFLAGS)
|
$(CALENDAR_CFLAGS)
|
||||||
|
|
||||||
AM_CFLAGS =\
|
AM_CFLAGS =\
|
||||||
-Wall\
|
-Wall\
|
||||||
-g
|
-g
|
||||||
|
|
||||||
bin_PROGRAMS = gnome_calendar
|
bin_PROGRAMS = gnome-calendar
|
||||||
|
|
||||||
gnome_calendar_SOURCES = \
|
gnome_calendar_SOURCES = \
|
||||||
main.c \
|
main.c \
|
||||||
@@ -18,6 +18,7 @@ gnome_calendar_SOURCES = \
|
|||||||
gnome_calendar_LDFLAGS = \
|
gnome_calendar_LDFLAGS = \
|
||||||
-Wl,--export-dynamic
|
-Wl,--export-dynamic
|
||||||
|
|
||||||
gnome_calendar_LDADD = $(GNOME_CALENDAR_LIBS)
|
gnome_calendar_LDADD = \
|
||||||
|
$(CALENDAR_LIBS)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+85
-20
@@ -20,42 +20,51 @@
|
|||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
|
struct _GcalApplicationPrivate
|
||||||
G_DEFINE_TYPE (GcalApplication, gnome_calendar, GTK_TYPE_APPLICATION);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gcal_application_new_window (GApplication *app,
|
|
||||||
GFile *file)
|
|
||||||
{
|
{
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
|
};
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
static void gcal_application_startup (GApplication *app);
|
||||||
gtk_window_set_title (GTK_WINDOW (window), _("Calendar"));
|
|
||||||
|
|
||||||
|
static void _gcal_application_set_app_menu (GApplication *app);
|
||||||
|
static void _gcal_application_show_about (GSimpleAction *simple,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data);
|
||||||
|
static void _gcal_application_quit (GSimpleAction *simple,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
gtk_window_set_application (GTK_WINDOW (window), GTK_APPLICATION (app));
|
G_DEFINE_TYPE (GcalApplication, gcal_application, GTK_TYPE_APPLICATION);
|
||||||
gtk_widget_show_all (GTK_WIDGET (window));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GApplication implementation */
|
|
||||||
static void
|
static void
|
||||||
gcal_application_activate (GApplication *application)
|
gcal_application_activate (GApplication *application)
|
||||||
{
|
{
|
||||||
gcal_application_new_window (application, NULL);
|
GcalApplication *app = GCAL_APPLICATION (application);
|
||||||
|
|
||||||
|
if (app->priv->window != NULL)
|
||||||
|
gtk_window_present (GTK_WINDOW (app->priv->window));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app->priv->window = gtk_application_window_new (GTK_APPLICATION (app));
|
||||||
|
gtk_window_set_title (GTK_WINDOW (app->priv->window), _("Calendar"));
|
||||||
|
|
||||||
|
gtk_widget_show_all (GTK_WIDGET (app->priv->window));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gcal_application_init (GcalApplication *object)
|
gcal_application_init (GcalApplication *self)
|
||||||
{
|
{
|
||||||
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||||
|
GCAL_TYPE_APPLICATION,
|
||||||
|
GcalApplicationPrivate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gcal_application_finalize (GObject *object)
|
gcal_application_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
|
|
||||||
G_OBJECT_CLASS (gcal_application_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gcal_application_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,9 +72,64 @@ static void
|
|||||||
gcal_application_class_init (GcalApplicationClass *klass)
|
gcal_application_class_init (GcalApplicationClass *klass)
|
||||||
{
|
{
|
||||||
G_APPLICATION_CLASS (klass)->activate = gcal_application_activate;
|
G_APPLICATION_CLASS (klass)->activate = gcal_application_activate;
|
||||||
G_APPLICATION_CLASS (klass)->open = gcal_application_open;
|
G_APPLICATION_CLASS (klass)->startup = gcal_application_startup;
|
||||||
|
|
||||||
G_OBJECT_CLASS (klass)->finalize = gcal_application_finalize;
|
G_OBJECT_CLASS (klass)->finalize = gcal_application_finalize;
|
||||||
|
|
||||||
|
g_type_class_add_private ((gpointer) klass, sizeof(GcalApplicationPrivate));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gcal_application_startup (GApplication *app)
|
||||||
|
{
|
||||||
|
G_APPLICATION_CLASS (gcal_application_parent_class)->startup (app);
|
||||||
|
|
||||||
|
_gcal_application_set_app_menu (app);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_gcal_application_set_app_menu (GApplication *app)
|
||||||
|
{
|
||||||
|
GMenu *app_menu = g_menu_new ();
|
||||||
|
|
||||||
|
GSimpleAction *about = g_simple_action_new ("about", NULL);
|
||||||
|
g_signal_connect (about,
|
||||||
|
"activate",
|
||||||
|
G_CALLBACK (_gcal_application_show_about),
|
||||||
|
app);
|
||||||
|
g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (about));
|
||||||
|
g_menu_append (app_menu, _("About"), "app.about");
|
||||||
|
|
||||||
|
GSimpleAction *quit = g_simple_action_new ("quit", NULL);
|
||||||
|
g_signal_connect (quit,
|
||||||
|
"activate",
|
||||||
|
G_CALLBACK (_gcal_application_quit),
|
||||||
|
app);
|
||||||
|
g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (quit));
|
||||||
|
g_menu_append (app_menu, _("Quit"), "app.quit");
|
||||||
|
|
||||||
|
gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (app_menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_gcal_application_show_about (GSimpleAction *simple,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GcalApplication *app = GCAL_APPLICATION (user_data);
|
||||||
|
|
||||||
|
gtk_show_about_dialog (GTK_WINDOW (app->priv->window),
|
||||||
|
"program-name", "Calendar",
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _gcal_application_quit (GSimpleAction *simple,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GApplication *app = G_APPLICATION (user_data);
|
||||||
|
|
||||||
|
g_application_quit (app);
|
||||||
}
|
}
|
||||||
|
|
||||||
GcalApplication *
|
GcalApplication *
|
||||||
@@ -73,8 +137,9 @@ gcal_application_new (void)
|
|||||||
{
|
{
|
||||||
g_type_init ();
|
g_type_init ();
|
||||||
|
|
||||||
|
g_set_application_name ("Calendar");
|
||||||
|
|
||||||
return g_object_new (gcal_application_get_type (),
|
return g_object_new (gcal_application_get_type (),
|
||||||
"application-id", "org.gnome.Calendar",
|
"application-id", "org.gnome.Calendar",
|
||||||
"flags", G_APPLICATION_HANDLES_COMMAND_LINE,
|
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ G_BEGIN_DECLS
|
|||||||
#define GCAL_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCAL_TYPE_APPLICATION))
|
#define GCAL_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCAL_TYPE_APPLICATION))
|
||||||
#define GCAL_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCAL_TYPE_APPLICATION, GcalApplicationClass))
|
#define GCAL_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCAL_TYPE_APPLICATION, GcalApplicationClass))
|
||||||
|
|
||||||
typedef struct _GcalApplicationClass GcalApplicationClass;
|
typedef struct _GcalApplicationClass GcalApplicationClass;
|
||||||
typedef struct _GcalApplication GcalApplication;
|
typedef struct _GcalApplication GcalApplication;
|
||||||
|
typedef struct _GcalApplicationPrivate GcalApplicationPrivate;
|
||||||
|
|
||||||
struct _GcalApplicationClass
|
struct _GcalApplicationClass
|
||||||
{
|
{
|
||||||
@@ -44,6 +44,7 @@ struct _GcalApplication
|
|||||||
{
|
{
|
||||||
GtkApplication parent_instance;
|
GtkApplication parent_instance;
|
||||||
|
|
||||||
|
GcalApplicationPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gcal_application_get_type (void) G_GNUC_CONST;
|
GType gcal_application_get_type (void) G_GNUC_CONST;
|
||||||
|
|||||||
Reference in New Issue
Block a user