diff options
author | Ted Gould <ted@gould.cx> | 2011-07-07 16:23:04 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-07-07 16:23:04 -0500 |
commit | 1819f029c3f3af6922e095e959e80b1ce446148b (patch) | |
tree | 7f1b50533fb2363bd26918be73dd1349fadb672e /src | |
parent | 7cb01301fdb2e2889d8ab8c09275c25d9dd28f01 (diff) | |
parent | 51c6800c6f718c07bd0cd016a5acdf5652f7e9c4 (diff) | |
download | ayatana-indicator-datetime-1819f029c3f3af6922e095e959e80b1ce446148b.tar.gz ayatana-indicator-datetime-1819f029c3f3af6922e095e959e80b1ce446148b.tar.bz2 ayatana-indicator-datetime-1819f029c3f3af6922e095e959e80b1ce446148b.zip |
Import upstream version 0.2.91
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 13 | ||||
-rw-r--r-- | src/Makefile.in | 253 | ||||
-rw-r--r-- | src/datetime-prefs.c | 387 | ||||
-rw-r--r-- | src/datetime-service.c | 32 | ||||
-rw-r--r-- | src/indicator-datetime.c | 22 | ||||
-rw-r--r-- | src/timezone-completion.c | 21 | ||||
-rw-r--r-- | src/utils.c | 24 | ||||
-rw-r--r-- | src/utils.h | 1 |
8 files changed, 405 insertions, 348 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 6d388c7..6ca07a8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,7 @@ -bin_PROGRAMS = indicator-datetime-preferences +ccpaneldir = $(CCPANELDIR) +ccpanel_LTLIBRARIES = libindicator-datetime.la + libexec_PROGRAMS = indicator-datetime-service indicator_datetime_service_SOURCES = \ @@ -34,6 +36,7 @@ libdatetime_la_SOURCES = \ libdatetime_la_CFLAGS = \ $(INDICATOR_CFLAGS) \ -Wall -Werror \ + -DTIMEZONE_FILE="\"/etc/timezone\"" \ -DG_LOG_DOMAIN=\"Indicator-Datetime\" libdatetime_la_LIBADD = \ $(INDICATOR_LIBS) @@ -41,7 +44,7 @@ libdatetime_la_LDFLAGS = \ -module \ -avoid-version -indicator_datetime_preferences_SOURCES =\ +libindicator_datetime_la_SOURCES =\ datetime-prefs.c \ datetime-prefs-locations.c \ datetime-prefs-locations.h \ @@ -50,15 +53,17 @@ indicator_datetime_preferences_SOURCES =\ utils.c \ utils.h \ settings-shared.h -indicator_datetime_preferences_CFLAGS = \ +libindicator_datetime_la_CFLAGS = \ -Wall \ -Werror \ -I$(top_srcdir)/libmap \ $(PREF_CFLAGS) \ + -DTIMEZONE_FILE="\"/etc/timezone\"" \ -DPKGDATADIR="\"$(pkgdatadir)\"" -indicator_datetime_preferences_LDADD = \ +libindicator_datetime_la_LIBADD = \ $(top_builddir)/libmap/libmap.la \ $(PREF_LIBS) +libindicator_datetime_la_LDFLAGS = -module -avoid-version gen-%.xml.c: %.xml @echo "Building $@ from $<" diff --git a/src/Makefile.in b/src/Makefile.in index 2d9231f..0b4b885 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -35,7 +35,6 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -bin_PROGRAMS = indicator-datetime-preferences$(EXEEXT) libexec_PROGRAMS = indicator-datetime-service$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in @@ -68,9 +67,9 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(datetimelibdir)" "$(DESTDIR)$(bindir)" \ - "$(DESTDIR)$(libexecdir)" -LTLIBRARIES = $(datetimelib_LTLIBRARIES) +am__installdirs = "$(DESTDIR)$(ccpaneldir)" \ + "$(DESTDIR)$(datetimelibdir)" "$(DESTDIR)$(libexecdir)" +LTLIBRARIES = $(ccpanel_LTLIBRARIES) $(datetimelib_LTLIBRARIES) am__DEPENDENCIES_1 = libdatetime_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libdatetime_la_OBJECTS = libdatetime_la-utils.lo \ @@ -83,20 +82,20 @@ libdatetime_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libdatetime_la_CFLAGS) $(CFLAGS) $(libdatetime_la_LDFLAGS) \ $(LDFLAGS) -o $@ -PROGRAMS = $(bin_PROGRAMS) $(libexec_PROGRAMS) -am_indicator_datetime_preferences_OBJECTS = \ - indicator_datetime_preferences-datetime-prefs.$(OBJEXT) \ - indicator_datetime_preferences-datetime-prefs-locations.$(OBJEXT) \ - indicator_datetime_preferences-timezone-completion.$(OBJEXT) \ - indicator_datetime_preferences-utils.$(OBJEXT) -indicator_datetime_preferences_OBJECTS = \ - $(am_indicator_datetime_preferences_OBJECTS) -indicator_datetime_preferences_DEPENDENCIES = \ +libindicator_datetime_la_DEPENDENCIES = \ $(top_builddir)/libmap/libmap.la $(am__DEPENDENCIES_1) -indicator_datetime_preferences_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ +am_libindicator_datetime_la_OBJECTS = \ + libindicator_datetime_la-datetime-prefs.lo \ + libindicator_datetime_la-datetime-prefs-locations.lo \ + libindicator_datetime_la-timezone-completion.lo \ + libindicator_datetime_la-utils.lo +libindicator_datetime_la_OBJECTS = \ + $(am_libindicator_datetime_la_OBJECTS) +libindicator_datetime_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ + $(libindicator_datetime_la_CFLAGS) $(CFLAGS) \ + $(libindicator_datetime_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) am_indicator_datetime_service_OBJECTS = \ indicator_datetime_service-datetime-interface.$(OBJEXT) \ indicator_datetime_service-gen-datetime-service.xml.$(OBJEXT) \ @@ -137,10 +136,10 @@ AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libdatetime_la_SOURCES) \ - $(indicator_datetime_preferences_SOURCES) \ + $(libindicator_datetime_la_SOURCES) \ $(indicator_datetime_service_SOURCES) DIST_SOURCES = $(libdatetime_la_SOURCES) \ - $(indicator_datetime_preferences_SOURCES) \ + $(libindicator_datetime_la_SOURCES) \ $(indicator_datetime_service_SOURCES) ETAGS = etags CTAGS = ctags @@ -158,6 +157,7 @@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ +CCPANELDIR = @CCPANELDIR@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ @@ -304,6 +304,8 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +ccpaneldir = $(CCPANELDIR) +ccpanel_LTLIBRARIES = libindicator-datetime.la indicator_datetime_service_SOURCES = \ datetime-interface.c \ datetime-interface.h \ @@ -339,6 +341,7 @@ libdatetime_la_SOURCES = \ libdatetime_la_CFLAGS = \ $(INDICATOR_CFLAGS) \ -Wall -Werror \ + -DTIMEZONE_FILE="\"/etc/timezone\"" \ -DG_LOG_DOMAIN=\"Indicator-Datetime\" libdatetime_la_LIBADD = \ @@ -348,7 +351,7 @@ libdatetime_la_LDFLAGS = \ -module \ -avoid-version -indicator_datetime_preferences_SOURCES = \ +libindicator_datetime_la_SOURCES = \ datetime-prefs.c \ datetime-prefs-locations.c \ datetime-prefs-locations.h \ @@ -358,17 +361,19 @@ indicator_datetime_preferences_SOURCES = \ utils.h \ settings-shared.h -indicator_datetime_preferences_CFLAGS = \ +libindicator_datetime_la_CFLAGS = \ -Wall \ -Werror \ -I$(top_srcdir)/libmap \ $(PREF_CFLAGS) \ + -DTIMEZONE_FILE="\"/etc/timezone\"" \ -DPKGDATADIR="\"$(pkgdatadir)\"" -indicator_datetime_preferences_LDADD = \ +libindicator_datetime_la_LIBADD = \ $(top_builddir)/libmap/libmap.la \ $(PREF_LIBS) +libindicator_datetime_la_LDFLAGS = -module -avoid-version BUILT_SOURCES = \ gen-datetime-service.xml.c \ gen-datetime-service.xml.h @@ -414,6 +419,37 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +install-ccpanelLTLIBRARIES: $(ccpanel_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(ccpaneldir)" || $(MKDIR_P) "$(DESTDIR)$(ccpaneldir)" + @list='$(ccpanel_LTLIBRARIES)'; test -n "$(ccpaneldir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(ccpaneldir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(ccpaneldir)"; \ + } + +uninstall-ccpanelLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(ccpanel_LTLIBRARIES)'; test -n "$(ccpaneldir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(ccpaneldir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(ccpaneldir)/$$f"; \ + done + +clean-ccpanelLTLIBRARIES: + -test -z "$(ccpanel_LTLIBRARIES)" || rm -f $(ccpanel_LTLIBRARIES) + @list='$(ccpanel_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done install-datetimelibLTLIBRARIES: $(datetimelib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(datetimelibdir)" || $(MKDIR_P) "$(DESTDIR)$(datetimelibdir)" @@ -447,49 +483,8 @@ clean-datetimelibLTLIBRARIES: done libdatetime.la: $(libdatetime_la_OBJECTS) $(libdatetime_la_DEPENDENCIES) $(AM_V_CCLD)$(libdatetime_la_LINK) -rpath $(datetimelibdir) $(libdatetime_la_OBJECTS) $(libdatetime_la_LIBADD) $(LIBS) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p || test -f $$p1; \ - then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list +libindicator-datetime.la: $(libindicator_datetime_la_OBJECTS) $(libindicator_datetime_la_DEPENDENCIES) + $(AM_V_CCLD)$(libindicator_datetime_la_LINK) -rpath $(ccpaneldir) $(libindicator_datetime_la_OBJECTS) $(libindicator_datetime_la_LIBADD) $(LIBS) install-libexecPROGRAMS: $(libexec_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)" @@ -533,9 +528,6 @@ clean-libexecPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -indicator-datetime-preferences$(EXEEXT): $(indicator_datetime_preferences_OBJECTS) $(indicator_datetime_preferences_DEPENDENCIES) - @rm -f indicator-datetime-preferences$(EXEEXT) - $(AM_V_CCLD)$(indicator_datetime_preferences_LINK) $(indicator_datetime_preferences_OBJECTS) $(indicator_datetime_preferences_LDADD) $(LIBS) indicator-datetime-service$(EXEEXT): $(indicator_datetime_service_OBJECTS) $(indicator_datetime_service_DEPENDENCIES) @rm -f indicator-datetime-service$(EXEEXT) $(AM_V_CCLD)$(indicator_datetime_service_LINK) $(indicator_datetime_service_OBJECTS) $(indicator_datetime_service_LDADD) $(LIBS) @@ -546,10 +538,6 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_preferences-datetime-prefs-locations.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_preferences-datetime-prefs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_preferences-timezone-completion.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_preferences-utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-calendar-menu-item.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-datetime-interface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-datetime-service.Po@am__quote@ @@ -557,6 +545,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdatetime_la-indicator-datetime.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdatetime_la-utils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libindicator_datetime_la-datetime-prefs-locations.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libindicator_datetime_la-datetime-prefs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libindicator_datetime_la-timezone-completion.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libindicator_datetime_la-utils.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -598,69 +590,37 @@ libdatetime_la-indicator-datetime.lo: indicator-datetime.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdatetime_la_CFLAGS) $(CFLAGS) -c -o libdatetime_la-indicator-datetime.lo `test -f 'indicator-datetime.c' || echo '$(srcdir)/'`indicator-datetime.c -indicator_datetime_preferences-datetime-prefs.o: datetime-prefs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -MT indicator_datetime_preferences-datetime-prefs.o -MD -MP -MF $(DEPDIR)/indicator_datetime_preferences-datetime-prefs.Tpo -c -o indicator_datetime_preferences-datetime-prefs.o `test -f 'datetime-prefs.c' || echo '$(srcdir)/'`datetime-prefs.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_preferences-datetime-prefs.Tpo $(DEPDIR)/indicator_datetime_preferences-datetime-prefs.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='datetime-prefs.c' object='indicator_datetime_preferences-datetime-prefs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -c -o indicator_datetime_preferences-datetime-prefs.o `test -f 'datetime-prefs.c' || echo '$(srcdir)/'`datetime-prefs.c - -indicator_datetime_preferences-datetime-prefs.obj: datetime-prefs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -MT indicator_datetime_preferences-datetime-prefs.obj -MD -MP -MF $(DEPDIR)/indicator_datetime_preferences-datetime-prefs.Tpo -c -o indicator_datetime_preferences-datetime-prefs.obj `if test -f 'datetime-prefs.c'; then $(CYGPATH_W) 'datetime-prefs.c'; else $(CYGPATH_W) '$(srcdir)/datetime-prefs.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_preferences-datetime-prefs.Tpo $(DEPDIR)/indicator_datetime_preferences-datetime-prefs.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='datetime-prefs.c' object='indicator_datetime_preferences-datetime-prefs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -c -o indicator_datetime_preferences-datetime-prefs.obj `if test -f 'datetime-prefs.c'; then $(CYGPATH_W) 'datetime-prefs.c'; else $(CYGPATH_W) '$(srcdir)/datetime-prefs.c'; fi` - -indicator_datetime_preferences-datetime-prefs-locations.o: datetime-prefs-locations.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -MT indicator_datetime_preferences-datetime-prefs-locations.o -MD -MP -MF $(DEPDIR)/indicator_datetime_preferences-datetime-prefs-locations.Tpo -c -o indicator_datetime_preferences-datetime-prefs-locations.o `test -f 'datetime-prefs-locations.c' || echo '$(srcdir)/'`datetime-prefs-locations.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_preferences-datetime-prefs-locations.Tpo $(DEPDIR)/indicator_datetime_preferences-datetime-prefs-locations.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='datetime-prefs-locations.c' object='indicator_datetime_preferences-datetime-prefs-locations.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -c -o indicator_datetime_preferences-datetime-prefs-locations.o `test -f 'datetime-prefs-locations.c' || echo '$(srcdir)/'`datetime-prefs-locations.c - -indicator_datetime_preferences-datetime-prefs-locations.obj: datetime-prefs-locations.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -MT indicator_datetime_preferences-datetime-prefs-locations.obj -MD -MP -MF $(DEPDIR)/indicator_datetime_preferences-datetime-prefs-locations.Tpo -c -o indicator_datetime_preferences-datetime-prefs-locations.obj `if test -f 'datetime-prefs-locations.c'; then $(CYGPATH_W) 'datetime-prefs-locations.c'; else $(CYGPATH_W) '$(srcdir)/datetime-prefs-locations.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_preferences-datetime-prefs-locations.Tpo $(DEPDIR)/indicator_datetime_preferences-datetime-prefs-locations.Po +libindicator_datetime_la-datetime-prefs.lo: datetime-prefs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libindicator_datetime_la_CFLAGS) $(CFLAGS) -MT libindicator_datetime_la-datetime-prefs.lo -MD -MP -MF $(DEPDIR)/libindicator_datetime_la-datetime-prefs.Tpo -c -o libindicator_datetime_la-datetime-prefs.lo `test -f 'datetime-prefs.c' || echo '$(srcdir)/'`datetime-prefs.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libindicator_datetime_la-datetime-prefs.Tpo $(DEPDIR)/libindicator_datetime_la-datetime-prefs.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='datetime-prefs-locations.c' object='indicator_datetime_preferences-datetime-prefs-locations.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='datetime-prefs.c' object='libindicator_datetime_la-datetime-prefs.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -c -o indicator_datetime_preferences-datetime-prefs-locations.obj `if test -f 'datetime-prefs-locations.c'; then $(CYGPATH_W) 'datetime-prefs-locations.c'; else $(CYGPATH_W) '$(srcdir)/datetime-prefs-locations.c'; fi` +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libindicator_datetime_la_CFLAGS) $(CFLAGS) -c -o libindicator_datetime_la-datetime-prefs.lo `test -f 'datetime-prefs.c' || echo '$(srcdir)/'`datetime-prefs.c -indicator_datetime_preferences-timezone-completion.o: timezone-completion.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -MT indicator_datetime_preferences-timezone-completion.o -MD -MP -MF $(DEPDIR)/indicator_datetime_preferences-timezone-completion.Tpo -c -o indicator_datetime_preferences-timezone-completion.o `test -f 'timezone-completion.c' || echo '$(srcdir)/'`timezone-completion.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_preferences-timezone-completion.Tpo $(DEPDIR)/indicator_datetime_preferences-timezone-completion.Po +libindicator_datetime_la-datetime-prefs-locations.lo: datetime-prefs-locations.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libindicator_datetime_la_CFLAGS) $(CFLAGS) -MT libindicator_datetime_la-datetime-prefs-locations.lo -MD -MP -MF $(DEPDIR)/libindicator_datetime_la-datetime-prefs-locations.Tpo -c -o libindicator_datetime_la-datetime-prefs-locations.lo `test -f 'datetime-prefs-locations.c' || echo '$(srcdir)/'`datetime-prefs-locations.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libindicator_datetime_la-datetime-prefs-locations.Tpo $(DEPDIR)/libindicator_datetime_la-datetime-prefs-locations.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timezone-completion.c' object='indicator_datetime_preferences-timezone-completion.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='datetime-prefs-locations.c' object='libindicator_datetime_la-datetime-prefs-locations.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -c -o indicator_datetime_preferences-timezone-completion.o `test -f 'timezone-completion.c' || echo '$(srcdir)/'`timezone-completion.c +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libindicator_datetime_la_CFLAGS) $(CFLAGS) -c -o libindicator_datetime_la-datetime-prefs-locations.lo `test -f 'datetime-prefs-locations.c' || echo '$(srcdir)/'`datetime-prefs-locations.c -indicator_datetime_preferences-timezone-completion.obj: timezone-completion.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -MT indicator_datetime_preferences-timezone-completion.obj -MD -MP -MF $(DEPDIR)/indicator_datetime_preferences-timezone-completion.Tpo -c -o indicator_datetime_preferences-timezone-completion.obj `if test -f 'timezone-completion.c'; then $(CYGPATH_W) 'timezone-completion.c'; else $(CYGPATH_W) '$(srcdir)/timezone-completion.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_preferences-timezone-completion.Tpo $(DEPDIR)/indicator_datetime_preferences-timezone-completion.Po +libindicator_datetime_la-timezone-completion.lo: timezone-completion.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libindicator_datetime_la_CFLAGS) $(CFLAGS) -MT libindicator_datetime_la-timezone-completion.lo -MD -MP -MF $(DEPDIR)/libindicator_datetime_la-timezone-completion.Tpo -c -o libindicator_datetime_la-timezone-completion.lo `test -f 'timezone-completion.c' || echo '$(srcdir)/'`timezone-completion.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libindicator_datetime_la-timezone-completion.Tpo $(DEPDIR)/libindicator_datetime_la-timezone-completion.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timezone-completion.c' object='indicator_datetime_preferences-timezone-completion.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timezone-completion.c' object='libindicator_datetime_la-timezone-completion.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -c -o indicator_datetime_preferences-timezone-completion.obj `if test -f 'timezone-completion.c'; then $(CYGPATH_W) 'timezone-completion.c'; else $(CYGPATH_W) '$(srcdir)/timezone-completion.c'; fi` +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libindicator_datetime_la_CFLAGS) $(CFLAGS) -c -o libindicator_datetime_la-timezone-completion.lo `test -f 'timezone-completion.c' || echo '$(srcdir)/'`timezone-completion.c -indicator_datetime_preferences-utils.o: utils.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -MT indicator_datetime_preferences-utils.o -MD -MP -MF $(DEPDIR)/indicator_datetime_preferences-utils.Tpo -c -o indicator_datetime_preferences-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_preferences-utils.Tpo $(DEPDIR)/indicator_datetime_preferences-utils.Po +libindicator_datetime_la-utils.lo: utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libindicator_datetime_la_CFLAGS) $(CFLAGS) -MT libindicator_datetime_la-utils.lo -MD -MP -MF $(DEPDIR)/libindicator_datetime_la-utils.Tpo -c -o libindicator_datetime_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libindicator_datetime_la-utils.Tpo $(DEPDIR)/libindicator_datetime_la-utils.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='indicator_datetime_preferences-utils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='libindicator_datetime_la-utils.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -c -o indicator_datetime_preferences-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c - -indicator_datetime_preferences-utils.obj: utils.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -MT indicator_datetime_preferences-utils.obj -MD -MP -MF $(DEPDIR)/indicator_datetime_preferences-utils.Tpo -c -o indicator_datetime_preferences-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_preferences-utils.Tpo $(DEPDIR)/indicator_datetime_preferences-utils.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='indicator_datetime_preferences-utils.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_preferences_CFLAGS) $(CFLAGS) -c -o indicator_datetime_preferences-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi` +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libindicator_datetime_la_CFLAGS) $(CFLAGS) -c -o libindicator_datetime_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c indicator_datetime_service-datetime-interface.o: datetime-interface.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -MT indicator_datetime_service-datetime-interface.o -MD -MP -MF $(DEPDIR)/indicator_datetime_service-datetime-interface.Tpo -c -o indicator_datetime_service-datetime-interface.o `test -f 'datetime-interface.c' || echo '$(srcdir)/'`datetime-interface.c @@ -835,7 +795,7 @@ check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) installdirs: - for dir in "$(DESTDIR)$(datetimelibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)"; do \ + for dir in "$(DESTDIR)$(ccpaneldir)" "$(DESTDIR)$(datetimelibdir)" "$(DESTDIR)$(libexecdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -868,8 +828,9 @@ maintainer-clean-generic: -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am -clean-am: clean-binPROGRAMS clean-datetimelibLTLIBRARIES clean-generic \ - clean-libexecPROGRAMS clean-libtool mostlyclean-am +clean-am: clean-ccpanelLTLIBRARIES clean-datetimelibLTLIBRARIES \ + clean-generic clean-libexecPROGRAMS clean-libtool \ + mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -889,13 +850,14 @@ info: info-am info-am: -install-data-am: install-datetimelibLTLIBRARIES +install-data-am: install-ccpanelLTLIBRARIES \ + install-datetimelibLTLIBRARIES install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-binPROGRAMS install-libexecPROGRAMS +install-exec-am: install-libexecPROGRAMS install-html: install-html-am @@ -935,26 +897,27 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-datetimelibLTLIBRARIES \ - uninstall-libexecPROGRAMS +uninstall-am: uninstall-ccpanelLTLIBRARIES \ + uninstall-datetimelibLTLIBRARIES uninstall-libexecPROGRAMS .MAKE: all check install install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-datetimelibLTLIBRARIES clean-generic \ - clean-libexecPROGRAMS clean-libtool ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-binPROGRAMS install-data \ - install-data-am install-datetimelibLTLIBRARIES install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am \ - install-libexecPROGRAMS install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-binPROGRAMS \ +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-ccpanelLTLIBRARIES clean-datetimelibLTLIBRARIES \ + clean-generic clean-libexecPROGRAMS clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am \ + install-ccpanelLTLIBRARIES install-data install-data-am \ + install-datetimelibLTLIBRARIES install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libexecPROGRAMS \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-ccpanelLTLIBRARIES \ uninstall-datetimelibLTLIBRARIES uninstall-libexecPROGRAMS diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c index 85068c7..bed5ff1 100644 --- a/src/datetime-prefs.c +++ b/src/datetime-prefs.c @@ -34,6 +34,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <gtk/gtk.h> #include <unique/unique.h> #include <polkit/polkit.h> +#include <libgnome-control-center/cc-panel.h> #include "dbus-shared.h" #include "settings-shared.h" @@ -44,16 +45,40 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #define DATETIME_DIALOG_UI_FILE PKGDATADIR "/datetime-dialog.ui" -GDBusProxy * proxy = NULL; -GtkWidget * auto_radio = NULL; -GtkWidget * tz_entry = NULL; -CcTimezoneMap * tzmap = NULL; -GtkWidget * time_spin = NULL; -GtkWidget * date_spin = NULL; -guint save_time_id = 0; -gboolean user_edited_time = FALSE; -gboolean changing_time = FALSE; -GtkWidget * loc_dlg = NULL; +#define INDICATOR_DATETIME_TYPE_PANEL indicator_datetime_panel_get_type() + +typedef struct _IndicatorDatetimePanel IndicatorDatetimePanel; +typedef struct _IndicatorDatetimePanelPrivate IndicatorDatetimePanelPrivate; +typedef struct _IndicatorDatetimePanelClass IndicatorDatetimePanelClass; + +struct _IndicatorDatetimePanel +{ + CcPanel parent; + IndicatorDatetimePanelPrivate * priv; +}; + +struct _IndicatorDatetimePanelPrivate +{ + GtkBuilder * builder; + GDBusProxy * proxy; + GtkWidget * auto_radio; + GtkWidget * tz_entry; + CcTimezoneMap * tzmap; + GtkWidget * time_spin; + GtkWidget * date_spin; + guint save_time_id; + gboolean user_edited_time; + gboolean changing_time; + GtkWidget * loc_dlg; + TimezoneCompletion * completion; +}; + +struct _IndicatorDatetimePanelClass +{ + CcPanelClass parent_class; +}; + +G_DEFINE_DYNAMIC_TYPE (IndicatorDatetimePanel, indicator_datetime_panel, CC_TYPE_PANEL) /* Turns the boolean property into a string gsettings */ static GVariant * @@ -164,7 +189,7 @@ static void dbus_set_answered (GObject *object, GAsyncResult *res, gpointer command) { GError * error = NULL; - GVariant * answers = g_dbus_proxy_call_finish (proxy, res, &error); + GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); if (error != NULL) { g_warning("Could not set '%s' for SettingsDaemon: %s", (gchar *)command, error->message); @@ -176,19 +201,19 @@ dbus_set_answered (GObject *object, GAsyncResult *res, gpointer command) } static void -toggle_ntp (GtkWidget * radio, GParamSpec * pspec, gpointer user_data) +toggle_ntp (GtkWidget * radio, GParamSpec * pspec, IndicatorDatetimePanel * self) { gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)); - g_dbus_proxy_call (proxy, "SetUsingNtp", g_variant_new ("(b)", active), + g_dbus_proxy_call (self->priv->proxy, "SetUsingNtp", g_variant_new ("(b)", active), G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "using_ntp"); } static void -ntp_query_answered (GObject *object, GAsyncResult *res, gpointer user_data) +ntp_query_answered (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) { GError * error = NULL; - GVariant * answers = g_dbus_proxy_call_finish (proxy, res, &error); + GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); if (error != NULL) { g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message); @@ -199,43 +224,42 @@ ntp_query_answered (GObject *object, GAsyncResult *res, gpointer user_data) gboolean can_use_ntp, is_using_ntp; g_variant_get (answers, "(bb)", &can_use_ntp, &is_using_ntp); - gtk_widget_set_sensitive (GTK_WIDGET (auto_radio), can_use_ntp); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (auto_radio), is_using_ntp); + gtk_widget_set_sensitive (GTK_WIDGET (self->priv->auto_radio), can_use_ntp); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->auto_radio), is_using_ntp); - g_signal_connect (auto_radio, "notify::active", G_CALLBACK (toggle_ntp), NULL); + g_signal_connect (self->priv->auto_radio, "notify::active", G_CALLBACK (toggle_ntp), self); g_variant_unref (answers); } static void -sync_entry (const gchar * location) +sync_entry (IndicatorDatetimePanel * self, const gchar * location) { gchar * name = get_current_zone_name (location); - gtk_entry_set_text (GTK_ENTRY (tz_entry), name); + gtk_entry_set_text (GTK_ENTRY (self->priv->tz_entry), name); g_free (name); - gtk_entry_set_icon_from_stock (GTK_ENTRY (tz_entry), GTK_ENTRY_ICON_SECONDARY, NULL); + gtk_entry_set_icon_from_stock (GTK_ENTRY (self->priv->tz_entry), + GTK_ENTRY_ICON_SECONDARY, NULL); } static void -tz_changed (CcTimezoneMap * map, TzLocation * location) +tz_changed (CcTimezoneMap * map, TzLocation * location, IndicatorDatetimePanel * self) { if (location == NULL) return; - gchar * file = g_build_filename ("/usr/share/zoneinfo", location->zone, NULL); - g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(s)", file), + g_dbus_proxy_call (self->priv->proxy, "SetTimezone", g_variant_new ("(s)", location->zone), G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "timezone"); - g_free (file); - sync_entry (location->zone); + sync_entry (self, location->zone); } static void -tz_query_answered (GObject *object, GAsyncResult *res, gpointer user_data) +tz_query_answered (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) { GError * error = NULL; - GVariant * answers = g_dbus_proxy_call_finish (proxy, res, &error); + GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); if (error != NULL) { g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message); @@ -246,20 +270,20 @@ tz_query_answered (GObject *object, GAsyncResult *res, gpointer user_data) const gchar * timezone; g_variant_get (answers, "(&s)", &timezone); - cc_timezone_map_set_timezone (tzmap, timezone); + cc_timezone_map_set_timezone (self->priv->tzmap, timezone); - sync_entry (timezone); - g_signal_connect (tzmap, "location-changed", G_CALLBACK (tz_changed), NULL); + sync_entry (self, timezone); + g_signal_connect (self->priv->tzmap, "location-changed", G_CALLBACK (tz_changed), self); g_variant_unref (answers); } static void -proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data) +proxy_ready (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) { GError * error = NULL; - proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + self->priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error); if (error != NULL) { g_critical("Could not grab DBus proxy for SettingsDaemon: %s", error->message); @@ -268,10 +292,10 @@ proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data) } /* And now, do initial proxy configuration */ - g_dbus_proxy_call (proxy, "GetUsingNtp", NULL, G_DBUS_CALL_FLAGS_NONE, -1, - NULL, ntp_query_answered, auto_radio); - g_dbus_proxy_call (proxy, "GetTimezone", NULL, G_DBUS_CALL_FLAGS_NONE, -1, - NULL, tz_query_answered, NULL); + g_dbus_proxy_call (self->priv->proxy, "GetUsingNtp", NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, (GAsyncReadyCallback)ntp_query_answered, self); + g_dbus_proxy_call (self->priv->proxy, "GetTimezone", NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, (GAsyncReadyCallback)tz_query_answered, self); } static void @@ -290,7 +314,7 @@ service_proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data) { GError * error = NULL; - proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish (res, &error); if (error != NULL) { g_critical("Could not grab DBus proxy for indicator-datetime-service: %s", error->message); @@ -304,51 +328,53 @@ service_proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data) } static gboolean -are_spinners_focused (void) +are_spinners_focused (IndicatorDatetimePanel * self) { // save_time_id means that we were in focus and haven't finished our save // yet, so act like we are still focused. - return save_time_id || gtk_widget_has_focus (time_spin) || gtk_widget_has_focus (date_spin); + return self->priv->save_time_id || + gtk_widget_has_focus (self->priv->time_spin) || + gtk_widget_has_focus (self->priv->date_spin); } static gboolean -save_time (gpointer user_data) +save_time (IndicatorDatetimePanel * self) { - if (user_edited_time) { - gdouble current_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (date_spin)); - g_dbus_proxy_call (proxy, "SetTime", g_variant_new ("(x)", (guint64)current_value), + if (self->priv->user_edited_time) { + gdouble current_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (self->priv->date_spin)); + g_dbus_proxy_call (self->priv->proxy, "SetTime", g_variant_new ("(x)", (guint64)current_value), G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "time"); } - user_edited_time = FALSE; - save_time_id = 0; + self->priv->user_edited_time = FALSE; + self->priv->save_time_id = 0; return FALSE; } static gboolean -spin_focus_in (void) +spin_focus_in (IndicatorDatetimePanel * self) { - if (save_time_id > 0) { - g_source_remove (save_time_id); - save_time_id = 0; + if (self->priv->save_time_id > 0) { + g_source_remove (self->priv->save_time_id); + self->priv->save_time_id = 0; } return FALSE; } static gboolean -spin_focus_out (void) +spin_focus_out (IndicatorDatetimePanel * self) { /* We want to only save when both spinners are unfocused. But it's difficult to tell who is about to get focus during a focus-out. So we set an idle callback to save the time if we don't focus in to another spinner by that time. */ - if (save_time_id == 0) { - save_time_id = g_idle_add ((GSourceFunc)save_time, NULL); + if (self->priv->save_time_id == 0) { + self->priv->save_time_id = g_idle_add ((GSourceFunc)save_time, self); } return FALSE; } static int -input_time_text (GtkWidget * spinner, gdouble * value, gpointer user_data) +input_time_text (GtkWidget * spinner, gdouble * value, IndicatorDatetimePanel * self) { gboolean is_time = (gboolean)GPOINTER_TO_INT (g_object_get_data (G_OBJECT (spinner), "is-time")); const gchar * text = gtk_entry_get_text (GTK_ENTRY (spinner)); @@ -427,13 +453,13 @@ input_time_text (GtkWidget * spinner, gdouble * value, gpointer user_data) return TRUE; } - gboolean prev_changing = changing_time; - changing_time = TRUE; + gboolean prev_changing = self->priv->changing_time; + self->priv->changing_time = TRUE; GDateTime * new_time = g_date_time_new_local (year, month, day, hour, minute, second); *value = g_date_time_to_unix (new_time); - user_edited_time = TRUE; + self->priv->user_edited_time = TRUE; g_date_time_unref (new_time); - changing_time = prev_changing; + self->priv->changing_time = prev_changing; return TRUE; } @@ -464,89 +490,98 @@ format_time_text (GtkWidget * spinner, gpointer user_data) } static void -spin_copy_value (GtkSpinButton * spinner, GtkSpinButton * other) +spin_copy_value (GtkSpinButton * spinner, IndicatorDatetimePanel * self) { + GtkSpinButton * other = NULL; + if (GTK_WIDGET (spinner) == self->priv->date_spin) + other = GTK_SPIN_BUTTON (self->priv->time_spin); + else + other = GTK_SPIN_BUTTON (self->priv->date_spin); + if (gtk_spin_button_get_value (spinner) != gtk_spin_button_get_value (other)) { gtk_spin_button_set_value (other, gtk_spin_button_get_value (spinner)); } - if (!changing_time) { /* Means user pressed spin buttons */ - user_edited_time = TRUE; + if (!self->priv->changing_time) { /* Means user pressed spin buttons */ + self->priv->user_edited_time = TRUE; } } static gboolean -update_spinners (void) +update_spinners (IndicatorDatetimePanel * self) { /* Add datetime object to spinner, which will hold the real time value, rather then using the value of the spinner itself. And don't update while user is editing. */ - if (!are_spinners_focused ()) { - gboolean prev_changing = changing_time; - changing_time = TRUE; + if (!are_spinners_focused (self)) { + gboolean prev_changing = self->priv->changing_time; + self->priv->changing_time = TRUE; GDateTime * now = g_date_time_new_now_local (); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (time_spin), (gdouble)g_date_time_to_unix (now)); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (self->priv->time_spin), + (gdouble)g_date_time_to_unix (now)); /* will be copied to other spin button */ g_date_time_unref (now); - changing_time = prev_changing; + self->priv->changing_time = prev_changing; } return TRUE; } static void -setup_time_spinners (GtkWidget * time, GtkWidget * date) +setup_time_spinners (IndicatorDatetimePanel * self, GtkWidget * time, GtkWidget * date) { - g_signal_connect (time, "input", G_CALLBACK (input_time_text), date); - g_signal_connect (date, "input", G_CALLBACK (input_time_text), time); + g_signal_connect (time, "input", G_CALLBACK (input_time_text), self); + g_signal_connect (date, "input", G_CALLBACK (input_time_text), self); g_signal_connect (time, "output", G_CALLBACK (format_time_text), date); g_signal_connect (date, "output", G_CALLBACK (format_time_text), time); - g_signal_connect (time, "focus-in-event", G_CALLBACK (spin_focus_in), date); - g_signal_connect (date, "focus-in-event", G_CALLBACK (spin_focus_in), time); + g_signal_connect_swapped (time, "focus-in-event", G_CALLBACK (spin_focus_in), self); + g_signal_connect_swapped (date, "focus-in-event", G_CALLBACK (spin_focus_in), self); - g_signal_connect (time, "focus-out-event", G_CALLBACK (spin_focus_out), date); - g_signal_connect (date, "focus-out-event", G_CALLBACK (spin_focus_out), time); + g_signal_connect_swapped (time, "focus-out-event", G_CALLBACK (spin_focus_out), self); + g_signal_connect_swapped (date, "focus-out-event", G_CALLBACK (spin_focus_out), self); - g_signal_connect (time, "value-changed", G_CALLBACK (spin_copy_value), date); - g_signal_connect (date, "value-changed", G_CALLBACK (spin_copy_value), time); + g_signal_connect (time, "value-changed", G_CALLBACK (spin_copy_value), self); + g_signal_connect (date, "value-changed", G_CALLBACK (spin_copy_value), self); g_object_set_data (G_OBJECT (time), "is-time", GINT_TO_POINTER (TRUE)); g_object_set_data (G_OBJECT (date), "is-time", GINT_TO_POINTER (FALSE)); - time_spin = time; - date_spin = date; + self->priv->time_spin = time; + self->priv->date_spin = date; /* 2 seconds is what the indicator itself uses */ - guint time_id = g_timeout_add_seconds (2, (GSourceFunc)update_spinners, NULL); - g_signal_connect_swapped (time_spin, "destroy", G_CALLBACK (g_source_remove), GINT_TO_POINTER (time_id)); - update_spinners (); + guint time_id = g_timeout_add_seconds (2, (GSourceFunc)update_spinners, self); + g_signal_connect_swapped (self->priv->time_spin, "destroy", + G_CALLBACK (g_source_remove), GINT_TO_POINTER (time_id)); + update_spinners (self); } static void -hide_locations () +hide_locations (IndicatorDatetimePanel * self) { - if (loc_dlg != NULL) - gtk_widget_destroy (loc_dlg); + if (self->priv->loc_dlg != NULL) + gtk_widget_destroy (self->priv->loc_dlg); } static void -show_locations (GtkWidget * button, GtkWidget * dlg) -{ - if (loc_dlg == NULL) { - loc_dlg = datetime_setup_locations_dialog (tzmap); - gtk_window_set_transient_for (GTK_WINDOW (loc_dlg), GTK_WINDOW (dlg)); - g_signal_connect (loc_dlg, "destroy", G_CALLBACK (gtk_widget_destroyed), &loc_dlg); - g_signal_connect (dlg, "focus-in-event", G_CALLBACK (hide_locations), NULL); - gtk_widget_show_all (loc_dlg); +show_locations (IndicatorDatetimePanel * self) +{ + if (self->priv->loc_dlg == NULL) { + self->priv->loc_dlg = datetime_setup_locations_dialog (self->priv->tzmap); + GtkWidget * dlg = gtk_widget_get_toplevel (GTK_WIDGET (self)); + gtk_window_set_transient_for (GTK_WINDOW (self->priv->loc_dlg), GTK_WINDOW (dlg)); + g_signal_connect (self->priv->loc_dlg, "destroy", G_CALLBACK (gtk_widget_destroyed), &self->priv->loc_dlg); + g_signal_connect_swapped (dlg, "focus-in-event", G_CALLBACK (hide_locations), self); + gtk_widget_show_all (self->priv->loc_dlg); } else { - gtk_window_present_with_time (GTK_WINDOW (loc_dlg), gtk_get_current_event_time ()); + gtk_window_present_with_time (GTK_WINDOW (self->priv->loc_dlg), gtk_get_current_event_time ()); } } static gboolean timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model, - GtkTreeIter * iter, gpointer user_data) + GtkTreeIter * iter, IndicatorDatetimePanel * self) { const gchar * name, * zone; @@ -572,7 +607,7 @@ timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model, lat = strtod(strlat, NULL); } - zone = cc_timezone_map_get_timezone_at_coords (tzmap, lon, lat); + zone = cc_timezone_map_get_timezone_at_coords (self->priv->tzmap, lon, lat); } GSettings * conf = g_settings_new (SETTINGS_INTERFACE); @@ -581,18 +616,18 @@ timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model, g_free (tz_name); g_object_unref (conf); - cc_timezone_map_set_timezone (tzmap, zone); + cc_timezone_map_set_timezone (self->priv->tzmap, zone); return FALSE; // Do normal action too } static gboolean -entry_focus_out (GtkEntry * entry, GdkEventFocus * event) +entry_focus_out (GtkEntry * entry, GdkEventFocus * event, IndicatorDatetimePanel * self) { // If the name left in the entry doesn't match the current timezone name, // show an error icon. It's always an error for the user to manually type in // a timezone. - TzLocation * location = cc_timezone_map_get_location (tzmap); + TzLocation * location = cc_timezone_map_get_location (self->priv->tzmap); if (location == NULL) return FALSE; @@ -608,36 +643,29 @@ entry_focus_out (GtkEntry * entry, GdkEventFocus * event) return FALSE; } -static gboolean -key_pressed (GtkWidget * widget, GdkEventKey * event, gpointer user_data) +static void +indicator_datetime_panel_init (IndicatorDatetimePanel * self) { - switch (event->keyval) { - case GDK_KEY_Escape: - gtk_widget_destroy (widget); - return TRUE; - } - return FALSE; -} + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + INDICATOR_DATETIME_TYPE_PANEL, + IndicatorDatetimePanelPrivate); -static GtkWidget * -create_dialog (void) -{ GError * error = NULL; - GtkBuilder * builder = gtk_builder_new (); - gtk_builder_add_from_file (builder, DATETIME_DIALOG_UI_FILE, &error); + self->priv->builder = gtk_builder_new (); + gtk_builder_add_from_file (self->priv->builder, DATETIME_DIALOG_UI_FILE, &error); if (error != NULL) { /* We have to abort, we can't continue without the ui file */ g_error ("Could not load ui file %s: %s", DATETIME_DIALOG_UI_FILE, error->message); g_error_free (error); - return NULL; + return; } - gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); + gtk_builder_set_translation_domain (self->priv->builder, GETTEXT_PACKAGE); GSettings * conf = g_settings_new (SETTINGS_INTERFACE); -#define WIG(name) GTK_WIDGET (gtk_builder_get_object (builder, name)) +#define WIG(name) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, name)) /* Add policykit button */ GtkWidget * polkit_button = gtk_lock_button_new (NULL); @@ -653,16 +681,16 @@ create_dialog (void) polkit_permission_new (polkit_name, NULL, NULL, polkit_perm_ready, polkit_button); /* Add map */ - tzmap = cc_timezone_map_new (); - gtk_container_add (GTK_CONTAINER (WIG ("mapBox")), GTK_WIDGET (tzmap)); + self->priv->tzmap = cc_timezone_map_new (); + gtk_container_add (GTK_CONTAINER (WIG ("mapBox")), GTK_WIDGET (self->priv->tzmap)); /* Fufill the CC by Attribution license requirements for the Geonames lookup */ - cc_timezone_map_set_watermark (tzmap, "Geonames.org"); + cc_timezone_map_set_watermark (self->priv->tzmap, "Geonames.org"); /* And completion entry */ - TimezoneCompletion * completion = timezone_completion_new (); - timezone_completion_watch_entry (completion, GTK_ENTRY (WIG ("timezoneEntry"))); - g_signal_connect (completion, "match-selected", G_CALLBACK (timezone_selected), NULL); - g_signal_connect (WIG ("timezoneEntry"), "focus-out-event", G_CALLBACK (entry_focus_out), NULL); + self->priv->completion = timezone_completion_new (); + timezone_completion_watch_entry (self->priv->completion, GTK_ENTRY (WIG ("timezoneEntry"))); + g_signal_connect (self->priv->completion, "match-selected", G_CALLBACK (timezone_selected), self); + g_signal_connect (WIG ("timezoneEntry"), "focus-out-event", G_CALLBACK (entry_focus_out), self); /* Set up settings bindings */ g_settings_bind (conf, SETTINGS_SHOW_CLOCK_S, WIG ("showClockCheck"), @@ -704,21 +732,20 @@ create_dialog (void) gtk_widget_set_sensitive (WIG ("showEventsCheck"), (evo_path != NULL)); g_free (evo_path); - setup_time_spinners (WIG ("timeSpinner"), WIG ("dateSpinner")); + setup_time_spinners (self, WIG ("timeSpinner"), WIG ("dateSpinner")); - GtkWidget * dlg = WIG ("timeDateDialog"); - auto_radio = WIG ("automaticTimeRadio"); - tz_entry = WIG ("timezoneEntry"); + GtkWidget * panel = WIG ("timeDatePanel"); + self->priv->auto_radio = WIG ("automaticTimeRadio"); + self->priv->tz_entry = WIG ("timezoneEntry"); - g_signal_connect (WIG ("locationsButton"), "clicked", G_CALLBACK (show_locations), dlg); - g_signal_connect (dlg, "key-press-event", G_CALLBACK (key_pressed), NULL); + g_signal_connect_swapped (WIG ("locationsButton"), "clicked", G_CALLBACK (show_locations), self); /* Grab proxy for settings daemon */ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.gnome.SettingsDaemon.DateTimeMechanism", "/", "org.gnome.SettingsDaemon.DateTimeMechanism", - NULL, proxy_ready, NULL); + NULL, (GAsyncReadyCallback)proxy_ready, self); /* Grab proxy for datetime service, to see if it's running. It would actually be more ideal to see if the indicator module itself is running, @@ -727,56 +754,92 @@ create_dialog (void) us if there *was* a datetime module run this session. */ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, NULL, SERVICE_NAME, SERVICE_OBJ, SERVICE_IFACE, - NULL, service_proxy_ready, WIG ("showClockCheck")); + NULL, (GAsyncReadyCallback)service_proxy_ready, + WIG ("showClockCheck")); #undef WIG g_object_unref (conf); - g_object_unref (builder); - return dlg; + gtk_widget_show_all (panel); + gtk_container_add (GTK_CONTAINER (self), panel); } -static UniqueResponse -message_received (UniqueApp * app, gint command, UniqueMessageData *message_data, - guint time, gpointer user_data) +static void +indicator_datetime_panel_dispose (GObject * object) { - if (command == UNIQUE_ACTIVATE) { - gtk_window_present_with_time (GTK_WINDOW (user_data), time); - return UNIQUE_RESPONSE_OK; + IndicatorDatetimePanel * self = (IndicatorDatetimePanel *) object; + + if (self->priv->builder) { + g_object_unref (self->priv->builder); + self->priv->builder = NULL; } - return UNIQUE_RESPONSE_PASSTHROUGH; -} -int -main (int argc, char ** argv) -{ - g_type_init (); + if (self->priv->proxy) { + g_object_unref (self->priv->proxy); + self->priv->proxy = NULL; + } - /* Setting up i18n and gettext. Apparently, we need - all of these. */ - setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - textdomain (GETTEXT_PACKAGE); + if (self->priv->loc_dlg) { + gtk_widget_destroy (self->priv->loc_dlg); + self->priv->loc_dlg = NULL; + } - gtk_init (&argc, &argv); + if (self->priv->save_time_id) { + g_source_remove (self->priv->save_time_id); + self->priv->save_time_id = 0; + } - UniqueApp * app = unique_app_new ("com.canonical.indicator.datetime.preferences", NULL); + if (self->priv->completion) { + timezone_completion_watch_entry (self->priv->completion, NULL); + g_object_unref (self->priv->completion); + self->priv->completion = NULL; + } - if (unique_app_is_running (app)) { - unique_app_send_message (app, UNIQUE_ACTIVATE, NULL); - } else { - // We're first instance. Yay! - GtkWidget * dlg = create_dialog (); + if (self->priv->tz_entry) { + gtk_widget_destroy (self->priv->tz_entry); + self->priv->tz_entry = NULL; + } - g_signal_connect (app, "message-received", G_CALLBACK(message_received), dlg); - unique_app_watch_window (app, GTK_WINDOW (dlg)); + if (self->priv->time_spin) { + gtk_widget_destroy (self->priv->time_spin); + self->priv->time_spin = NULL; + } - gtk_widget_show_all (dlg); - g_signal_connect (dlg, "destroy", G_CALLBACK(gtk_main_quit), NULL); - gtk_main (); + if (self->priv->date_spin) { + gtk_widget_destroy (self->priv->date_spin); + self->priv->date_spin = NULL; } +} - return 0; +static void +indicator_datetime_panel_class_finalize (IndicatorDatetimePanelClass *klass) +{ } +static void +indicator_datetime_panel_class_init (IndicatorDatetimePanelClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (IndicatorDatetimePanelPrivate)); + + gobject_class->dispose = indicator_datetime_panel_dispose; +} + +void +g_io_module_load (GIOModule *module) +{ + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + + indicator_datetime_panel_register_type (G_TYPE_MODULE (module)); + g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT, + INDICATOR_DATETIME_TYPE_PANEL, + "indicator-datetime", 0); +} + +void +g_io_module_unload (GIOModule *module) +{ +} diff --git a/src/datetime-service.c b/src/datetime-service.c index 08ff9ad..6c876aa 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -30,7 +30,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <math.h> #include <gconf/gconf-client.h> -#include <libdbusmenu-gtk/menuitem.h> +#include <libdbusmenu-gtk3/menuitem.h> #include <libdbusmenu-glib/server.h> #include <libdbusmenu-glib/client.h> #include <libdbusmenu-glib/menuitem.h> @@ -221,29 +221,15 @@ update_current_timezone (void) { current_timezone = NULL; } - GError * error = NULL; - gchar * tempzone = NULL; - if (!g_file_get_contents(TIMEZONE_FILE, &tempzone, NULL, &error)) { - g_warning("Unable to read timezone file '" TIMEZONE_FILE "': %s", error->message); - g_error_free(error); + current_timezone = read_timezone (); + if (current_timezone == NULL) { return; } - /* This shouldn't happen, so let's make it a big boom! */ - g_return_if_fail(tempzone != NULL); - - /* Note: this really makes sense as strstrip works in place - so we end up with something a little odd without the dup - so we have the dup to make sure everything is as expected - for everyone else. */ - current_timezone = g_strdup(g_strstrip(tempzone)); - g_free(tempzone); - g_debug("System timezone is: %s", current_timezone); check_timezone_sync(); - if (error != NULL) g_error_free(error); return; } @@ -276,10 +262,8 @@ quick_set_tz_proxy_cb (GObject *object, GAsyncResult *res, gpointer zone) return; } - gchar * file = g_build_filename ("/usr/share/zoneinfo", (char *)zone, NULL); - g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(s)", file), + g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(s)", zone), G_DBUS_CALL_FLAGS_NONE, -1, NULL, quick_set_tz_cb, NULL); - g_free (file); g_free (zone); g_object_unref (proxy); } @@ -1040,13 +1024,13 @@ check_for_timeadmin (gpointer user_data) { g_return_val_if_fail (settings != NULL, FALSE); - gchar * timeadmin = g_find_program_in_path("indicator-datetime-preferences"); + gchar * timeadmin = g_find_program_in_path("gnome-control-center"); if (timeadmin != NULL) { - g_debug("Found the indicator-datetime-preferences application: %s", timeadmin); + g_debug("Found the gnome-control-center application: %s", timeadmin); dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); g_free(timeadmin); } else { - g_debug("Unable to find indicator-datetime-preferences app."); + g_debug("Unable to find gnome-control-center app."); dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); } @@ -1129,7 +1113,7 @@ build_menus (DbusmenuMenuitem * root) dbusmenu_menuitem_property_set (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Time & Date Settings...")); /* insensitive until we check for available apps */ dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); - g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "indicator-datetime-preferences"); + g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "gnome-control-center indicator-datetime"); dbusmenu_menuitem_child_append(root, settings); g_idle_add(check_for_timeadmin, NULL); diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 800fa87..072253b 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -41,9 +41,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <libindicator/indicator-service-manager.h> /* DBusMenu */ -#include <libdbusmenu-gtk/menu.h> +#include <libdbusmenu-gtk3/menu.h> #include <libido/libido.h> -#include <libdbusmenu-gtk/menuitem.h> +#include <libdbusmenu-gtk3/menuitem.h> #include "utils.h" #include "dbus-shared.h" @@ -761,11 +761,18 @@ set_label_to_time_in_zone (IndicatorDatetime * self, GtkLabel * label, GTimeZone * tz, const gchar * format, GDateTime ** datetime) { + gboolean unref_tz = FALSE; + if (tz == NULL) { + gchar * zone = read_timezone (); + if (zone == NULL) + return; + tz = g_time_zone_new(zone); + unref_tz = TRUE; + g_free (zone); + } + GDateTime * datetime_now; - if (tz == NULL) - datetime_now = g_date_time_new_now_local(); - else - datetime_now = g_date_time_new_now(tz); + datetime_now = g_date_time_new_now(tz); gchar * timestr; if (format == NULL) { @@ -793,6 +800,9 @@ set_label_to_time_in_zone (IndicatorDatetime * self, GtkLabel * label, else g_date_time_unref(datetime_now); + if (unref_tz) + g_time_zone_unref(tz); + return; } diff --git a/src/timezone-completion.c b/src/timezone-completion.c index 6ba1e88..d190035 100644 --- a/src/timezone-completion.c +++ b/src/timezone-completion.c @@ -492,21 +492,26 @@ timezone_completion_watch_entry (TimezoneCompletion * completion, GtkEntry * ent } if (priv->entry) { g_signal_handler_disconnect (priv->entry, priv->changed_id); + priv->changed_id = 0; g_signal_handler_disconnect (priv->entry, priv->keypress_id); + priv->keypress_id = 0; g_object_remove_weak_pointer (G_OBJECT (priv->entry), (gpointer *)&priv->entry); gtk_entry_set_completion (priv->entry, NULL); } - guint id = g_signal_connect (entry, "changed", G_CALLBACK (entry_changed), completion); - priv->changed_id = id; + priv->entry = entry; - id = g_signal_connect (entry, "key-press-event", G_CALLBACK (entry_keypress), completion); - priv->keypress_id = id; + if (entry) { + guint id = g_signal_connect (entry, "changed", G_CALLBACK (entry_changed), completion); + priv->changed_id = id; - priv->entry = entry; - g_object_add_weak_pointer (G_OBJECT (entry), (gpointer *)&priv->entry); + id = g_signal_connect (entry, "key-press-event", G_CALLBACK (entry_keypress), completion); + priv->keypress_id = id; - gtk_entry_set_completion (entry, GTK_ENTRY_COMPLETION (completion)); + g_object_add_weak_pointer (G_OBJECT (entry), (gpointer *)&priv->entry); + + gtk_entry_set_completion (entry, GTK_ENTRY_COMPLETION (completion)); + } } static GtkListStore * @@ -640,7 +645,9 @@ timezone_completion_dispose (GObject * object) } if (priv->entry != NULL) { + gtk_entry_set_completion (priv->entry, NULL); g_object_remove_weak_pointer (G_OBJECT (priv->entry), (gpointer *)&priv->entry); + priv->entry = NULL; } if (priv->initial_model != NULL) { diff --git a/src/utils.c b/src/utils.c index ab93ecf..73c8ab2 100644 --- a/src/utils.c +++ b/src/utils.c @@ -117,6 +117,30 @@ get_current_zone_name (const gchar * location) return rv; } +gchar * +read_timezone () +{ + GError * error = NULL; + gchar * tempzone = NULL; + if (!g_file_get_contents(TIMEZONE_FILE, &tempzone, NULL, &error)) { + g_warning("Unable to read timezone file '" TIMEZONE_FILE "': %s", error->message); + g_error_free(error); + return NULL; + } + + /* This shouldn't happen, so let's make it a big boom! */ + g_return_val_if_fail(tempzone != NULL, NULL); + + /* Note: this really makes sense as strstrip works in place + so we end up with something a little odd without the dup + so we have the dup to make sure everything is as expected + for everyone else. */ + gchar * rv = g_strdup(g_strstrip(tempzone)); + g_free(tempzone); + + return rv; +} + /* Translate msg according to the locale specified by LC_TIME */ static char * T_(const char *msg) diff --git a/src/utils.h b/src/utils.h index c2bc0c5..788d516 100644 --- a/src/utils.h +++ b/src/utils.h @@ -30,6 +30,7 @@ G_BEGIN_DECLS gboolean is_locale_12h (void); void split_settings_location (const gchar * location, gchar ** zone, gchar ** name); gchar * get_current_zone_name (const gchar * location); +gchar * read_timezone (); gchar * generate_format_string_full (gboolean show_day, gboolean show_date); gchar * generate_format_string_at_time (GDateTime * time); |