mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-29 02:26:34 +02:00
Merge branch 'master' into gdbus-codegen
This commit is contained in:
86
NEWS
86
NEWS
@@ -1,29 +1,107 @@
|
|||||||
Overview of Changes from GLib 2.28.0 to 2.29.2
|
Overview of Changes from GLib 2.28.0 to 2.29.2
|
||||||
==============================================
|
==============================================
|
||||||
|
|
||||||
* The format accepted by the GVariant parser has beend documented
|
* GApplication
|
||||||
|
- The documentation has been enhanced and clarified
|
||||||
|
- An opt-out for uniqueness has been added: G_APPLICATION_NON_UNIQUE
|
||||||
|
- GApplication now syncs settings before g_application_run() returns
|
||||||
|
|
||||||
* The return value of g_datetime_compare() has been fixed to
|
* GDBus
|
||||||
|
- Interface lookups are now happening in constant time
|
||||||
|
- Signature checking and handling of various unexpected
|
||||||
|
situations has been improved
|
||||||
|
|
||||||
|
* GVariant
|
||||||
|
- The format accepted by the GVariant parser has beend documented
|
||||||
|
- GVariant accepts G_VARIANT_TYPE_VARDICT for a{sv}
|
||||||
|
|
||||||
|
* GDateTime:
|
||||||
|
- The return value of g_datetime_compare() has been fixed to
|
||||||
match strcmp() semantics
|
match strcmp() semantics
|
||||||
|
- In order to handle problems with changing timezones, a GTimeZoneMonitor
|
||||||
|
has been added to GIO, and g_time_zone_refresh_local() can be
|
||||||
|
called to update the cached information about the local timezone
|
||||||
|
|
||||||
|
* GOption now uses /proc/self/cmdline to set the program name instead
|
||||||
|
and only falls back to "<unknown>" if that is unavailable
|
||||||
|
|
||||||
|
* GSettings:
|
||||||
|
- The schema compiler now warns about references to non-existing schemas
|
||||||
|
|
||||||
* Commandline utilities are now fully translated
|
* Commandline utilities are now fully translated
|
||||||
|
|
||||||
|
* Signals can now indicate that collecting their arguments must
|
||||||
|
always happen, even in the absence of connected signal handlers,
|
||||||
|
using the G_SIGNAL_MUST_COLLECT flag.
|
||||||
|
|
||||||
* Bugs fixed:
|
* Bugs fixed:
|
||||||
635099 Memory leak in gdbus introspection when parsing xml
|
635099 Memory leak in gdbus introspection when parsing xml
|
||||||
640489 $ and ^ do not match lines if G_REGEX_MULTILINE|G_R...
|
640489 $ and ^ do not match lines if G_REGEX_MULTILINE|G_R...
|
||||||
642042 Overriding GDBus org.freedesktop.DBus.Properties im...
|
642042 Overriding GDBus org.freedesktop.DBus.Properties im...
|
||||||
642052 g_timeout_add(_seconds) cannot handle large intervals
|
642052 g_timeout_add(_seconds) cannot handle large intervals
|
||||||
642490 notify_desktop_launch() "g_variant_new_bytestring:...
|
642490 notify_desktop_launch() "g_variant_new_bytestring:...
|
||||||
|
613269 g_type_get_qdata() doesn't work as I expected on subtypes
|
||||||
|
624943 G_VALUE_NOCOPY_CONTENTS is undocumented
|
||||||
|
637738 object_interface_check_properties never actually executes
|
||||||
|
638185 GIOCondition should be annotated as "flags"
|
||||||
|
639478 GDBusServer's g_dbus_server_new_sync() function should just...
|
||||||
|
641755 Add g_settings_get/set_uint() helpers
|
||||||
|
641768 dconf gsettings backend silently drops writes if it can't...
|
||||||
|
642797 g_app_info_get_default_for_type() broken for subtypes
|
||||||
|
642825 Unnecessary assertion failure in g_option_context_parse()
|
||||||
|
642944 NULL key lookup using g_hash_table_lookup_extended()
|
||||||
|
643074 Incorrect documentation for g_socket_receive() and g_socket...
|
||||||
|
643197 g_application_id_is_valid docs imply no valid ids
|
||||||
|
643468 GApplication docs: Warn that handling "command-line" means...
|
||||||
|
643478 GApplication::local_command_line vfunc documentation seems wrong
|
||||||
|
643624 Can g_variant_unref() on an already free'd variant
|
||||||
|
643649 g_application_run() should say that argc/argv can be NULL
|
||||||
|
643780 shouldn't need to create an action group to use actions...
|
||||||
|
643795 g_timeout_add_seconds fires with intervals 1 second longer...
|
||||||
|
644309 Program name is not set when using GtkApplication
|
||||||
|
644428 Crash in failure section of g_markup_collect_attributes()
|
||||||
|
644465 undefined reference to `_usleep'
|
||||||
|
644552 g_timeout_add_seconds(1, ...) may have a latency of up to 2...
|
||||||
|
644607 Correct internal definition of C_()
|
||||||
|
645789 annotations for g_file_*_contents
|
||||||
|
646039 g_settings_list_children() returns child that cannot be opened
|
||||||
|
646310 Accept range with only min or max
|
||||||
|
646420 g_dbus_method_invocation_get_parameters() docs should say...
|
||||||
|
646843 occasional abort on autologin
|
||||||
|
646985 add G_APPLICATION_NON_UNIQUE flag
|
||||||
|
647579 gsettings: Implement reset-recursively
|
||||||
|
647600 gsettings description has typo
|
||||||
|
|
||||||
* Translation updates
|
* Translation updates
|
||||||
|
Afrikaans
|
||||||
Bulgarian
|
Bulgarian
|
||||||
Bengali India
|
Bengali India
|
||||||
Korean
|
British English
|
||||||
Polish
|
Bulgarian
|
||||||
|
Catalan
|
||||||
|
Czech
|
||||||
|
Danish
|
||||||
|
French
|
||||||
Galician
|
Galician
|
||||||
|
German
|
||||||
|
Greek
|
||||||
|
Gujarati
|
||||||
Hebrew
|
Hebrew
|
||||||
|
Hungarian
|
||||||
Italian
|
Italian
|
||||||
|
Japanese
|
||||||
|
Korean
|
||||||
|
Lithuanian
|
||||||
|
Polish
|
||||||
|
Portuguese
|
||||||
|
Romanian
|
||||||
|
Serbian
|
||||||
|
Simplified Chinese
|
||||||
Spanish
|
Spanish
|
||||||
|
Swedish
|
||||||
|
Traditional Chinese
|
||||||
|
Uighur
|
||||||
|
Vietnamese
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes from GLib 2.27.93 to 2.28.0
|
Overview of Changes from GLib 2.27.93 to 2.28.0
|
||||||
|
@@ -14,7 +14,7 @@ The official web site is:
|
|||||||
http://www.gtk.org/
|
http://www.gtk.org/
|
||||||
|
|
||||||
Information about mailing lists can be found at
|
Information about mailing lists can be found at
|
||||||
http://www.gtk.org/mailinglists.html
|
http://www.gtk.org/mailing-lists.html
|
||||||
|
|
||||||
To subscribe: mail -s subscribe gtk-list-request@gnome.org < /dev/null
|
To subscribe: mail -s subscribe gtk-list-request@gnome.org < /dev/null
|
||||||
(Send mail to gtk-list-request@gnome.org with the subject "subscribe")
|
(Send mail to gtk-list-request@gnome.org with the subject "subscribe")
|
||||||
|
@@ -26,4 +26,8 @@ EXTRA_DIST = \
|
|||||||
gio.vcxproj.filtersin \
|
gio.vcxproj.filtersin \
|
||||||
testglib.vcxproj \
|
testglib.vcxproj \
|
||||||
testglib.vcxproj.filters \
|
testglib.vcxproj.filters \
|
||||||
|
glib-compile-schemas.vcxproj \
|
||||||
|
glib-compile-schemas.vcxproj.filters \
|
||||||
|
gsettings.vcxproj \
|
||||||
|
gsettings.vcxproj.filters \
|
||||||
install.vcxproj
|
install.vcxproj
|
||||||
|
174
build/win32/vs10/glib-compile-schemas.vcxproj
Normal file
174
build/win32/vs10/glib-compile-schemas.vcxproj
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{015D69D0-8B42-438A-ADAE-052AC036E065}</ProjectGuid>
|
||||||
|
<RootNamespace>glibcompileschemas</RootNamespace>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="glib.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="glib.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="glib.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="glib.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>DEBUG;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PreprocessorDefinitions>_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\gio\glib-compile-schemas.c" />
|
||||||
|
<ClCompile Include="..\..\..\gio\gvdb\gvdb-builder.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="glib.vcxproj">
|
||||||
|
<Project>{12bca020-eabf-429e-876a-a476bc9c10c0}</Project>
|
||||||
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="gobject.vcxproj">
|
||||||
|
<Project>{f172effc-e30f-4593-809e-db2024b1e753}</Project>
|
||||||
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="gio.vcxproj">
|
||||||
|
<Project>{f3d1583c-5613-4809-bd98-7cc1c1276f92}</Project>
|
||||||
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
17
build/win32/vs10/glib-compile-schemas.vcxproj.filters
Normal file
17
build/win32/vs10/glib-compile-schemas.vcxproj.filters
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\gio\glib-compile-schemas.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\gio\gvdb\gvdb-builder.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@@ -15,6 +15,10 @@ copy $(SolutionDir)$(Configuration)\$(Platform)\bin\glib-genmarshal.exe $(CopyDi
|
|||||||
|
|
||||||
copy $(SolutionDir)$(Configuration)\$(Platform)\bin\gspawn-win32-helper*.exe $(CopyDir)\bin
|
copy $(SolutionDir)$(Configuration)\$(Platform)\bin\gspawn-win32-helper*.exe $(CopyDir)\bin
|
||||||
|
|
||||||
|
copy $(SolutionDir)$(Configuration)\$(Platform)\bin\glib-compile-schemas.exe $(CopyDir)\bin
|
||||||
|
|
||||||
|
copy $(SolutionDir)$(Configuration)\$(Platform)\bin\gsettings.exe $(CopyDir)\bin
|
||||||
|
|
||||||
|
|
||||||
mkdir $(CopyDir)\include\glib-$(ApiVersion)\glib
|
mkdir $(CopyDir)\include\glib-$(ApiVersion)\glib
|
||||||
|
|
||||||
@@ -429,6 +433,10 @@ copy $(SolutionDir)$(Configuration)\$(Platform)\bin\*-$(ApiVersion).lib $(CopyDi
|
|||||||
|
|
||||||
if exist $(SolutionDir)$(Configuration)_ExtPCRE copy $(SolutionDir)$(Configuration)_ExtPCRE\$(Platform)\bin\*-$(ApiVersion).lib $(CopyDir)\lib
|
if exist $(SolutionDir)$(Configuration)_ExtPCRE copy $(SolutionDir)$(Configuration)_ExtPCRE\$(Platform)\bin\*-$(ApiVersion).lib $(CopyDir)\lib
|
||||||
|
|
||||||
|
|
||||||
|
mkdir $(CopyDir)\share\glib-2.0\schemas
|
||||||
|
copy ..\..\..\gio\gschema.dtd $(CopyDir)\share\glib-2.0\schemas
|
||||||
|
|
||||||
</GlibDoInstall>
|
</GlibDoInstall>
|
||||||
<GlibGenerateGlibDef>echo EXPORTS >"$(DefDir)glib.def" && cl /EP -DG_OS_WIN32 -DINCLUDE_INTERNAL_SYMBOLS -DALL_FILES -DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= -DG_GNUC_PRINTF=;G_GNUC_PRINTF -DG_GNUC_FORMAT=;G_GNUC_FORMAT ..\..\..\glib\glib.symbols >>"$(DefDir)glib.def"</GlibGenerateGlibDef>
|
<GlibGenerateGlibDef>echo EXPORTS >"$(DefDir)glib.def" && cl /EP -DG_OS_WIN32 -DINCLUDE_INTERNAL_SYMBOLS -DALL_FILES -DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= -DG_GNUC_PRINTF=;G_GNUC_PRINTF -DG_GNUC_FORMAT=;G_GNUC_FORMAT ..\..\..\glib\glib.symbols >>"$(DefDir)glib.def"</GlibGenerateGlibDef>
|
||||||
<GlibGenerateGlibDefW64>echo EXPORTS >"$(DefDir)glib.def" && cl /EP -DG_OS_WIN32 -D_WIN64 -DINCLUDE_INTERNAL_SYMBOLS -DALL_FILES -DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= -DG_GNUC_PRINTF=;G_GNUC_PRINTF -DG_GNUC_FORMAT=;G_GNUC_FORMAT ..\..\..\glib\glib.symbols >>"$(DefDir)glib.def"</GlibGenerateGlibDefW64>
|
<GlibGenerateGlibDefW64>echo EXPORTS >"$(DefDir)glib.def" && cl /EP -DG_OS_WIN32 -D_WIN64 -DINCLUDE_INTERNAL_SYMBOLS -DALL_FILES -DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= -DG_GNUC_PRINTF=;G_GNUC_PRINTF -DG_GNUC_FORMAT=;G_GNUC_FORMAT ..\..\..\glib\glib.symbols >>"$(DefDir)glib.def"</GlibGenerateGlibDefW64>
|
||||||
|
@@ -18,6 +18,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gspawn-win32-helper-console
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testglib", "testglib.vcxproj", "{64E09909-5599-40C0-B808-27F55F7B823C}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testglib", "testglib.vcxproj", "{64E09909-5599-40C0-B808-27F55F7B823C}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glib-compile-schemas", "glib-compile-schemas.vcxproj", "{015D69D0-8B42-438A-ADAE-052AC036E065}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsettings", "gsettings.vcxproj", "{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}"
|
||||||
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcxproj", "{2093D218-190E-4194-9421-3BA7CBF33B10}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcxproj", "{2093D218-190E-4194-9421-3BA7CBF33B10}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
@@ -176,6 +180,38 @@ Global
|
|||||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release|Win32.Build.0 = Release|Win32
|
{64E09909-5599-40C0-B808-27F55F7B823C}.Release|Win32.Build.0 = Release|Win32
|
||||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release|x64.ActiveCfg = Release|x64
|
{64E09909-5599-40C0-B808-27F55F7B823C}.Release|x64.ActiveCfg = Release|x64
|
||||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release|x64.Build.0 = Release|x64
|
{64E09909-5599-40C0-B808-27F55F7B823C}.Release|x64.Build.0 = Release|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release|x64.Build.0 = Release|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release|x64.Build.0 = Release|x64
|
||||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||||
|
174
build/win32/vs10/gsettings.vcxproj
Normal file
174
build/win32/vs10/gsettings.vcxproj
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}</ProjectGuid>
|
||||||
|
<RootNamespace>gsettings</RootNamespace>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="glib.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="glib.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="glib.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="glib.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>DEBUG;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PreprocessorDefinitions>_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\gio\gsettings-tool.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="glib.vcxproj">
|
||||||
|
<Project>{12bca020-eabf-429e-876a-a476bc9c10c0}</Project>
|
||||||
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="gobject.vcxproj">
|
||||||
|
<Project>{f172effc-e30f-4593-809e-db2024b1e753}</Project>
|
||||||
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="gio.vcxproj">
|
||||||
|
<Project>{f3d1583c-5613-4809-bd98-7cc1c1276f92}</Project>
|
||||||
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
14
build/win32/vs10/gsettings.vcxproj.filters
Normal file
14
build/win32/vs10/gsettings.vcxproj.filters
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\gio\gsettings-tool.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@@ -14,4 +14,6 @@ EXTRA_DIST = \
|
|||||||
gio.vcproj \
|
gio.vcproj \
|
||||||
gio.vcprojin \
|
gio.vcprojin \
|
||||||
testglib.vcproj \
|
testglib.vcproj \
|
||||||
|
glib-compile-schemas.vcproj \
|
||||||
|
gsettings.vcproj \
|
||||||
install.vcproj
|
install.vcproj
|
||||||
|
152
build/win32/vs9/glib-compile-schemas.vcproj
Normal file
152
build/win32/vs9/glib-compile-schemas.vcproj
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
<?xml version="1.0" encoding="big5"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="glib-compile-schemas"
|
||||||
|
ProjectGUID="{015D69D0-8B42-438A-ADAE-052AC036E065}"
|
||||||
|
RootNamespace="glibcompileschemas"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
<Platform
|
||||||
|
Name="x64"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
InheritedPropertySheets=".\glib.vsprops"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
PreprocessorDefinitions="_DEBUG;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|x64"
|
||||||
|
InheritedPropertySheets=".\glib.vsprops"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
PreprocessorDefinitions="DEBUG;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="17"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
InheritedPropertySheets=".\glib.vsprops"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|x64"
|
||||||
|
InheritedPropertySheets=".\glib.vsprops"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="17"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File RelativePath="..\..\..\gio\glib-compile-schemas.c" />
|
||||||
|
<File RelativePath="..\..\..\gio\gvdb\gvdb-builder.c" />
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
@@ -45,6 +45,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testglib", "testglib.vcproj
|
|||||||
{12BCA020-EABF-429E-876A-A476BC9C10C0} = {12BCA020-EABF-429E-876A-A476BC9C10C0}
|
{12BCA020-EABF-429E-876A-A476BC9C10C0} = {12BCA020-EABF-429E-876A-A476BC9C10C0}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glib-compile-schemas", "glib-compile-schemas.vcproj", "{015D69D0-8B42-438A-ADAE-052AC036E065}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{12BCA020-EABF-429E-876A-A476BC9C10C0} = {12BCA020-EABF-429E-876A-A476BC9C10C0}
|
||||||
|
{F172EFFC-E30F-4593-809E-DB2024B1E753} = {F172EFFC-E30F-4593-809E-DB2024B1E753}
|
||||||
|
{F3D1583C-5613-4809-BD98-7CC1C1276F92} = {F3D1583C-5613-4809-BD98-7CC1C1276F92}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsettings", "gsettings.vcproj", "{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{12BCA020-EABF-429E-876A-A476BC9C10C0} = {12BCA020-EABF-429E-876A-A476BC9C10C0}
|
||||||
|
{F172EFFC-E30F-4593-809E-DB2024B1E753} = {F172EFFC-E30F-4593-809E-DB2024B1E753}
|
||||||
|
{F3D1583C-5613-4809-BD98-7CC1C1276F92} = {F3D1583C-5613-4809-BD98-7CC1C1276F92}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcproj", "{2093D218-190E-4194-9421-3BA7CBF33B10}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcproj", "{2093D218-190E-4194-9421-3BA7CBF33B10}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{12BCA020-EABF-429E-876A-A476BC9C10C0} = {12BCA020-EABF-429E-876A-A476BC9C10C0}
|
{12BCA020-EABF-429E-876A-A476BC9C10C0} = {12BCA020-EABF-429E-876A-A476BC9C10C0}
|
||||||
@@ -56,6 +70,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcproj",
|
|||||||
{289240E7-E167-47CE-A20C-58D852E520BA} = {289240E7-E167-47CE-A20C-58D852E520BA}
|
{289240E7-E167-47CE-A20C-58D852E520BA} = {289240E7-E167-47CE-A20C-58D852E520BA}
|
||||||
{F172EFFC-E30F-4593-809E-DB2024B1E753} = {F172EFFC-E30F-4593-809E-DB2024B1E753}
|
{F172EFFC-E30F-4593-809E-DB2024B1E753} = {F172EFFC-E30F-4593-809E-DB2024B1E753}
|
||||||
{64E09909-5599-40C0-B808-27F55F7B823C} = {64E09909-5599-40C0-B808-27F55F7B823C}
|
{64E09909-5599-40C0-B808-27F55F7B823C} = {64E09909-5599-40C0-B808-27F55F7B823C}
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065} = {015D69D0-8B42-438A-ADAE-052AC036E065}
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA} = {05041C63-F1C5-49BA-A7DE-61EBB5307EAA}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
@@ -214,6 +230,38 @@ Global
|
|||||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
{64E09909-5599-40C0-B808-27F55F7B823C}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
{64E09909-5599-40C0-B808-27F55F7B823C}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
{64E09909-5599-40C0-B808-27F55F7B823C}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release|x64.Build.0 = Release|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||||
|
{015D69D0-8B42-438A-ADAE-052AC036E065}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release|x64.Build.0 = Release|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||||
|
{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug|Win32.ActiveCfg = Debug|Win32
|
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug|Win32.Build.0 = Debug|Win32
|
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug|x64.ActiveCfg = Debug|x64
|
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
@@ -42,6 +42,8 @@ copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\*.dll $(OutDir)\bin&
|
|||||||
if exist $(SolutionDir)$(ConfigurationName)_ExtPCRE copy $(SolutionDir)$(ConfigurationName)_ExtPCRE\$(PlatformName)\bin\*.dll $(OutDir)\bin

|
if exist $(SolutionDir)$(ConfigurationName)_ExtPCRE copy $(SolutionDir)$(ConfigurationName)_ExtPCRE\$(PlatformName)\bin\*.dll $(OutDir)\bin

|
||||||
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\glib-genmarshal.exe $(OutDir)\bin

|
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\glib-genmarshal.exe $(OutDir)\bin

|
||||||
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\gspawn-win32-helper*.exe $(OutDir)\bin

|
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\gspawn-win32-helper*.exe $(OutDir)\bin

|
||||||
|
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\glib-compile-schemas.exe $(OutDir)\bin

|
||||||
|
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\gsettings.exe $(OutDir)\bin

|
||||||
|
|
||||||
mkdir $(OutDir)\include\glib-2.0\glib

|
mkdir $(OutDir)\include\glib-2.0\glib

|
||||||
copy ..\..\..\msvc_recommended_pragmas.h $(OutDir)\include\glib-2.0

|
copy ..\..\..\msvc_recommended_pragmas.h $(OutDir)\include\glib-2.0

|
||||||
@@ -253,6 +255,9 @@ copy ..\..\..\glib\glibconfig.h $(OutDir)\lib\glib-2.0\include

|
|||||||
|
|
||||||
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\*-2.0.lib $(OutDir)\lib

|
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\*-2.0.lib $(OutDir)\lib

|
||||||
if exist $(SolutionDir)$(ConfigurationName)_ExtPCRE copy $(SolutionDir)$(ConfigurationName)_ExtPCRE\$(PlatformName)\bin\*-2.0.lib $(OutDir)\lib

|
if exist $(SolutionDir)$(ConfigurationName)_ExtPCRE copy $(SolutionDir)$(ConfigurationName)_ExtPCRE\$(PlatformName)\bin\*-2.0.lib $(OutDir)\lib

|
||||||
|
|
||||||
|
mkdir $(OutDir)\share\glib-2.0\schemas

|
||||||
|
copy ..\..\..\gio\gschema.dtd $(OutDir)\share\glib-2.0\schemas

|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<UserMacro
|
<UserMacro
|
||||||
|
152
build/win32/vs9/gsettings.vcproj
Normal file
152
build/win32/vs9/gsettings.vcproj
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
<?xml version="1.0" encoding="big5"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="gsettings"
|
||||||
|
ProjectGUID="{05041C63-F1C5-49BA-A7DE-61EBB5307EAA}"
|
||||||
|
RootNamespace="gsettings"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
<Platform
|
||||||
|
Name="x64"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
InheritedPropertySheets=".\glib.vsprops"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
PreprocessorDefinitions="_DEBUG;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|x64"
|
||||||
|
InheritedPropertySheets=".\glib.vsprops"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
PreprocessorDefinitions="DEBUG;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="17"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
InheritedPropertySheets=".\glib.vsprops"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|x64"
|
||||||
|
InheritedPropertySheets=".\glib.vsprops"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="17"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File RelativePath="..\..\..\gio\gsettings-tool.c" />
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
@@ -27,7 +27,7 @@ m4_define(glib_configure_ac)
|
|||||||
|
|
||||||
m4_define([glib_major_version], [2])
|
m4_define([glib_major_version], [2])
|
||||||
m4_define([glib_minor_version], [29])
|
m4_define([glib_minor_version], [29])
|
||||||
m4_define([glib_micro_version], [2])
|
m4_define([glib_micro_version], [3])
|
||||||
m4_define([glib_interface_age], [0])
|
m4_define([glib_interface_age], [0])
|
||||||
m4_define([glib_binary_age],
|
m4_define([glib_binary_age],
|
||||||
[m4_eval(100 * glib_minor_version + glib_micro_version)])
|
[m4_eval(100 * glib_minor_version + glib_micro_version)])
|
||||||
@@ -578,7 +578,7 @@ AC_FUNC_ALLOCA
|
|||||||
AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2)
|
AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2)
|
||||||
AC_CHECK_FUNCS(atexit on_exit timegm gmtime_r)
|
AC_CHECK_FUNCS(atexit on_exit timegm gmtime_r)
|
||||||
# BSD has a qsort_r with wrong argument order
|
# BSD has a qsort_r with wrong argument order
|
||||||
AC_MSG_CHECKING([for qsort_r])
|
AC_CACHE_CHECK([for qsort_r], glib_cv_have_qsort_r, [
|
||||||
AC_RUN_IFELSE([[
|
AC_RUN_IFELSE([[
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -609,9 +609,9 @@ main (int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}]],[have_qsort_r=yes],[have_qsort_r=no])
|
}]],[glib_cv_have_qsort_r=yes],[glib_cv_have_qsort_r=no])])
|
||||||
|
|
||||||
if test $have_qsort_r = yes ; then
|
if test $glib_cv_have_qsort_r = yes ; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
AC_DEFINE(HAVE_QSORT_R, 1, [Define to 1 if you have the 'qsort_r' function])
|
AC_DEFINE(HAVE_QSORT_R, 1, [Define to 1 if you have the 'qsort_r' function])
|
||||||
else
|
else
|
||||||
|
@@ -1400,6 +1400,8 @@ g_desktop_app_info_new
|
|||||||
g_desktop_app_info_get_filename
|
g_desktop_app_info_get_filename
|
||||||
g_desktop_app_info_get_is_hidden
|
g_desktop_app_info_get_is_hidden
|
||||||
g_desktop_app_info_set_desktop_env
|
g_desktop_app_info_set_desktop_env
|
||||||
|
GDesktopAppLaunchCallback
|
||||||
|
g_desktop_app_info_launch_uris_as_manager
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GDesktopAppInfoClass
|
GDesktopAppInfoClass
|
||||||
G_TYPE_DESKTOP_APP_INFO
|
G_TYPE_DESKTOP_APP_INFO
|
||||||
@@ -1484,6 +1486,7 @@ g_inet_address_new_from_string
|
|||||||
g_inet_address_new_from_bytes
|
g_inet_address_new_from_bytes
|
||||||
g_inet_address_new_any
|
g_inet_address_new_any
|
||||||
g_inet_address_new_loopback
|
g_inet_address_new_loopback
|
||||||
|
g_inet_address_equal
|
||||||
g_inet_address_to_bytes
|
g_inet_address_to_bytes
|
||||||
g_inet_address_get_native_size
|
g_inet_address_get_native_size
|
||||||
g_inet_address_to_string
|
g_inet_address_to_string
|
||||||
|
@@ -49,6 +49,11 @@
|
|||||||
<arg choice="plain"><replaceable>SCHEMA</replaceable><arg choice="opt">:<replaceable>PATH</replaceable></arg></arg>
|
<arg choice="plain"><replaceable>SCHEMA</replaceable><arg choice="opt">:<replaceable>PATH</replaceable></arg></arg>
|
||||||
<arg choice="plain"><replaceable>KEY</replaceable></arg>
|
<arg choice="plain"><replaceable>KEY</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
<cmdsynopsis>
|
||||||
|
<command>gsettings</command>
|
||||||
|
<arg choice="plain">reset-recursively</arg>
|
||||||
|
<arg choice="plain"><replaceable>SCHEMA</replaceable><arg choice="opt">:<replaceable>PATH</replaceable></arg></arg>
|
||||||
|
</cmdsynopsis>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>gsettings</command>
|
<command>gsettings</command>
|
||||||
<arg choice="plain">list-schemas</arg>
|
<arg choice="plain">list-schemas</arg>
|
||||||
@@ -151,6 +156,13 @@ Resets <replaceable>KEY</replaceable> to its default value.
|
|||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>reset-recursively</option></term>
|
||||||
|
<listitem><para>
|
||||||
|
Reset all keys under the given <replaceable>SCHEMA</replaceable>.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>list-schemas</option></term>
|
<term><option>list-schemas</option></term>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
|
@@ -109,6 +109,15 @@ chmod a-w win32.cache # prevent configure from changing it
|
|||||||
built-in version in that case.
|
built-in version in that case.
|
||||||
</para>
|
</para>
|
||||||
</formalpara>
|
</formalpara>
|
||||||
|
<formalpara>
|
||||||
|
<title>glib_cv_have_qsort_r=[yes/no]</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Whether you have <function>qsort_r()</function> that matches
|
||||||
|
BSD. Defaults to "no", which is safe, since GLib uses a
|
||||||
|
built-in version in that case.
|
||||||
|
</para>
|
||||||
|
</formalpara>
|
||||||
<formalpara>
|
<formalpara>
|
||||||
<title>glib_cv_va_val_copy=[yes/no]</title>
|
<title>glib_cv_va_val_copy=[yes/no]</title>
|
||||||
|
|
||||||
|
@@ -96,6 +96,7 @@ synchronize their operation.
|
|||||||
<xi:include href="xml/keyfile.xml" />
|
<xi:include href="xml/keyfile.xml" />
|
||||||
<xi:include href="xml/bookmarkfile.xml" />
|
<xi:include href="xml/bookmarkfile.xml" />
|
||||||
<xi:include href="xml/testing.xml" />
|
<xi:include href="xml/testing.xml" />
|
||||||
|
<xi:include href="xml/gunix.xml" />
|
||||||
<xi:include href="xml/windows.xml" />
|
<xi:include href="xml/windows.xml" />
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
@@ -199,6 +200,10 @@ synchronize their operation.
|
|||||||
<title>Index of new symbols in 2.28</title>
|
<title>Index of new symbols in 2.28</title>
|
||||||
<xi:include href="xml/api-index-2.28.xml"><xi:fallback /></xi:include>
|
<xi:include href="xml/api-index-2.28.xml"><xi:fallback /></xi:include>
|
||||||
</index>
|
</index>
|
||||||
|
<index id="api-index-2-30" role="2.30">
|
||||||
|
<title>Index of new symbols in 2.30</title>
|
||||||
|
<xi:include href="xml/api-index-2.30.xml"><xi:fallback /></xi:include>
|
||||||
|
</index>
|
||||||
|
|
||||||
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||||
|
|
||||||
|
@@ -840,11 +840,6 @@ g_io_channel_set_encoding
|
|||||||
g_io_channel_get_close_on_unref
|
g_io_channel_get_close_on_unref
|
||||||
g_io_channel_set_close_on_unref
|
g_io_channel_set_close_on_unref
|
||||||
|
|
||||||
<SUBSECTION Private>
|
|
||||||
g_io_channel_win32_poll
|
|
||||||
g_io_channel_win32_make_pollfd
|
|
||||||
g_io_channel_win32_get_fd
|
|
||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
g_io_channel_read
|
g_io_channel_read
|
||||||
GIOError
|
GIOError
|
||||||
@@ -853,6 +848,9 @@ g_io_channel_seek
|
|||||||
g_io_channel_close
|
g_io_channel_close
|
||||||
|
|
||||||
<SUBSECTION Private>
|
<SUBSECTION Private>
|
||||||
|
g_io_channel_win32_poll
|
||||||
|
g_io_channel_win32_make_pollfd
|
||||||
|
g_io_channel_win32_get_fd
|
||||||
g_io_channel_error_quark
|
g_io_channel_error_quark
|
||||||
g_io_watch_funcs
|
g_io_watch_funcs
|
||||||
</SECTION>
|
</SECTION>
|
||||||
@@ -1926,6 +1924,16 @@ g_win32_ftruncate
|
|||||||
|
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<TITLE>UNIX-specific utilities and integration</TITLE>
|
||||||
|
<FILE>gunix</FILE>
|
||||||
|
G_UNIX_ERROR
|
||||||
|
g_unix_pipe_flags
|
||||||
|
g_unix_signal_source_new
|
||||||
|
g_unix_signal_add_watch_full
|
||||||
|
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
# Data Structures
|
# Data Structures
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
@@ -2800,6 +2808,7 @@ GTestDataFunc
|
|||||||
g_test_add_data_func
|
g_test_add_data_func
|
||||||
g_test_add
|
g_test_add
|
||||||
|
|
||||||
|
g_test_fail
|
||||||
g_test_message
|
g_test_message
|
||||||
g_test_bug_base
|
g_test_bug_base
|
||||||
g_test_bug
|
g_test_bug
|
||||||
|
@@ -141,7 +141,9 @@ g_action_group_default_init (GActionGroupInterface *class)
|
|||||||
g_action_group_signals[SIGNAL_ACTION_STATE_CHANGED] =
|
g_action_group_signals[SIGNAL_ACTION_STATE_CHANGED] =
|
||||||
g_signal_new (I_("action-state-changed"),
|
g_signal_new (I_("action-state-changed"),
|
||||||
G_TYPE_ACTION_GROUP,
|
G_TYPE_ACTION_GROUP,
|
||||||
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
|
G_SIGNAL_RUN_LAST |
|
||||||
|
G_SIGNAL_DETAILED |
|
||||||
|
G_SIGNAL_MUST_COLLECT,
|
||||||
G_STRUCT_OFFSET (GActionGroupInterface,
|
G_STRUCT_OFFSET (GActionGroupInterface,
|
||||||
action_state_changed),
|
action_state_changed),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "gapplicationcommandline.h"
|
#include "gapplicationcommandline.h"
|
||||||
#include "gapplicationimpl.h"
|
#include "gapplicationimpl.h"
|
||||||
#include "gactiongroup.h"
|
#include "gactiongroup.h"
|
||||||
|
#include "gsettings.h"
|
||||||
|
|
||||||
#include "gioenumtypes.h"
|
#include "gioenumtypes.h"
|
||||||
#include "gio-marshal.h"
|
#include "gio-marshal.h"
|
||||||
@@ -557,7 +558,7 @@ g_application_class_init (GApplicationClass *class)
|
|||||||
g_object_class_install_property (object_class, PROP_INACTIVITY_TIMEOUT,
|
g_object_class_install_property (object_class, PROP_INACTIVITY_TIMEOUT,
|
||||||
g_param_spec_uint ("inactivity-timeout",
|
g_param_spec_uint ("inactivity-timeout",
|
||||||
P_("Inactivity timeout"),
|
P_("Inactivity timeout"),
|
||||||
P_("Iime (ms) to stay alive after becoming idle"),
|
P_("Time (ms) to stay alive after becoming idle"),
|
||||||
0, G_MAXUINT, 0,
|
0, G_MAXUINT, 0,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
@@ -1005,6 +1006,8 @@ g_application_register (GApplication *application,
|
|||||||
g_return_val_if_fail (G_IS_APPLICATION (application), FALSE);
|
g_return_val_if_fail (G_IS_APPLICATION (application), FALSE);
|
||||||
|
|
||||||
if (!application->priv->is_registered)
|
if (!application->priv->is_registered)
|
||||||
|
{
|
||||||
|
if (~application->priv->flags & G_APPLICATION_NON_UNIQUE)
|
||||||
{
|
{
|
||||||
application->priv->impl =
|
application->priv->impl =
|
||||||
g_application_impl_register (application, application->priv->id,
|
g_application_impl_register (application, application->priv->id,
|
||||||
@@ -1014,6 +1017,7 @@ g_application_register (GApplication *application,
|
|||||||
|
|
||||||
if (application->priv->impl == NULL)
|
if (application->priv->impl == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
application->priv->is_remote = application->priv->remote_actions != NULL;
|
application->priv->is_remote = application->priv->remote_actions != NULL;
|
||||||
application->priv->is_registered = TRUE;
|
application->priv->is_registered = TRUE;
|
||||||
@@ -1326,6 +1330,8 @@ g_application_run (GApplication *application,
|
|||||||
if (application->priv->impl)
|
if (application->priv->impl)
|
||||||
g_application_impl_flush (application->priv->impl);
|
g_application_impl_flush (application->priv->impl);
|
||||||
|
|
||||||
|
g_settings_sync ();
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -659,6 +659,9 @@ g_application_impl_register (GApplication *application,
|
|||||||
g_dbus_connection_unregister_object (impl->session_bus,
|
g_dbus_connection_unregister_object (impl->session_bus,
|
||||||
impl->object_id);
|
impl->object_id);
|
||||||
impl->object_id = 0;
|
impl->object_id = 0;
|
||||||
|
g_dbus_connection_unregister_object (impl->session_bus,
|
||||||
|
impl->action_id);
|
||||||
|
impl->action_id = 0;
|
||||||
|
|
||||||
if (flags & G_APPLICATION_IS_SERVICE)
|
if (flags & G_APPLICATION_IS_SERVICE)
|
||||||
{
|
{
|
||||||
|
@@ -258,25 +258,13 @@ is_valid_nonce_tcp (const gchar *address_entry,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonce_file == NULL)
|
if (host != NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
/* TODO: validate host */
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_INVALID_ARGUMENT,
|
|
||||||
_("Error in address `%s' - missing noncefile attribute"),
|
|
||||||
address_entry);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (host == NULL)
|
|
||||||
{
|
|
||||||
g_set_error (error,
|
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_INVALID_ARGUMENT,
|
|
||||||
_("Error in address `%s' - missing host attribute"),
|
|
||||||
address_entry);
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nonce_file = nonce_file; /* To avoid -Wunused-but-set-variable */
|
||||||
|
|
||||||
ret= TRUE;
|
ret= TRUE;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@@ -351,14 +339,9 @@ is_valid_tcp (const gchar *address_entry,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (host == NULL)
|
if (host != NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
/* TODO: validate host */
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_INVALID_ARGUMENT,
|
|
||||||
_("Error in address `%s' - missing host attribute"),
|
|
||||||
address_entry);
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret= TRUE;
|
ret= TRUE;
|
||||||
|
@@ -663,7 +663,8 @@ _g_dbus_auth_run_client (GDBusAuth *auth,
|
|||||||
if (line == NULL)
|
if (line == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
debug_print ("CLIENT: WaitingForReject, read '%s'", line);
|
debug_print ("CLIENT: WaitingForReject, read '%s'", line);
|
||||||
foobar:
|
|
||||||
|
choose_mechanism:
|
||||||
if (!g_str_has_prefix (line, "REJECTED "))
|
if (!g_str_has_prefix (line, "REJECTED "))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
@@ -739,7 +740,7 @@ _g_dbus_auth_run_client (GDBusAuth *auth,
|
|||||||
}
|
}
|
||||||
else if (g_str_has_prefix (line, "REJECTED "))
|
else if (g_str_has_prefix (line, "REJECTED "))
|
||||||
{
|
{
|
||||||
goto foobar;
|
goto choose_mechanism;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -841,6 +842,13 @@ _g_dbus_auth_run_client (GDBusAuth *auth,
|
|||||||
}
|
}
|
||||||
state = CLIENT_STATE_WAITING_FOR_OK;
|
state = CLIENT_STATE_WAITING_FOR_OK;
|
||||||
}
|
}
|
||||||
|
else if (g_str_has_prefix (line, "REJECTED "))
|
||||||
|
{
|
||||||
|
/* could be the chosen authentication method just doesn't work. Try
|
||||||
|
* another one...
|
||||||
|
*/
|
||||||
|
goto choose_mechanism;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
|
@@ -187,8 +187,7 @@ mechanism_server_initiate (GDBusAuthMechanism *mechanism,
|
|||||||
g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM_ANON (mechanism));
|
g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM_ANON (mechanism));
|
||||||
g_return_if_fail (!m->priv->is_server && !m->priv->is_client);
|
g_return_if_fail (!m->priv->is_server && !m->priv->is_client);
|
||||||
|
|
||||||
if (initial_response != NULL)
|
//g_debug ("ANONYMOUS: initial_response was `%s'", initial_response);
|
||||||
g_debug ("ANONYMOUS: initial_response was `%s'", initial_response);
|
|
||||||
|
|
||||||
m->priv->is_server = TRUE;
|
m->priv->is_server = TRUE;
|
||||||
m->priv->state = G_DBUS_AUTH_MECHANISM_STATE_ACCEPTED;
|
m->priv->state = G_DBUS_AUTH_MECHANISM_STATE_ACCEPTED;
|
||||||
|
@@ -652,6 +652,7 @@ keyring_generate_entry (const gchar *cookie_context,
|
|||||||
lines = NULL;
|
lines = NULL;
|
||||||
new_contents = NULL;
|
new_contents = NULL;
|
||||||
have_id = FALSE;
|
have_id = FALSE;
|
||||||
|
use_id = 0;
|
||||||
use_cookie = NULL;
|
use_cookie = NULL;
|
||||||
lock_fd = -1;
|
lock_fd = -1;
|
||||||
|
|
||||||
|
@@ -1992,7 +1992,7 @@ g_dbus_connection_send_message_with_reply_sync (GDBusConnection *connection,
|
|||||||
|
|
||||||
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
|
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
|
||||||
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL);
|
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL);
|
||||||
g_return_val_if_fail ((flags & G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL) || !g_dbus_message_get_locked (message), FALSE);
|
g_return_val_if_fail ((flags & G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL) || !g_dbus_message_get_locked (message), NULL);
|
||||||
g_return_val_if_fail (timeout_msec >= 0 || timeout_msec == -1, NULL);
|
g_return_val_if_fail (timeout_msec >= 0 || timeout_msec == -1, NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
@@ -2264,15 +2264,20 @@ initable_init (GInitable *initable,
|
|||||||
|
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
|
|
||||||
|
/* First, handle the case where the connection already has an
|
||||||
|
* initialization error set.
|
||||||
|
*/
|
||||||
|
if (connection->initialization_error != NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
/* Also make this a no-op if we're already initialized fine */
|
||||||
if (connection->is_initialized)
|
if (connection->is_initialized)
|
||||||
{
|
{
|
||||||
if (connection->stream != NULL)
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
else
|
|
||||||
g_assert (connection->initialization_error != NULL);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
g_assert (connection->initialization_error == NULL);
|
|
||||||
|
g_assert (connection->initialization_error == NULL && !connection->is_initialized);
|
||||||
|
|
||||||
/* The user can pass multiple (but mutally exclusive) construct
|
/* The user can pass multiple (but mutally exclusive) construct
|
||||||
* properties:
|
* properties:
|
||||||
|
@@ -3197,8 +3197,8 @@ g_dbus_message_lock (GDBusMessage *message)
|
|||||||
* This operation can fail if e.g. @message contains file descriptors
|
* This operation can fail if e.g. @message contains file descriptors
|
||||||
* and the per-process or system-wide open files limit is reached.
|
* and the per-process or system-wide open files limit is reached.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): A new #GDBusMessage or %NULL if @error is set. Free with
|
* Returns: (transfer full): A new #GDBusMessage or %NULL if @error is set.
|
||||||
* g_object_unref().
|
* Free with g_object_unref().
|
||||||
*
|
*
|
||||||
* Since: 2.26
|
* Since: 2.26
|
||||||
*/
|
*/
|
||||||
@@ -3212,7 +3212,7 @@ g_dbus_message_copy (GDBusMessage *message,
|
|||||||
GVariant *header_value;
|
GVariant *header_value;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL);
|
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
ret = g_dbus_message_new ();
|
ret = g_dbus_message_new ();
|
||||||
ret->type = message->type;
|
ret->type = message->type;
|
||||||
@@ -3255,4 +3255,3 @@ g_dbus_message_copy (GDBusMessage *message,
|
|||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -399,10 +399,10 @@ struct GDBusWorker
|
|||||||
* only user) - we might want it to affect messages sent to the other peer too?
|
* only user) - we might want it to affect messages sent to the other peer too?
|
||||||
*/
|
*/
|
||||||
gboolean frozen;
|
gboolean frozen;
|
||||||
|
GDBusCapabilityFlags capabilities;
|
||||||
GQueue *received_messages_while_frozen;
|
GQueue *received_messages_while_frozen;
|
||||||
|
|
||||||
GIOStream *stream;
|
GIOStream *stream;
|
||||||
GDBusCapabilityFlags capabilities;
|
|
||||||
GCancellable *cancellable;
|
GCancellable *cancellable;
|
||||||
GDBusWorkerMessageReceivedCallback message_received_callback;
|
GDBusWorkerMessageReceivedCallback message_received_callback;
|
||||||
GDBusWorkerMessageAboutToBeSentCallback message_about_to_be_sent_callback;
|
GDBusWorkerMessageAboutToBeSentCallback message_about_to_be_sent_callback;
|
||||||
@@ -425,9 +425,9 @@ struct GDBusWorker
|
|||||||
gint read_num_ancillary_messages;
|
gint read_num_ancillary_messages;
|
||||||
|
|
||||||
/* used for writing */
|
/* used for writing */
|
||||||
|
gint num_writes_pending;
|
||||||
GMutex *write_lock;
|
GMutex *write_lock;
|
||||||
GQueue *write_queue;
|
GQueue *write_queue;
|
||||||
gint num_writes_pending;
|
|
||||||
guint64 write_num_messages_written;
|
guint64 write_num_messages_written;
|
||||||
GList *write_pending_flushes;
|
GList *write_pending_flushes;
|
||||||
gboolean flush_pending;
|
gboolean flush_pending;
|
||||||
|
@@ -83,9 +83,9 @@
|
|||||||
struct _GDBusProxyPrivate
|
struct _GDBusProxyPrivate
|
||||||
{
|
{
|
||||||
GBusType bus_type;
|
GBusType bus_type;
|
||||||
|
GDBusProxyFlags flags;
|
||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
|
|
||||||
GDBusProxyFlags flags;
|
|
||||||
gchar *name;
|
gchar *name;
|
||||||
gchar *name_owner;
|
gchar *name_owner;
|
||||||
gchar *object_path;
|
gchar *object_path;
|
||||||
@@ -505,7 +505,7 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
|
|||||||
*/
|
*/
|
||||||
signals[PROPERTIES_CHANGED_SIGNAL] = g_signal_new ("g-properties-changed",
|
signals[PROPERTIES_CHANGED_SIGNAL] = g_signal_new ("g-properties-changed",
|
||||||
G_TYPE_DBUS_PROXY,
|
G_TYPE_DBUS_PROXY,
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
|
||||||
G_STRUCT_OFFSET (GDBusProxyClass, g_properties_changed),
|
G_STRUCT_OFFSET (GDBusProxyClass, g_properties_changed),
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -528,7 +528,7 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
|
|||||||
*/
|
*/
|
||||||
signals[SIGNAL_SIGNAL] = g_signal_new ("g-signal",
|
signals[SIGNAL_SIGNAL] = g_signal_new ("g-signal",
|
||||||
G_TYPE_DBUS_PROXY,
|
G_TYPE_DBUS_PROXY,
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
|
||||||
G_STRUCT_OFFSET (GDBusProxyClass, g_signal),
|
G_STRUCT_OFFSET (GDBusProxyClass, g_signal),
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -1037,14 +1037,13 @@ on_name_owner_changed (GDBusConnection *connection,
|
|||||||
g_hash_table_size (proxy->priv->properties) > 0)
|
g_hash_table_size (proxy->priv->properties) > 0)
|
||||||
{
|
{
|
||||||
GVariantBuilder builder;
|
GVariantBuilder builder;
|
||||||
GVariant *changed_properties;
|
|
||||||
GPtrArray *invalidated_properties;
|
GPtrArray *invalidated_properties;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
const gchar *key;
|
const gchar *key;
|
||||||
|
|
||||||
/* Build changed_properties (always empty) and invalidated_properties ... */
|
/* Build changed_properties (always empty) and invalidated_properties ... */
|
||||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
||||||
changed_properties = g_variant_builder_end (&builder);
|
|
||||||
invalidated_properties = g_ptr_array_new_with_free_func (g_free);
|
invalidated_properties = g_ptr_array_new_with_free_func (g_free);
|
||||||
g_hash_table_iter_init (&iter, proxy->priv->properties);
|
g_hash_table_iter_init (&iter, proxy->priv->properties);
|
||||||
while (g_hash_table_iter_next (&iter, (gpointer) &key, NULL))
|
while (g_hash_table_iter_next (&iter, (gpointer) &key, NULL))
|
||||||
@@ -1057,9 +1056,8 @@ on_name_owner_changed (GDBusConnection *connection,
|
|||||||
/* ... and finally emit the ::g-properties-changed signal */
|
/* ... and finally emit the ::g-properties-changed signal */
|
||||||
g_signal_emit (proxy, signals[PROPERTIES_CHANGED_SIGNAL],
|
g_signal_emit (proxy, signals[PROPERTIES_CHANGED_SIGNAL],
|
||||||
0,
|
0,
|
||||||
changed_properties,
|
g_variant_builder_end (&builder) /* consumed */,
|
||||||
(const gchar* const *) invalidated_properties->pdata);
|
(const gchar* const *) invalidated_properties->pdata);
|
||||||
g_variant_unref (changed_properties);
|
|
||||||
g_ptr_array_unref (invalidated_properties);
|
g_ptr_array_unref (invalidated_properties);
|
||||||
}
|
}
|
||||||
g_object_notify (G_OBJECT (proxy), "g-name-owner");
|
g_object_notify (G_OBJECT (proxy), "g-name-owner");
|
||||||
|
@@ -63,7 +63,13 @@
|
|||||||
* @include: gio/gio.h
|
* @include: gio/gio.h
|
||||||
*
|
*
|
||||||
* #GDBusServer is a helper for listening to and accepting D-Bus
|
* #GDBusServer is a helper for listening to and accepting D-Bus
|
||||||
* connections.
|
* connections. This can be used to create a new D-Bus server, allowing two
|
||||||
|
* peers to use the D-Bus protocol for their own specialized communication.
|
||||||
|
* A server instance provided in this way will not perform message routing or
|
||||||
|
* implement the org.freedesktop.DBus interface.
|
||||||
|
*
|
||||||
|
* To just export an object on a well-known name on a message bus, such as the
|
||||||
|
* session or system bus, you should instead use g_bus_own_name().
|
||||||
*
|
*
|
||||||
* <example id="gdbus-peer-to-peer"><title>D-Bus peer-to-peer example</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-peer.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
|
* <example id="gdbus-peer-to-peer"><title>D-Bus peer-to-peer example</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-peer.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
|
||||||
*/
|
*/
|
||||||
@@ -979,10 +985,15 @@ on_run (GSocketService *service,
|
|||||||
|
|
||||||
if (server->flags & G_DBUS_SERVER_FLAGS_RUN_IN_THREAD)
|
if (server->flags & G_DBUS_SERVER_FLAGS_RUN_IN_THREAD)
|
||||||
{
|
{
|
||||||
|
gboolean claimed;
|
||||||
|
|
||||||
|
claimed = FALSE;
|
||||||
g_signal_emit (server,
|
g_signal_emit (server,
|
||||||
_signals[NEW_CONNECTION_SIGNAL],
|
_signals[NEW_CONNECTION_SIGNAL],
|
||||||
0,
|
0,
|
||||||
connection);
|
connection,
|
||||||
|
&claimed);
|
||||||
|
if (claimed)
|
||||||
g_dbus_connection_start_message_processing (connection);
|
g_dbus_connection_start_message_processing (connection);
|
||||||
g_object_unref (connection);
|
g_object_unref (connection);
|
||||||
}
|
}
|
||||||
|
@@ -64,8 +64,14 @@
|
|||||||
#define ADDED_ASSOCIATIONS_GROUP "Added Associations"
|
#define ADDED_ASSOCIATIONS_GROUP "Added Associations"
|
||||||
#define REMOVED_ASSOCIATIONS_GROUP "Removed Associations"
|
#define REMOVED_ASSOCIATIONS_GROUP "Removed Associations"
|
||||||
#define MIME_CACHE_GROUP "MIME Cache"
|
#define MIME_CACHE_GROUP "MIME Cache"
|
||||||
|
#define GENERIC_NAME_KEY "GenericName"
|
||||||
#define FULL_NAME_KEY "X-GNOME-FullName"
|
#define FULL_NAME_KEY "X-GNOME-FullName"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_0,
|
||||||
|
PROP_FILENAME
|
||||||
|
};
|
||||||
|
|
||||||
static void g_desktop_app_info_iface_init (GAppInfoIface *iface);
|
static void g_desktop_app_info_iface_init (GAppInfoIface *iface);
|
||||||
static GList * get_all_desktop_entries_for_mime_type (const char *base_mime_type,
|
static GList * get_all_desktop_entries_for_mime_type (const char *base_mime_type,
|
||||||
const char **except,
|
const char **except,
|
||||||
@@ -88,7 +94,7 @@ struct _GDesktopAppInfo
|
|||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
/* FIXME: what about GenericName ? */
|
char *generic_name;
|
||||||
char *fullname;
|
char *fullname;
|
||||||
char *comment;
|
char *comment;
|
||||||
char *icon_name;
|
char *icon_name;
|
||||||
@@ -99,6 +105,7 @@ struct _GDesktopAppInfo
|
|||||||
char *exec;
|
char *exec;
|
||||||
char *binary;
|
char *binary;
|
||||||
char *path;
|
char *path;
|
||||||
|
char *categories;
|
||||||
|
|
||||||
guint nodisplay : 1;
|
guint nodisplay : 1;
|
||||||
guint hidden : 1;
|
guint hidden : 1;
|
||||||
@@ -161,6 +168,7 @@ g_desktop_app_info_finalize (GObject *object)
|
|||||||
g_free (info->desktop_id);
|
g_free (info->desktop_id);
|
||||||
g_free (info->filename);
|
g_free (info->filename);
|
||||||
g_free (info->name);
|
g_free (info->name);
|
||||||
|
g_free (info->generic_name);
|
||||||
g_free (info->fullname);
|
g_free (info->fullname);
|
||||||
g_free (info->comment);
|
g_free (info->comment);
|
||||||
g_free (info->icon_name);
|
g_free (info->icon_name);
|
||||||
@@ -172,16 +180,69 @@ g_desktop_app_info_finalize (GObject *object)
|
|||||||
g_free (info->exec);
|
g_free (info->exec);
|
||||||
g_free (info->binary);
|
g_free (info->binary);
|
||||||
g_free (info->path);
|
g_free (info->path);
|
||||||
|
g_free (info->categories);
|
||||||
|
|
||||||
G_OBJECT_CLASS (g_desktop_app_info_parent_class)->finalize (object);
|
G_OBJECT_CLASS (g_desktop_app_info_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
g_desktop_app_info_set_property(GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GDesktopAppInfo *self = G_DESKTOP_APP_INFO (object);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_FILENAME:
|
||||||
|
self->filename = g_value_dup_string (value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
g_desktop_app_info_get_property(GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GDesktopAppInfo *self = G_DESKTOP_APP_INFO (object);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_FILENAME:
|
||||||
|
g_value_set_string (value, self->filename);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_desktop_app_info_class_init (GDesktopAppInfoClass *klass)
|
g_desktop_app_info_class_init (GDesktopAppInfoClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
gobject_class->get_property = g_desktop_app_info_get_property;
|
||||||
|
gobject_class->set_property = g_desktop_app_info_set_property;
|
||||||
gobject_class->finalize = g_desktop_app_info_finalize;
|
gobject_class->finalize = g_desktop_app_info_finalize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GDesktopAppInfo:filename
|
||||||
|
*
|
||||||
|
* The origin filename of this #GDesktopAppInfo
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_FILENAME,
|
||||||
|
g_param_spec_string ("filename", "Filename", "",
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -205,20 +266,10 @@ binary_from_exec (const char *exec)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static gboolean
|
||||||
* g_desktop_app_info_new_from_keyfile:
|
g_desktop_app_info_load_from_keyfile (GDesktopAppInfo *info,
|
||||||
* @key_file: an opened #GKeyFile
|
GKeyFile *key_file)
|
||||||
*
|
|
||||||
* Creates a new #GDesktopAppInfo.
|
|
||||||
*
|
|
||||||
* Returns: a new #GDesktopAppInfo or %NULL on error.
|
|
||||||
*
|
|
||||||
* Since: 2.18
|
|
||||||
**/
|
|
||||||
GDesktopAppInfo *
|
|
||||||
g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
|
||||||
{
|
{
|
||||||
GDesktopAppInfo *info;
|
|
||||||
char *start_group;
|
char *start_group;
|
||||||
char *type;
|
char *type;
|
||||||
char *try_exec;
|
char *try_exec;
|
||||||
@@ -227,7 +278,7 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
|||||||
if (start_group == NULL || strcmp (start_group, G_KEY_FILE_DESKTOP_GROUP) != 0)
|
if (start_group == NULL || strcmp (start_group, G_KEY_FILE_DESKTOP_GROUP) != 0)
|
||||||
{
|
{
|
||||||
g_free (start_group);
|
g_free (start_group);
|
||||||
return NULL;
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_free (start_group);
|
g_free (start_group);
|
||||||
|
|
||||||
@@ -238,7 +289,7 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
|||||||
if (type == NULL || strcmp (type, G_KEY_FILE_DESKTOP_TYPE_APPLICATION) != 0)
|
if (type == NULL || strcmp (type, G_KEY_FILE_DESKTOP_TYPE_APPLICATION) != 0)
|
||||||
{
|
{
|
||||||
g_free (type);
|
g_free (type);
|
||||||
return NULL;
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_free (type);
|
g_free (type);
|
||||||
|
|
||||||
@@ -253,15 +304,13 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
|||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
{
|
{
|
||||||
g_free (try_exec);
|
g_free (try_exec);
|
||||||
return NULL;
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_free (t);
|
g_free (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
info = g_object_new (G_TYPE_DESKTOP_APP_INFO, NULL);
|
|
||||||
info->filename = NULL;
|
|
||||||
|
|
||||||
info->name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
|
info->name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
|
||||||
|
info->generic_name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, GENERIC_NAME_KEY, NULL, NULL);
|
||||||
info->fullname = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, FULL_NAME_KEY, NULL, NULL);
|
info->fullname = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, FULL_NAME_KEY, NULL, NULL);
|
||||||
info->comment = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
|
info->comment = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
|
||||||
info->nodisplay = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, NULL) != FALSE;
|
info->nodisplay = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, NULL) != FALSE;
|
||||||
@@ -275,6 +324,7 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
|||||||
info->startup_notify = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY, NULL) != FALSE;
|
info->startup_notify = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY, NULL) != FALSE;
|
||||||
info->no_fuse = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-GIO-NoFuse", NULL) != FALSE;
|
info->no_fuse = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-GIO-NoFuse", NULL) != FALSE;
|
||||||
info->hidden = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_HIDDEN, NULL) != FALSE;
|
info->hidden = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_HIDDEN, NULL) != FALSE;
|
||||||
|
info->categories = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_CATEGORIES, NULL);
|
||||||
|
|
||||||
info->icon = NULL;
|
info->icon = NULL;
|
||||||
if (info->icon_name)
|
if (info->icon_name)
|
||||||
@@ -311,6 +361,53 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
|||||||
info->path = NULL;
|
info->path = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
g_desktop_app_info_load_file (GDesktopAppInfo *self)
|
||||||
|
{
|
||||||
|
GKeyFile *key_file;
|
||||||
|
gboolean retval = FALSE;
|
||||||
|
|
||||||
|
g_return_val_if_fail (self->filename != NULL, FALSE);
|
||||||
|
|
||||||
|
key_file = g_key_file_new ();
|
||||||
|
|
||||||
|
if (g_key_file_load_from_file (key_file,
|
||||||
|
self->filename,
|
||||||
|
G_KEY_FILE_NONE,
|
||||||
|
NULL))
|
||||||
|
{
|
||||||
|
retval = g_desktop_app_info_load_from_keyfile (self, key_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_key_file_free (key_file);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_desktop_app_info_new_from_keyfile:
|
||||||
|
* @key_file: an opened #GKeyFile
|
||||||
|
*
|
||||||
|
* Creates a new #GDesktopAppInfo.
|
||||||
|
*
|
||||||
|
* Returns: a new #GDesktopAppInfo or %NULL on error.
|
||||||
|
*
|
||||||
|
* Since: 2.18
|
||||||
|
**/
|
||||||
|
GDesktopAppInfo *
|
||||||
|
g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
||||||
|
{
|
||||||
|
GDesktopAppInfo *info;
|
||||||
|
|
||||||
|
info = g_object_new (G_TYPE_DESKTOP_APP_INFO, NULL);
|
||||||
|
info->filename = NULL;
|
||||||
|
if (!g_desktop_app_info_load_from_keyfile (info, key_file))
|
||||||
|
{
|
||||||
|
g_object_unref (info);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,23 +422,14 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
|||||||
GDesktopAppInfo *
|
GDesktopAppInfo *
|
||||||
g_desktop_app_info_new_from_filename (const char *filename)
|
g_desktop_app_info_new_from_filename (const char *filename)
|
||||||
{
|
{
|
||||||
GKeyFile *key_file;
|
|
||||||
GDesktopAppInfo *info = NULL;
|
GDesktopAppInfo *info = NULL;
|
||||||
|
|
||||||
key_file = g_key_file_new ();
|
info = g_object_new (G_TYPE_DESKTOP_APP_INFO, "filename", filename, NULL);
|
||||||
|
if (!g_desktop_app_info_load_file (info))
|
||||||
if (g_key_file_load_from_file (key_file,
|
|
||||||
filename,
|
|
||||||
G_KEY_FILE_NONE,
|
|
||||||
NULL))
|
|
||||||
{
|
{
|
||||||
info = g_desktop_app_info_new_from_keyfile (key_file);
|
g_object_unref (info);
|
||||||
if (info)
|
return NULL;
|
||||||
info->filename = g_strdup (filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_key_file_free (key_file);
|
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,6 +518,7 @@ g_desktop_app_info_dup (GAppInfo *appinfo)
|
|||||||
new_info->desktop_id = g_strdup (info->desktop_id);
|
new_info->desktop_id = g_strdup (info->desktop_id);
|
||||||
|
|
||||||
new_info->name = g_strdup (info->name);
|
new_info->name = g_strdup (info->name);
|
||||||
|
new_info->generic_name = g_strdup (info->generic_name);
|
||||||
new_info->fullname = g_strdup (info->fullname);
|
new_info->fullname = g_strdup (info->fullname);
|
||||||
new_info->comment = g_strdup (info->comment);
|
new_info->comment = g_strdup (info->comment);
|
||||||
new_info->nodisplay = info->nodisplay;
|
new_info->nodisplay = info->nodisplay;
|
||||||
@@ -555,6 +644,31 @@ g_desktop_app_info_get_icon (GAppInfo *appinfo)
|
|||||||
return info->icon;
|
return info->icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_desktop_app_info_get_categories:
|
||||||
|
* @info: a #GDesktopAppInfo
|
||||||
|
*
|
||||||
|
* Returns: The unparsed Categories key from the file; i.e. no attempt
|
||||||
|
* is made to split it by ';' or validate it.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
g_desktop_app_info_get_categories (GDesktopAppInfo *info)
|
||||||
|
{
|
||||||
|
return info->categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_desktop_app_info_get_generic_name:
|
||||||
|
* @info: a #GDesktopAppInfo
|
||||||
|
*
|
||||||
|
* Returns: The value of the GenericName key
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
g_desktop_app_info_get_generic_name (GDesktopAppInfo *info)
|
||||||
|
{
|
||||||
|
return info->generic_name;
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
expand_macro_single (char macro, char *uri)
|
expand_macro_single (char macro, char *uri)
|
||||||
{
|
{
|
||||||
@@ -1813,6 +1927,10 @@ g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
|
|||||||
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
|
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
|
||||||
G_KEY_FILE_DESKTOP_KEY_NAME, info->name);
|
G_KEY_FILE_DESKTOP_KEY_NAME, info->name);
|
||||||
|
|
||||||
|
if (info->generic_name != NULL)
|
||||||
|
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
|
||||||
|
GENERIC_NAME_KEY, info->generic_name);
|
||||||
|
|
||||||
if (info->fullname != NULL)
|
if (info->fullname != NULL)
|
||||||
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
|
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
|
||||||
FULL_NAME_KEY, info->fullname);
|
FULL_NAME_KEY, info->fullname);
|
||||||
@@ -1932,10 +2050,10 @@ g_app_info_create_from_commandline (const char *commandline,
|
|||||||
info->filename = NULL;
|
info->filename = NULL;
|
||||||
info->desktop_id = NULL;
|
info->desktop_id = NULL;
|
||||||
|
|
||||||
info->terminal = flags & G_APP_INFO_CREATE_NEEDS_TERMINAL;
|
info->terminal = (flags & G_APP_INFO_CREATE_NEEDS_TERMINAL) != 0;
|
||||||
info->startup_notify = flags & G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION;
|
info->startup_notify = (flags & G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION) != 0;
|
||||||
info->hidden = FALSE;
|
info->hidden = FALSE;
|
||||||
if (flags & G_APP_INFO_CREATE_SUPPORTS_URIS)
|
if ((flags & G_APP_INFO_CREATE_SUPPORTS_URIS) != 0)
|
||||||
info->exec = g_strconcat (commandline, " %u", NULL);
|
info->exec = g_strconcat (commandline, " %u", NULL);
|
||||||
else
|
else
|
||||||
info->exec = g_strconcat (commandline, " %f", NULL);
|
info->exec = g_strconcat (commandline, " %f", NULL);
|
||||||
|
@@ -50,6 +50,9 @@ GDesktopAppInfo *g_desktop_app_info_new_from_keyfile (GKeyFile *key_file
|
|||||||
|
|
||||||
const char * g_desktop_app_info_get_filename (GDesktopAppInfo *info);
|
const char * g_desktop_app_info_get_filename (GDesktopAppInfo *info);
|
||||||
|
|
||||||
|
const char * g_desktop_app_info_get_generic_name (GDesktopAppInfo *info);
|
||||||
|
const char * g_desktop_app_info_get_categories (GDesktopAppInfo *info);
|
||||||
|
|
||||||
GDesktopAppInfo *g_desktop_app_info_new (const char *desktop_id);
|
GDesktopAppInfo *g_desktop_app_info_new (const char *desktop_id);
|
||||||
gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
|
gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
|
||||||
|
|
||||||
|
@@ -2096,12 +2096,13 @@ typedef struct {
|
|||||||
struct _GFileAttributeMatcher {
|
struct _GFileAttributeMatcher {
|
||||||
gboolean all;
|
gboolean all;
|
||||||
SubMatcher sub_matchers[ON_STACK_MATCHERS];
|
SubMatcher sub_matchers[ON_STACK_MATCHERS];
|
||||||
|
gint ref;
|
||||||
|
|
||||||
GArray *more_sub_matchers;
|
GArray *more_sub_matchers;
|
||||||
|
|
||||||
/* Interator */
|
/* Interator */
|
||||||
guint32 iterator_ns;
|
guint32 iterator_ns;
|
||||||
int iterator_pos;
|
gint iterator_pos;
|
||||||
int ref;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -64,8 +64,8 @@ struct _GFilenameCompleter {
|
|||||||
|
|
||||||
GFile *basenames_dir;
|
GFile *basenames_dir;
|
||||||
gboolean basenames_are_escaped;
|
gboolean basenames_are_escaped;
|
||||||
GList *basenames;
|
|
||||||
gboolean dirs_only;
|
gboolean dirs_only;
|
||||||
|
GList *basenames;
|
||||||
|
|
||||||
LoadBasenamesData *basename_loader;
|
LoadBasenamesData *basename_loader;
|
||||||
};
|
};
|
||||||
|
@@ -113,7 +113,7 @@ g_filter_input_stream_class_init (GFilterInputStreamClass *klass)
|
|||||||
g_param_spec_boolean ("close-base-stream",
|
g_param_spec_boolean ("close-base-stream",
|
||||||
P_("Close Base Stream"),
|
P_("Close Base Stream"),
|
||||||
P_("If the base stream should be closed when the filter stream is closed."),
|
P_("If the base stream should be closed when the filter stream is closed."),
|
||||||
TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
|
||||||
G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
|
G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -866,3 +866,32 @@ g_inet_address_get_is_mc_site_local (GInetAddress *address)
|
|||||||
else
|
else
|
||||||
return IN6_IS_ADDR_MC_SITELOCAL (&address->priv->addr.ipv6);
|
return IN6_IS_ADDR_MC_SITELOCAL (&address->priv->addr.ipv6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_inet_address_equal:
|
||||||
|
* @address: A #GInetAddress.
|
||||||
|
* @other_address: Another #GInetAddress.
|
||||||
|
*
|
||||||
|
* Checks if two #GInetAddress instances are equal, e.g. the same address.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if @address and @other_address are equal, %FALSE otherwise.
|
||||||
|
*
|
||||||
|
* Since: 2.30
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
g_inet_address_equal (GInetAddress *address,
|
||||||
|
GInetAddress *other_address)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (G_IS_INET_ADDRESS (address), FALSE);
|
||||||
|
g_return_val_if_fail (G_IS_INET_ADDRESS (other_address), FALSE);
|
||||||
|
|
||||||
|
if (g_inet_address_get_family (address) != g_inet_address_get_family (other_address))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (memcmp (g_inet_address_to_bytes (address),
|
||||||
|
g_inet_address_to_bytes (other_address),
|
||||||
|
g_inet_address_get_native_size (address)) != 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
@@ -69,6 +69,9 @@ GInetAddress * g_inet_address_new_loopback (GSocketFamily
|
|||||||
|
|
||||||
GInetAddress * g_inet_address_new_any (GSocketFamily family);
|
GInetAddress * g_inet_address_new_any (GSocketFamily family);
|
||||||
|
|
||||||
|
gboolean g_inet_address_equal (GInetAddress *address,
|
||||||
|
GInetAddress *other_address);
|
||||||
|
|
||||||
gchar * g_inet_address_to_string (GInetAddress *address);
|
gchar * g_inet_address_to_string (GInetAddress *address);
|
||||||
|
|
||||||
const guint8 * g_inet_address_to_bytes (GInetAddress *address);
|
const guint8 * g_inet_address_to_bytes (GInetAddress *address);
|
||||||
|
@@ -132,7 +132,9 @@ g_app_info_reset_type_associations
|
|||||||
g_desktop_app_info_new_from_filename
|
g_desktop_app_info_new_from_filename
|
||||||
g_desktop_app_info_new_from_keyfile
|
g_desktop_app_info_new_from_keyfile
|
||||||
g_desktop_app_info_new
|
g_desktop_app_info_new
|
||||||
|
g_desktop_app_info_get_categories
|
||||||
g_desktop_app_info_get_filename
|
g_desktop_app_info_get_filename
|
||||||
|
g_desktop_app_info_get_generic_name
|
||||||
g_desktop_app_info_get_is_hidden
|
g_desktop_app_info_get_is_hidden
|
||||||
g_desktop_app_info_get_type G_GNUC_CONST
|
g_desktop_app_info_get_type G_GNUC_CONST
|
||||||
g_desktop_app_info_launch_uris_as_manager
|
g_desktop_app_info_launch_uris_as_manager
|
||||||
@@ -1123,6 +1125,7 @@ g_inet_address_get_is_site_local
|
|||||||
g_inet_address_to_bytes
|
g_inet_address_to_bytes
|
||||||
g_inet_address_get_native_size
|
g_inet_address_get_native_size
|
||||||
g_inet_address_to_string
|
g_inet_address_to_string
|
||||||
|
g_inet_address_equal
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1265,6 +1265,11 @@ typedef enum
|
|||||||
* when editing a git commit message. The environment is available
|
* when editing a git commit message. The environment is available
|
||||||
* to the #GApplication::command-line signal handler, via
|
* to the #GApplication::command-line signal handler, via
|
||||||
* g_application_command_line_getenv().
|
* g_application_command_line_getenv().
|
||||||
|
* @G_APPLICATION_NON_UNIQUE: Make no attempts to do any of the typical
|
||||||
|
* single-instance application negotiation. The application neither
|
||||||
|
* attempts to become the owner of the application ID nor does it
|
||||||
|
* check if an existing owner already exists. Everything occurs in
|
||||||
|
* the local process. Since: 2.30.
|
||||||
*
|
*
|
||||||
* Flags used to define the behaviour of a #GApplication.
|
* Flags used to define the behaviour of a #GApplication.
|
||||||
*
|
*
|
||||||
@@ -1278,7 +1283,9 @@ typedef enum
|
|||||||
|
|
||||||
G_APPLICATION_HANDLES_OPEN = (1 << 2),
|
G_APPLICATION_HANDLES_OPEN = (1 << 2),
|
||||||
G_APPLICATION_HANDLES_COMMAND_LINE = (1 << 3),
|
G_APPLICATION_HANDLES_COMMAND_LINE = (1 << 3),
|
||||||
G_APPLICATION_SEND_ENVIRONMENT = (1 << 4)
|
G_APPLICATION_SEND_ENVIRONMENT = (1 << 4),
|
||||||
|
|
||||||
|
G_APPLICATION_NON_UNIQUE = (1 << 5),
|
||||||
} GApplicationFlags;
|
} GApplicationFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -51,11 +51,10 @@ struct _GIOSchedulerJob {
|
|||||||
GSourceFunc cancel_func; /* Runs under job map lock */
|
GSourceFunc cancel_func; /* Runs under job map lock */
|
||||||
gpointer data;
|
gpointer data;
|
||||||
GDestroyNotify destroy_notify;
|
GDestroyNotify destroy_notify;
|
||||||
|
|
||||||
gint io_priority;
|
|
||||||
GCancellable *cancellable;
|
GCancellable *cancellable;
|
||||||
GMainContext *context;
|
GMainContext *context;
|
||||||
|
|
||||||
|
gint io_priority;
|
||||||
guint idle_tag;
|
guint idle_tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -24,13 +24,16 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <gstdio.h>
|
#include <gstdio.h>
|
||||||
#include <locale.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <gi18n.h>
|
#include <gi18n.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gvdb/gvdb-builder.h"
|
#include "gvdb/gvdb-builder.h"
|
||||||
#include "strinfo.c"
|
#include "strinfo.c"
|
||||||
|
|
||||||
|
@@ -47,8 +47,8 @@ struct _GLocalDirectoryMonitor
|
|||||||
gchar *dirname;
|
gchar *dirname;
|
||||||
GFileMonitorFlags flags;
|
GFileMonitorFlags flags;
|
||||||
/* For mount emulation */
|
/* For mount emulation */
|
||||||
GUnixMountMonitor *mount_monitor;
|
|
||||||
gboolean was_mounted;
|
gboolean was_mounted;
|
||||||
|
GUnixMountMonitor *mount_monitor;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GLocalDirectoryMonitorClass
|
struct _GLocalDirectoryMonitorClass
|
||||||
|
@@ -1297,8 +1297,8 @@ g_local_file_read (GFile *file,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GLocalFile *local = G_LOCAL_FILE (file);
|
GLocalFile *local = G_LOCAL_FILE (file);
|
||||||
int fd;
|
int fd, ret;
|
||||||
struct stat buf;
|
GLocalFileStat buf;
|
||||||
|
|
||||||
fd = g_open (local->filename, O_RDONLY|O_BINARY, 0);
|
fd = g_open (local->filename, O_RDONLY|O_BINARY, 0);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
@@ -1312,7 +1312,13 @@ g_local_file_read (GFile *file,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fstat(fd, &buf) == 0 && S_ISDIR (buf.st_mode))
|
#ifdef G_OS_WIN32
|
||||||
|
ret = _fstati64 (fd, &buf);
|
||||||
|
#else
|
||||||
|
ret = fstat (fd, &buf);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (ret == 0 && S_ISDIR (buf.st_mode))
|
||||||
{
|
{
|
||||||
close (fd);
|
close (fd);
|
||||||
g_set_error_literal (error, G_IO_ERROR,
|
g_set_error_literal (error, G_IO_ERROR,
|
||||||
|
@@ -1883,7 +1883,7 @@ set_unix_mode (char *filename,
|
|||||||
const GFileAttributeValue *value,
|
const GFileAttributeValue *value,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
guint32 val;
|
guint32 val = 0;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
if (!get_uint32 (value, &val, error))
|
if (!get_uint32 (value, &val, error))
|
||||||
@@ -1934,7 +1934,7 @@ set_unix_uid_gid (char *filename,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
guint32 val;
|
guint32 val = 0;
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
|
|
||||||
@@ -2070,8 +2070,8 @@ set_mtime_atime (char *filename,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
guint64 val;
|
guint64 val = 0;
|
||||||
guint32 val_usec;
|
guint32 val_usec = 0;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
gboolean got_stat = FALSE;
|
gboolean got_stat = FALSE;
|
||||||
struct timeval times[2] = { {0, 0}, {0, 0} };
|
struct timeval times[2] = { {0, 0}, {0, 0} };
|
||||||
|
@@ -909,10 +909,16 @@ handle_overwrite_open (const char *filename,
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct stat tmp_statbuf;
|
GLocalFileStat tmp_statbuf;
|
||||||
|
int tres;
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
tres = _fstati64 (tmpfd, &tmp_statbuf);
|
||||||
|
#else
|
||||||
|
tres = fstat (tmpfd, &tmp_statbuf);
|
||||||
|
#endif
|
||||||
/* Check that we really needed to change something */
|
/* Check that we really needed to change something */
|
||||||
if (fstat (tmpfd, &tmp_statbuf) != 0 ||
|
if (tres != 0 ||
|
||||||
original_stat.st_uid != tmp_statbuf.st_uid ||
|
original_stat.st_uid != tmp_statbuf.st_uid ||
|
||||||
original_stat.st_gid != tmp_statbuf.st_gid ||
|
original_stat.st_gid != tmp_statbuf.st_gid ||
|
||||||
original_stat.st_mode != tmp_statbuf.st_mode)
|
original_stat.st_mode != tmp_statbuf.st_mode)
|
||||||
|
@@ -212,6 +212,36 @@ g_resolver_maybe_reload (GResolver *resolver)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* filter out duplicates, cf. https://bugzilla.gnome.org/show_bug.cgi?id=631379 */
|
||||||
|
static void
|
||||||
|
remove_duplicates (GList *addrs)
|
||||||
|
{
|
||||||
|
GList *l;
|
||||||
|
GList *ll;
|
||||||
|
GList *lll;
|
||||||
|
|
||||||
|
/* TODO: if this is too slow (it's O(n^2) but n is typically really
|
||||||
|
* small), we can do something more clever but note that we must not
|
||||||
|
* change the order of elements...
|
||||||
|
*/
|
||||||
|
for (l = addrs; l != NULL; l = l->next)
|
||||||
|
{
|
||||||
|
GInetAddress *address = G_INET_ADDRESS (l->data);
|
||||||
|
for (ll = l->next; ll != NULL; ll = lll)
|
||||||
|
{
|
||||||
|
GInetAddress *other_address = G_INET_ADDRESS (ll->data);
|
||||||
|
lll = ll->next;
|
||||||
|
if (g_inet_address_equal (address, other_address))
|
||||||
|
{
|
||||||
|
g_object_unref (other_address);
|
||||||
|
/* we never return the first element */
|
||||||
|
g_warn_if_fail (g_list_delete_link (addrs, ll) == addrs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_resolver_lookup_by_name:
|
* g_resolver_lookup_by_name:
|
||||||
* @resolver: a #GResolver
|
* @resolver: a #GResolver
|
||||||
@@ -225,9 +255,12 @@ g_resolver_maybe_reload (GResolver *resolver)
|
|||||||
* a wrapper around g_inet_address_new_from_string()).
|
* a wrapper around g_inet_address_new_from_string()).
|
||||||
*
|
*
|
||||||
* On success, g_resolver_lookup_by_name() will return a #GList of
|
* On success, g_resolver_lookup_by_name() will return a #GList of
|
||||||
* #GInetAddress, sorted in order of preference. (That is, you should
|
* #GInetAddress, sorted in order of preference and guaranteed to not
|
||||||
* attempt to connect to the first address first, then the second if
|
* contain duplicates. That is, if using the result to connect to
|
||||||
* the first fails, etc.)
|
* @hostname, you should attempt to connect to the first address
|
||||||
|
* first, then the second if the first fails, etc. If you are using
|
||||||
|
* the result to listen on a socket, it is appropriate to add each
|
||||||
|
* result using e.g. g_socket_listener_add_address().
|
||||||
*
|
*
|
||||||
* If the DNS resolution fails, @error (if non-%NULL) will be set to a
|
* If the DNS resolution fails, @error (if non-%NULL) will be set to a
|
||||||
* value from #GResolverError.
|
* value from #GResolverError.
|
||||||
@@ -272,6 +305,8 @@ g_resolver_lookup_by_name (GResolver *resolver,
|
|||||||
addrs = G_RESOLVER_GET_CLASS (resolver)->
|
addrs = G_RESOLVER_GET_CLASS (resolver)->
|
||||||
lookup_by_name (resolver, hostname, cancellable, error);
|
lookup_by_name (resolver, hostname, cancellable, error);
|
||||||
|
|
||||||
|
remove_duplicates (addrs);
|
||||||
|
|
||||||
g_free (ascii_hostname);
|
g_free (ascii_hostname);
|
||||||
return addrs;
|
return addrs;
|
||||||
}
|
}
|
||||||
@@ -354,6 +389,8 @@ g_resolver_lookup_by_name_finish (GResolver *resolver,
|
|||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
GList *addrs;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
|
g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
|
||||||
|
|
||||||
if (G_IS_SIMPLE_ASYNC_RESULT (result))
|
if (G_IS_SIMPLE_ASYNC_RESULT (result))
|
||||||
@@ -373,8 +410,12 @@ g_resolver_lookup_by_name_finish (GResolver *resolver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return G_RESOLVER_GET_CLASS (resolver)->
|
addrs = G_RESOLVER_GET_CLASS (resolver)->
|
||||||
lookup_by_name_finish (resolver, result, error);
|
lookup_by_name_finish (resolver, result, error);
|
||||||
|
|
||||||
|
remove_duplicates (addrs);
|
||||||
|
|
||||||
|
return addrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -357,6 +357,54 @@ gsettings_reset (GSettings *settings,
|
|||||||
g_settings_sync ();
|
g_settings_sync ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
reset_all_keys (GSettings *settings)
|
||||||
|
{
|
||||||
|
gchar **keys;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
keys = g_settings_list_keys (settings);
|
||||||
|
for (i = 0; keys[i]; i++)
|
||||||
|
{
|
||||||
|
g_settings_reset (settings, keys[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_strfreev (keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gsettings_reset_recursively (GSettings *settings,
|
||||||
|
const gchar *key,
|
||||||
|
const gchar *value)
|
||||||
|
{
|
||||||
|
gchar **children;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
g_settings_delay (settings);
|
||||||
|
|
||||||
|
reset_all_keys (settings);
|
||||||
|
children = g_settings_list_children (settings);
|
||||||
|
for (i = 0; children[i]; i++)
|
||||||
|
{
|
||||||
|
GSettings *child;
|
||||||
|
gchar *schema;
|
||||||
|
|
||||||
|
child = g_settings_get_child (settings, children[i]);
|
||||||
|
g_object_get (child, "schema", &schema, NULL);
|
||||||
|
|
||||||
|
if (is_schema (schema))
|
||||||
|
reset_all_keys (child);
|
||||||
|
|
||||||
|
g_object_unref (child);
|
||||||
|
g_free (schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_strfreev (children);
|
||||||
|
|
||||||
|
g_settings_apply (settings);
|
||||||
|
g_settings_sync ();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gsettings_writable (GSettings *settings,
|
gsettings_writable (GSettings *settings,
|
||||||
const gchar *key,
|
const gchar *key,
|
||||||
@@ -409,6 +457,7 @@ gsettings_set (GSettings *settings,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *existing;
|
GVariant *existing;
|
||||||
GVariant *new;
|
GVariant *new;
|
||||||
|
GVariant *stored;
|
||||||
gchar *freeme = NULL;
|
gchar *freeme = NULL;
|
||||||
|
|
||||||
existing = g_settings_get_value (settings, key);
|
existing = g_settings_get_value (settings, key);
|
||||||
@@ -442,16 +491,23 @@ gsettings_set (GSettings *settings,
|
|||||||
if (!g_settings_range_check (settings, key, new))
|
if (!g_settings_range_check (settings, key, new))
|
||||||
{
|
{
|
||||||
g_printerr (_("The provided value is outside of the valid range\n"));
|
g_printerr (_("The provided value is outside of the valid range\n"));
|
||||||
g_variant_unref (new);
|
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_settings_set_value (settings, key, new);
|
g_settings_set_value (settings, key, new);
|
||||||
|
g_settings_sync ();
|
||||||
|
|
||||||
|
stored = g_settings_get_value (settings, key);
|
||||||
|
if (g_variant_equal (stored, existing))
|
||||||
|
{
|
||||||
|
g_printerr (_("Failed to set value\n"));
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_variant_unref (stored);
|
||||||
g_variant_unref (existing);
|
g_variant_unref (existing);
|
||||||
g_variant_unref (new);
|
g_variant_unref (new);
|
||||||
|
|
||||||
g_settings_sync ();
|
|
||||||
|
|
||||||
g_free (freeme);
|
g_free (freeme);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,6 +585,12 @@ gsettings_help (gboolean requested,
|
|||||||
synopsis = N_("SCHEMA[:PATH] KEY");
|
synopsis = N_("SCHEMA[:PATH] KEY");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (strcmp (command, "reset-recursively") == 0)
|
||||||
|
{
|
||||||
|
description = _("Reset all keys in SCHEMA to their defaults");
|
||||||
|
synopsis = N_("SCHEMA[:PATH]");
|
||||||
|
}
|
||||||
|
|
||||||
else if (strcmp (command, "writable") == 0)
|
else if (strcmp (command, "writable") == 0)
|
||||||
{
|
{
|
||||||
description = _("Check if KEY is writable");
|
description = _("Check if KEY is writable");
|
||||||
@@ -566,6 +628,7 @@ gsettings_help (gboolean requested,
|
|||||||
" get Get the value of a key\n"
|
" get Get the value of a key\n"
|
||||||
" set Set the value of a key\n"
|
" set Set the value of a key\n"
|
||||||
" reset Reset the value of a key\n"
|
" reset Reset the value of a key\n"
|
||||||
|
" reset-recursively Reset all values in a given schema\n"
|
||||||
" writable Check if a key is writable\n"
|
" writable Check if a key is writable\n"
|
||||||
" monitor Watch for changes\n"
|
" monitor Watch for changes\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -671,6 +734,9 @@ main (int argc, char **argv)
|
|||||||
else if (argc == 4 && strcmp (argv[1], "reset") == 0)
|
else if (argc == 4 && strcmp (argv[1], "reset") == 0)
|
||||||
function = gsettings_reset;
|
function = gsettings_reset;
|
||||||
|
|
||||||
|
else if (argc == 3 && strcmp (argv[1], "reset-recursively") == 0)
|
||||||
|
function = gsettings_reset_recursively;
|
||||||
|
|
||||||
else if (argc == 4 && strcmp (argv[1], "writable") == 0)
|
else if (argc == 4 && strcmp (argv[1], "writable") == 0)
|
||||||
function = gsettings_writable;
|
function = gsettings_writable;
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@
|
|||||||
* even need to be started in this case. For this reason, you should
|
* even need to be started in this case. For this reason, you should
|
||||||
* only ever modify #GSettings keys in response to explicit user action.
|
* only ever modify #GSettings keys in response to explicit user action.
|
||||||
* Particular care should be paid to ensure that modifications are not
|
* Particular care should be paid to ensure that modifications are not
|
||||||
* made during startup -- for example, when settings the initial value
|
* made during startup -- for example, when setting the initial value
|
||||||
* of preferences widgets. The built-in g_settings_bind() functionality
|
* of preferences widgets. The built-in g_settings_bind() functionality
|
||||||
* is careful not to write settings in response to notify signals as a
|
* is careful not to write settings in response to notify signals as a
|
||||||
* result of modifications that it makes to widgets.
|
* result of modifications that it makes to widgets.
|
||||||
@@ -810,8 +810,8 @@ g_settings_new_with_path (const gchar *schema,
|
|||||||
*
|
*
|
||||||
* Creates a new #GSettings object with a given schema and backend.
|
* Creates a new #GSettings object with a given schema and backend.
|
||||||
*
|
*
|
||||||
* Creating settings objects with an different backend allows accessing settings
|
* Creating a #GSettings object with a different backend allows accessing
|
||||||
* from a database other than the usual one. For example, it may make
|
* settings from a database other than the usual one. For example, it may make
|
||||||
* sense to pass a backend corresponding to the "defaults" settings database on
|
* sense to pass a backend corresponding to the "defaults" settings database on
|
||||||
* the system to get a settings object that modifies the system default
|
* the system to get a settings object that modifies the system default
|
||||||
* settings instead of the settings for this user.
|
* settings instead of the settings for this user.
|
||||||
|
@@ -45,6 +45,13 @@ struct _GSettingsBackendPrivate
|
|||||||
GStaticMutex lock;
|
GStaticMutex lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* For g_settings_backend_sync_default(), we only want to actually do
|
||||||
|
* the sync if the backend already exists. This avoids us creating an
|
||||||
|
* entire GSettingsBackend in order to call a do-nothing sync()
|
||||||
|
* operation on it. This variable lets us avoid that.
|
||||||
|
*/
|
||||||
|
static gboolean g_settings_has_backend;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gsettingsbackend
|
* SECTION:gsettingsbackend
|
||||||
* @title: GSettingsBackend
|
* @title: GSettingsBackend
|
||||||
@@ -982,6 +989,7 @@ g_settings_backend_get_default (void)
|
|||||||
|
|
||||||
extension_type = g_io_extension_get_type (extension);
|
extension_type = g_io_extension_get_type (extension);
|
||||||
instance = g_object_new (extension_type, NULL);
|
instance = g_object_new (extension_type, NULL);
|
||||||
|
g_settings_has_backend = TRUE;
|
||||||
|
|
||||||
g_once_init_leave (&backend, (gsize) instance);
|
g_once_init_leave (&backend, (gsize) instance);
|
||||||
}
|
}
|
||||||
@@ -1020,6 +1028,8 @@ g_settings_backend_get_permission (GSettingsBackend *backend,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
g_settings_backend_sync_default (void)
|
g_settings_backend_sync_default (void)
|
||||||
|
{
|
||||||
|
if (g_settings_has_backend)
|
||||||
{
|
{
|
||||||
GSettingsBackendClass *class;
|
GSettingsBackendClass *class;
|
||||||
GSettingsBackend *backend;
|
GSettingsBackend *backend;
|
||||||
@@ -1030,3 +1040,4 @@ g_settings_backend_sync_default (void)
|
|||||||
if (class->sync)
|
if (class->sync)
|
||||||
class->sync (backend);
|
class->sync (backend);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@@ -323,7 +323,7 @@ g_simple_action_class_init (GSimpleActionClass *class)
|
|||||||
g_simple_action_signals[SIGNAL_ACTIVATE] =
|
g_simple_action_signals[SIGNAL_ACTIVATE] =
|
||||||
g_signal_new (I_("activate"),
|
g_signal_new (I_("activate"),
|
||||||
G_TYPE_SIMPLE_ACTION,
|
G_TYPE_SIMPLE_ACTION,
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
|
||||||
G_STRUCT_OFFSET (GSimpleActionClass, activate),
|
G_STRUCT_OFFSET (GSimpleActionClass, activate),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__VARIANT,
|
g_cclosure_marshal_VOID__VARIANT,
|
||||||
|
@@ -744,9 +744,13 @@ g_simple_async_result_complete (GSimpleAsyncResult *simple)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (simple->callback)
|
if (simple->callback)
|
||||||
|
{
|
||||||
|
g_main_context_push_thread_default (simple->context);
|
||||||
simple->callback (simple->source_object,
|
simple->callback (simple->source_object,
|
||||||
G_ASYNC_RESULT (simple),
|
G_ASYNC_RESULT (simple),
|
||||||
simple->user_data);
|
simple->user_data);
|
||||||
|
g_main_context_pop_thread_default (simple->context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@@ -1756,15 +1756,17 @@ g_socket_check_connect_result (GSocket *socket,
|
|||||||
* received, the additional data will be returned in future calls to
|
* received, the additional data will be returned in future calls to
|
||||||
* g_socket_receive().
|
* g_socket_receive().
|
||||||
*
|
*
|
||||||
* If the socket is in blocking mode the call will block until there is
|
* If the socket is in blocking mode the call will block until there
|
||||||
* some data to receive or there is an error. If there is no data available
|
* is some data to receive, the connection is closed, or there is an
|
||||||
* and the socket is in non-blocking mode, a %G_IO_ERROR_WOULD_BLOCK error
|
* error. If there is no data available and the socket is in
|
||||||
* will be returned. To be notified when data is available, wait for the
|
* non-blocking mode, a %G_IO_ERROR_WOULD_BLOCK error will be
|
||||||
|
* returned. To be notified when data is available, wait for the
|
||||||
* %G_IO_IN condition.
|
* %G_IO_IN condition.
|
||||||
*
|
*
|
||||||
* On error -1 is returned and @error is set accordingly.
|
* On error -1 is returned and @error is set accordingly.
|
||||||
*
|
*
|
||||||
* Returns: Number of bytes read, or -1 on error
|
* Returns: Number of bytes read, or 0 if the connection was closed by
|
||||||
|
* the peer, or -1 on error
|
||||||
*
|
*
|
||||||
* Since: 2.22
|
* Since: 2.22
|
||||||
*/
|
*/
|
||||||
@@ -1794,7 +1796,8 @@ g_socket_receive (GSocket *socket,
|
|||||||
* the choice of blocking or non-blocking behavior is determined by
|
* the choice of blocking or non-blocking behavior is determined by
|
||||||
* the @blocking argument rather than by @socket's properties.
|
* the @blocking argument rather than by @socket's properties.
|
||||||
*
|
*
|
||||||
* Returns: Number of bytes read, or -1 on error
|
* Returns: Number of bytes read, or 0 if the connection was closed by
|
||||||
|
* the peer, or -1 on error
|
||||||
*
|
*
|
||||||
* Since: 2.26
|
* Since: 2.26
|
||||||
*/
|
*/
|
||||||
@@ -1876,7 +1879,8 @@ g_socket_receive_with_blocking (GSocket *socket,
|
|||||||
*
|
*
|
||||||
* See g_socket_receive() for additional information.
|
* See g_socket_receive() for additional information.
|
||||||
*
|
*
|
||||||
* Returns: Number of bytes read, or -1 on error
|
* Returns: Number of bytes read, or 0 if the connection was closed by
|
||||||
|
* the peer, or -1 on error
|
||||||
*
|
*
|
||||||
* Since: 2.22
|
* Since: 2.22
|
||||||
*/
|
*/
|
||||||
@@ -3182,14 +3186,16 @@ g_socket_send_message (GSocket *socket,
|
|||||||
* sufficiently-large buffer.
|
* sufficiently-large buffer.
|
||||||
*
|
*
|
||||||
* If the socket is in blocking mode the call will block until there
|
* If the socket is in blocking mode the call will block until there
|
||||||
* is some data to receive or there is an error. If there is no data
|
* is some data to receive, the connection is closed, or there is an
|
||||||
* available and the socket is in non-blocking mode, a
|
* error. If there is no data available and the socket is in
|
||||||
* %G_IO_ERROR_WOULD_BLOCK error will be returned. To be notified when
|
* non-blocking mode, a %G_IO_ERROR_WOULD_BLOCK error will be
|
||||||
* data is available, wait for the %G_IO_IN condition.
|
* returned. To be notified when data is available, wait for the
|
||||||
|
* %G_IO_IN condition.
|
||||||
*
|
*
|
||||||
* On error -1 is returned and @error is set accordingly.
|
* On error -1 is returned and @error is set accordingly.
|
||||||
*
|
*
|
||||||
* Returns: Number of bytes read, or -1 on error
|
* Returns: Number of bytes read, or 0 if the connection was closed by
|
||||||
|
* the peer, or -1 on error
|
||||||
*
|
*
|
||||||
* Since: 2.22
|
* Since: 2.22
|
||||||
*/
|
*/
|
||||||
|
@@ -58,7 +58,7 @@
|
|||||||
* #GSocketClient is a high-level utility class for connecting to a
|
* #GSocketClient is a high-level utility class for connecting to a
|
||||||
* network host using a connection oriented socket type.
|
* network host using a connection oriented socket type.
|
||||||
*
|
*
|
||||||
* You create a #GSocketClient object, set any options you want, then
|
* You create a #GSocketClient object, set any options you want, and then
|
||||||
* call a sync or async connect operation, which returns a #GSocketConnection
|
* call a sync or async connect operation, which returns a #GSocketConnection
|
||||||
* subclass on success.
|
* subclass on success.
|
||||||
*
|
*
|
||||||
@@ -442,7 +442,7 @@ g_socket_client_get_local_address (GSocketClient *client)
|
|||||||
* The sockets created by this object will bound to the
|
* The sockets created by this object will bound to the
|
||||||
* specified address (if not %NULL) before connecting.
|
* specified address (if not %NULL) before connecting.
|
||||||
*
|
*
|
||||||
* This is useful if you want to ensure the the local
|
* This is useful if you want to ensure that the local
|
||||||
* side of the connection is on a specific port, or on
|
* side of the connection is on a specific port, or on
|
||||||
* a specific interface.
|
* a specific interface.
|
||||||
*
|
*
|
||||||
@@ -726,7 +726,7 @@ g_socket_client_class_init (GSocketClientClass *class)
|
|||||||
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
|
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
|
||||||
* @error: #GError for error reporting, or %NULL to ignore.
|
* @error: #GError for error reporting, or %NULL to ignore.
|
||||||
*
|
*
|
||||||
* Tries to resolve the @connectable and make a network connection to it..
|
* Tries to resolve the @connectable and make a network connection to it.
|
||||||
*
|
*
|
||||||
* Upon a successful connection, a new #GSocketConnection is constructed
|
* Upon a successful connection, a new #GSocketConnection is constructed
|
||||||
* and returned. The caller owns this new object and must drop their
|
* and returned. The caller owns this new object and must drop their
|
||||||
@@ -736,7 +736,7 @@ g_socket_client_class_init (GSocketClientClass *class)
|
|||||||
* the underlying socket that is used. For instance, for a TCP/IP connection
|
* the underlying socket that is used. For instance, for a TCP/IP connection
|
||||||
* it will be a #GTcpConnection.
|
* it will be a #GTcpConnection.
|
||||||
*
|
*
|
||||||
* The socket created will be the same family as the the address that the
|
* The socket created will be the same family as the address that the
|
||||||
* @connectable resolves to, unless family is set with g_socket_client_set_family()
|
* @connectable resolves to, unless family is set with g_socket_client_set_family()
|
||||||
* or indirectly via g_socket_client_set_local_address(). The socket type
|
* or indirectly via g_socket_client_set_local_address(). The socket type
|
||||||
* defaults to %G_SOCKET_TYPE_STREAM but can be set with
|
* defaults to %G_SOCKET_TYPE_STREAM but can be set with
|
||||||
@@ -912,7 +912,7 @@ g_socket_client_connect (GSocketClient *client,
|
|||||||
*
|
*
|
||||||
* Attempts to create a TCP connection to the named host.
|
* Attempts to create a TCP connection to the named host.
|
||||||
*
|
*
|
||||||
* @host_and_port may be in any of a number of recognised formats; an IPv6
|
* @host_and_port may be in any of a number of recognized formats; an IPv6
|
||||||
* address, an IPv4 address, or a domain name (in which case a DNS
|
* address, an IPv4 address, or a domain name (in which case a DNS
|
||||||
* lookup is performed). Quoting with [] is supported for all address
|
* lookup is performed). Quoting with [] is supported for all address
|
||||||
* types. A port override may be specified in the usual way with a
|
* types. A port override may be specified in the usual way with a
|
||||||
@@ -923,7 +923,7 @@ g_socket_client_connect (GSocketClient *client,
|
|||||||
* used as the port number to connect to.
|
* used as the port number to connect to.
|
||||||
*
|
*
|
||||||
* In general, @host_and_port is expected to be provided by the user (allowing
|
* In general, @host_and_port is expected to be provided by the user (allowing
|
||||||
* them to give the hostname, and a port overide if necessary) and
|
* them to give the hostname, and a port override if necessary) and
|
||||||
* @default_port is expected to be provided by the application.
|
* @default_port is expected to be provided by the application.
|
||||||
*
|
*
|
||||||
* In the case that an IP address is given, a single connection
|
* In the case that an IP address is given, a single connection
|
||||||
@@ -1591,7 +1591,7 @@ g_socket_client_connect_to_uri_async (GSocketClient *client,
|
|||||||
* g_socket_client_connect_finish:
|
* g_socket_client_connect_finish:
|
||||||
* @client: a #GSocketClient.
|
* @client: a #GSocketClient.
|
||||||
* @result: a #GAsyncResult.
|
* @result: a #GAsyncResult.
|
||||||
* @error: a #GError location to store the error occuring, or %NULL to
|
* @error: a #GError location to store the error occurring, or %NULL to
|
||||||
* ignore.
|
* ignore.
|
||||||
*
|
*
|
||||||
* Finishes an async connect operation. See g_socket_client_connect_async()
|
* Finishes an async connect operation. See g_socket_client_connect_async()
|
||||||
@@ -1617,7 +1617,7 @@ g_socket_client_connect_finish (GSocketClient *client,
|
|||||||
* g_socket_client_connect_to_host_finish:
|
* g_socket_client_connect_to_host_finish:
|
||||||
* @client: a #GSocketClient.
|
* @client: a #GSocketClient.
|
||||||
* @result: a #GAsyncResult.
|
* @result: a #GAsyncResult.
|
||||||
* @error: a #GError location to store the error occuring, or %NULL to
|
* @error: a #GError location to store the error occurring, or %NULL to
|
||||||
* ignore.
|
* ignore.
|
||||||
*
|
*
|
||||||
* Finishes an async connect operation. See g_socket_client_connect_to_host_async()
|
* Finishes an async connect operation. See g_socket_client_connect_to_host_async()
|
||||||
@@ -1638,7 +1638,7 @@ g_socket_client_connect_to_host_finish (GSocketClient *client,
|
|||||||
* g_socket_client_connect_to_service_finish:
|
* g_socket_client_connect_to_service_finish:
|
||||||
* @client: a #GSocketClient.
|
* @client: a #GSocketClient.
|
||||||
* @result: a #GAsyncResult.
|
* @result: a #GAsyncResult.
|
||||||
* @error: a #GError location to store the error occuring, or %NULL to
|
* @error: a #GError location to store the error occurring, or %NULL to
|
||||||
* ignore.
|
* ignore.
|
||||||
*
|
*
|
||||||
* Finishes an async connect operation. See g_socket_client_connect_to_service_async()
|
* Finishes an async connect operation. See g_socket_client_connect_to_service_async()
|
||||||
@@ -1659,7 +1659,7 @@ g_socket_client_connect_to_service_finish (GSocketClient *client,
|
|||||||
* g_socket_client_connect_to_uri_finish:
|
* g_socket_client_connect_to_uri_finish:
|
||||||
* @client: a #GSocketClient.
|
* @client: a #GSocketClient.
|
||||||
* @result: a #GAsyncResult.
|
* @result: a #GAsyncResult.
|
||||||
* @error: a #GError location to store the error occuring, or %NULL to
|
* @error: a #GError location to store the error occurring, or %NULL to
|
||||||
* ignore.
|
* ignore.
|
||||||
*
|
*
|
||||||
* Finishes an async connect operation. See g_socket_client_connect_to_uri_async()
|
* Finishes an async connect operation. See g_socket_client_connect_to_uri_async()
|
||||||
@@ -1684,7 +1684,7 @@ g_socket_client_connect_to_uri_finish (GSocketClient *client,
|
|||||||
* Enable proxy protocols to be handled by the application. When the
|
* Enable proxy protocols to be handled by the application. When the
|
||||||
* indicated proxy protocol is returned by the #GProxyResolver,
|
* indicated proxy protocol is returned by the #GProxyResolver,
|
||||||
* #GSocketClient will consider this protocol as supported but will
|
* #GSocketClient will consider this protocol as supported but will
|
||||||
* not try find a #GProxy instance to handle handshaking. The
|
* not try to find a #GProxy instance to handle handshaking. The
|
||||||
* application must check for this case by calling
|
* application must check for this case by calling
|
||||||
* g_socket_connection_get_remote_address() on the returned
|
* g_socket_connection_get_remote_address() on the returned
|
||||||
* #GSocketConnection, and seeing if it's a #GProxyAddress of the
|
* #GSocketConnection, and seeing if it's a #GProxyAddress of the
|
||||||
|
@@ -52,7 +52,7 @@
|
|||||||
* depends on the type of the underlying socket that is in use. For
|
* depends on the type of the underlying socket that is in use. For
|
||||||
* instance, for a TCP/IP connection it will be a #GTcpConnection.
|
* instance, for a TCP/IP connection it will be a #GTcpConnection.
|
||||||
*
|
*
|
||||||
* Chosing what type of object to construct is done with the socket
|
* Choosing what type of object to construct is done with the socket
|
||||||
* connection factory, and it is possible for 3rd parties to register
|
* connection factory, and it is possible for 3rd parties to register
|
||||||
* custom socket connection types for specific combination of socket
|
* custom socket connection types for specific combination of socket
|
||||||
* family/type/protocol using g_socket_connection_factory_register_type().
|
* family/type/protocol using g_socket_connection_factory_register_type().
|
||||||
|
@@ -263,7 +263,7 @@ g_socket_listener_add_socket (GSocketListener *listener,
|
|||||||
*
|
*
|
||||||
* Note that adding an IPv6 address, depending on the platform,
|
* Note that adding an IPv6 address, depending on the platform,
|
||||||
* may or may not result in a listener that also accepts IPv4
|
* may or may not result in a listener that also accepts IPv4
|
||||||
* connections. For more determinstic behaviour, see
|
* connections. For more deterministic behavior, see
|
||||||
* g_socket_listener_add_inet_port().
|
* g_socket_listener_add_inet_port().
|
||||||
*
|
*
|
||||||
* @source_object will be passed out in the various calls
|
* @source_object will be passed out in the various calls
|
||||||
@@ -272,7 +272,7 @@ g_socket_listener_add_socket (GSocketListener *listener,
|
|||||||
* different things depending on what address is connected to.
|
* different things depending on what address is connected to.
|
||||||
*
|
*
|
||||||
* If successful and @effective_address is non-%NULL then it will
|
* If successful and @effective_address is non-%NULL then it will
|
||||||
* be set to the address that the binding actually occured at. This
|
* be set to the address that the binding actually occurred at. This
|
||||||
* is helpful for determining the port number that was used for when
|
* is helpful for determining the port number that was used for when
|
||||||
* requesting a binding to port 0 (ie: "any port"). This address, if
|
* requesting a binding to port 0 (ie: "any port"). This address, if
|
||||||
* requested, belongs to the caller and must be freed.
|
* requested, belongs to the caller and must be freed.
|
||||||
@@ -770,7 +770,7 @@ g_socket_listener_accept_socket_async (GSocketListener *listener,
|
|||||||
* @listener: a #GSocketListener
|
* @listener: a #GSocketListener
|
||||||
* @result: a #GAsyncResult.
|
* @result: a #GAsyncResult.
|
||||||
* @source_object: (out) (transfer none) (allow-none): Optional #GObject identifying this source
|
* @source_object: (out) (transfer none) (allow-none): Optional #GObject identifying this source
|
||||||
* @error: a #GError location to store the error occuring, or %NULL to
|
* @error: a #GError location to store the error occurring, or %NULL to
|
||||||
* ignore.
|
* ignore.
|
||||||
*
|
*
|
||||||
* Finishes an async accept operation. See g_socket_listener_accept_socket_async()
|
* Finishes an async accept operation. See g_socket_listener_accept_socket_async()
|
||||||
@@ -837,7 +837,7 @@ g_socket_listener_accept_async (GSocketListener *listener,
|
|||||||
* @listener: a #GSocketListener
|
* @listener: a #GSocketListener
|
||||||
* @result: a #GAsyncResult.
|
* @result: a #GAsyncResult.
|
||||||
* @source_object: (out) (transfer none) (allow-none): Optional #GObject identifying this source
|
* @source_object: (out) (transfer none) (allow-none): Optional #GObject identifying this source
|
||||||
* @error: a #GError location to store the error occuring, or %NULL to
|
* @error: a #GError location to store the error occurring, or %NULL to
|
||||||
* ignore.
|
* ignore.
|
||||||
*
|
*
|
||||||
* Finishes an async accept operation. See g_socket_listener_accept_async()
|
* Finishes an async accept operation. See g_socket_listener_accept_async()
|
||||||
@@ -928,11 +928,11 @@ g_socket_listener_close (GSocketListener *listener)
|
|||||||
* g_socket_listener_add_any_inet_port:
|
* g_socket_listener_add_any_inet_port:
|
||||||
* @listener: a #GSocketListener
|
* @listener: a #GSocketListener
|
||||||
* @source_object: (allow-none): Optional #GObject identifying this source
|
* @source_object: (allow-none): Optional #GObject identifying this source
|
||||||
* @error: a #GError location to store the error occuring, or %NULL to
|
* @error: a #GError location to store the error occurring, or %NULL to
|
||||||
* ignore.
|
* ignore.
|
||||||
*
|
*
|
||||||
* Listens for TCP connections on any available port number for both
|
* Listens for TCP connections on any available port number for both
|
||||||
* IPv6 and IPv4 (if each are available).
|
* IPv6 and IPv4 (if each is available).
|
||||||
*
|
*
|
||||||
* This is useful if you need to have a socket for incoming connections
|
* This is useful if you need to have a socket for incoming connections
|
||||||
* but don't care about the specific port number.
|
* but don't care about the specific port number.
|
||||||
|
@@ -34,8 +34,8 @@
|
|||||||
* signal is emitted.
|
* signal is emitted.
|
||||||
*
|
*
|
||||||
* A #GSocketService is a subclass of #GSocketListener and you need
|
* A #GSocketService is a subclass of #GSocketListener and you need
|
||||||
* to add the addresses you want to accept connections on to the
|
* to add the addresses you want to accept connections on with the
|
||||||
* with the #GSocketListener APIs.
|
* #GSocketListener APIs.
|
||||||
*
|
*
|
||||||
* There are two options for implementing a network service based on
|
* There are two options for implementing a network service based on
|
||||||
* #GSocketService. The first is to create the service using
|
* #GSocketService. The first is to create the service using
|
||||||
@@ -260,6 +260,9 @@ g_socket_service_class_init (GSocketServiceClass *class)
|
|||||||
* handling of @connection, but may not block; in essence,
|
* handling of @connection, but may not block; in essence,
|
||||||
* asynchronous operations must be used.
|
* asynchronous operations must be used.
|
||||||
*
|
*
|
||||||
|
* @connection will be unreffed once the signal handler returns, so
|
||||||
|
* you need to ref it yourself if you are planning to use it.
|
||||||
|
*
|
||||||
* Returns: %TRUE to stop other handlers from being called
|
* Returns: %TRUE to stop other handlers from being called
|
||||||
*
|
*
|
||||||
* Since: 2.22
|
* Since: 2.22
|
||||||
|
@@ -326,7 +326,7 @@ g_tcp_connection_close_async (GIOStream *stream,
|
|||||||
* @graceful_disconnect: Whether to do graceful disconnects or not
|
* @graceful_disconnect: Whether to do graceful disconnects or not
|
||||||
*
|
*
|
||||||
* This enabled graceful disconnects on close. A graceful disconnect
|
* This enabled graceful disconnects on close. A graceful disconnect
|
||||||
* means that we signal the recieving end that the connection is terminated
|
* means that we signal the receiving end that the connection is terminated
|
||||||
* and wait for it to close the connection before closing the connection.
|
* and wait for it to close the connection before closing the connection.
|
||||||
*
|
*
|
||||||
* A graceful disconnect means that we can be sure that we successfully sent
|
* A graceful disconnect means that we can be sure that we successfully sent
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
* until the connection is closed.
|
* until the connection is closed.
|
||||||
*
|
*
|
||||||
* The service is implemented using a thread pool, so there is a
|
* The service is implemented using a thread pool, so there is a
|
||||||
* limited amount of threads availible to serve incomming requests.
|
* limited amount of threads available to serve incoming requests.
|
||||||
* The service automatically stops the #GSocketService from accepting
|
* The service automatically stops the #GSocketService from accepting
|
||||||
* new connections when all threads are busy.
|
* new connections when all threads are busy.
|
||||||
*
|
*
|
||||||
@@ -234,7 +234,7 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
|
|||||||
* @connection and may perform blocking IO. The signal handler need
|
* @connection and may perform blocking IO. The signal handler need
|
||||||
* not return until the connection is closed.
|
* not return until the connection is closed.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE to stope further signal handlers from being called
|
* Returns: %TRUE to stop further signal handlers from being called
|
||||||
*/
|
*/
|
||||||
g_threaded_socket_service_run_signal =
|
g_threaded_socket_service_run_signal =
|
||||||
g_signal_new ("run", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
|
g_signal_new ("run", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
|
||||||
|
@@ -66,8 +66,8 @@ G_DEFINE_TYPE_WITH_CODE (GUnixConnection, g_unix_connection,
|
|||||||
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
|
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
|
||||||
* @error: (allow-none): #GError for error reporting, or %NULL to ignore.
|
* @error: (allow-none): #GError for error reporting, or %NULL to ignore.
|
||||||
*
|
*
|
||||||
* Passes a file descriptor to the recieving side of the
|
* Passes a file descriptor to the receiving side of the
|
||||||
* connection. The recieving end has to call g_unix_connection_receive_fd()
|
* connection. The receiving end has to call g_unix_connection_receive_fd()
|
||||||
* to accept the file descriptor.
|
* to accept the file descriptor.
|
||||||
*
|
*
|
||||||
* As well as sending the fd this also writes a single byte to the
|
* As well as sending the fd this also writes a single byte to the
|
||||||
@@ -308,7 +308,7 @@ gboolean g_unix_connection_create_pair (GUnixCo
|
|||||||
* @error: Return location for error or %NULL.
|
* @error: Return location for error or %NULL.
|
||||||
*
|
*
|
||||||
* Passes the credentials of the current user the receiving side
|
* Passes the credentials of the current user the receiving side
|
||||||
* of the connection. The recieving end has to call
|
* of the connection. The receiving end has to call
|
||||||
* g_unix_connection_receive_credentials() (or similar) to accept the
|
* g_unix_connection_receive_credentials() (or similar) to accept the
|
||||||
* credentials.
|
* credentials.
|
||||||
*
|
*
|
||||||
|
@@ -24,7 +24,9 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#if !defined(G_OS_WIN32) || !defined(_MSC_VER)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -30,16 +30,20 @@ test_local_cmdline (GApplication *application,
|
|||||||
|
|
||||||
argv = *arguments;
|
argv = *arguments;
|
||||||
|
|
||||||
for (i = 0; argv[i]; i++)
|
i = 1;
|
||||||
|
while (argv[i])
|
||||||
{
|
{
|
||||||
if (g_str_has_prefix (argv[i], "--local-"))
|
if (g_str_has_prefix (argv[i], "--local-"))
|
||||||
{
|
{
|
||||||
g_print ("handling argument %s locally\n", argv[i]);
|
g_print ("handling argument %s locally\n", argv[i]);
|
||||||
for (j = i + 1; argv[j]; j++)
|
g_free (argv[i]);
|
||||||
{
|
for (j = i; argv[j]; j++)
|
||||||
argv[j - 1] = argv[j];
|
argv[j] = argv[j + 1];
|
||||||
argv[j] = NULL;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_print ("not handling argument %s locally\n", argv[i]);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -221,6 +221,79 @@ basic (void)
|
|||||||
session_bus_down ();
|
session_bus_down ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static GApplication *recently_activated;
|
||||||
|
static GMainLoop *loop;
|
||||||
|
|
||||||
|
static void
|
||||||
|
nonunique_activate (GApplication *application)
|
||||||
|
{
|
||||||
|
recently_activated = application;
|
||||||
|
|
||||||
|
if (loop != NULL)
|
||||||
|
g_main_loop_quit (loop);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GApplication *
|
||||||
|
make_app (gboolean non_unique)
|
||||||
|
{
|
||||||
|
GApplication *app;
|
||||||
|
gboolean ok;
|
||||||
|
|
||||||
|
app = g_application_new ("org.gtk.TestApplication",
|
||||||
|
non_unique ? G_APPLICATION_NON_UNIQUE : 0);
|
||||||
|
g_signal_connect (app, "activate", G_CALLBACK (nonunique_activate), NULL);
|
||||||
|
ok = g_application_register (app, NULL, NULL);
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
g_object_unref (app);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_application_activate (app);
|
||||||
|
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_nonunique (void)
|
||||||
|
{
|
||||||
|
GApplication *first, *second, *third, *fourth;
|
||||||
|
|
||||||
|
session_bus_up ();
|
||||||
|
|
||||||
|
first = make_app (TRUE);
|
||||||
|
/* non-remote because it is non-unique */
|
||||||
|
g_assert (!g_application_get_is_remote (first));
|
||||||
|
g_assert (recently_activated == first);
|
||||||
|
recently_activated = NULL;
|
||||||
|
|
||||||
|
second = make_app (FALSE);
|
||||||
|
/* non-remote because it is first */
|
||||||
|
g_assert (!g_application_get_is_remote (second));
|
||||||
|
g_assert (recently_activated == second);
|
||||||
|
recently_activated = NULL;
|
||||||
|
|
||||||
|
third = make_app (TRUE);
|
||||||
|
/* non-remote because it is non-unique */
|
||||||
|
g_assert (!g_application_get_is_remote (third));
|
||||||
|
g_assert (recently_activated == third);
|
||||||
|
recently_activated = NULL;
|
||||||
|
|
||||||
|
fourth = make_app (FALSE);
|
||||||
|
/* should have failed to register due to being
|
||||||
|
* unable to register the object paths
|
||||||
|
*/
|
||||||
|
g_assert (fourth == NULL);
|
||||||
|
g_assert (recently_activated == NULL);
|
||||||
|
|
||||||
|
g_object_unref (first);
|
||||||
|
g_object_unref (second);
|
||||||
|
g_object_unref (third);
|
||||||
|
|
||||||
|
session_bus_down ();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
properties (void)
|
properties (void)
|
||||||
{
|
{
|
||||||
@@ -289,6 +362,7 @@ main (int argc, char **argv)
|
|||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
g_test_add_func ("/gapplication/basic", basic);
|
g_test_add_func ("/gapplication/basic", basic);
|
||||||
|
g_test_add_func ("/gapplication/non-unique", test_nonunique);
|
||||||
g_test_add_func ("/gapplication/properties", properties);
|
g_test_add_func ("/gapplication/properties", properties);
|
||||||
g_test_add_func ("/gapplication/app-id", appid);
|
g_test_add_func ("/gapplication/app-id", appid);
|
||||||
|
|
||||||
|
@@ -1083,7 +1083,6 @@ delayed_message_processing (void)
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef BUG_631379_FIXED
|
|
||||||
static gboolean
|
static gboolean
|
||||||
nonce_tcp_on_authorize_authenticated_peer (GDBusAuthObserver *observer,
|
nonce_tcp_on_authorize_authenticated_peer (GDBusAuthObserver *observer,
|
||||||
GIOStream *stream,
|
GIOStream *stream,
|
||||||
@@ -1285,7 +1284,6 @@ test_nonce_tcp (void)
|
|||||||
g_main_loop_quit (service_loop);
|
g_main_loop_quit (service_loop);
|
||||||
g_thread_join (service_thread);
|
g_thread_join (service_thread);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_credentials (void)
|
test_credentials (void)
|
||||||
@@ -1438,6 +1436,95 @@ test_overflow (void)
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
tcp_anonymous_on_new_connection (GDBusServer *server,
|
||||||
|
GDBusConnection *connection,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
gboolean *seen_connection = user_data;
|
||||||
|
*seen_connection = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gpointer
|
||||||
|
tcp_anonymous_service_thread_func (gpointer user_data)
|
||||||
|
{
|
||||||
|
gboolean *seen_connection = user_data;
|
||||||
|
GMainContext *service_context;
|
||||||
|
GError *error;
|
||||||
|
|
||||||
|
service_context = g_main_context_new ();
|
||||||
|
g_main_context_push_thread_default (service_context);
|
||||||
|
|
||||||
|
error = NULL;
|
||||||
|
server = g_dbus_server_new_sync ("tcp:",
|
||||||
|
G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS,
|
||||||
|
test_guid,
|
||||||
|
NULL, /* GDBusObserver* */
|
||||||
|
NULL, /* GCancellable* */
|
||||||
|
&error);
|
||||||
|
g_assert_no_error (error);
|
||||||
|
|
||||||
|
g_signal_connect (server,
|
||||||
|
"new-connection",
|
||||||
|
G_CALLBACK (tcp_anonymous_on_new_connection),
|
||||||
|
seen_connection);
|
||||||
|
|
||||||
|
g_dbus_server_start (server);
|
||||||
|
|
||||||
|
service_loop = g_main_loop_new (service_context, FALSE);
|
||||||
|
g_main_loop_run (service_loop);
|
||||||
|
|
||||||
|
g_main_context_pop_thread_default (service_context);
|
||||||
|
|
||||||
|
g_main_loop_unref (service_loop);
|
||||||
|
g_main_context_unref (service_context);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_tcp_anonymous (void)
|
||||||
|
{
|
||||||
|
gboolean seen_connection;
|
||||||
|
GThread *service_thread;
|
||||||
|
GDBusConnection *connection;
|
||||||
|
GError *error;
|
||||||
|
|
||||||
|
seen_connection = FALSE;
|
||||||
|
service_loop = NULL;
|
||||||
|
service_thread = g_thread_create (tcp_anonymous_service_thread_func,
|
||||||
|
&seen_connection, /* user_data */
|
||||||
|
TRUE, /* joinable */
|
||||||
|
&error);
|
||||||
|
while (service_loop == NULL)
|
||||||
|
g_thread_yield ();
|
||||||
|
g_assert (server != NULL);
|
||||||
|
|
||||||
|
error = NULL;
|
||||||
|
connection = g_dbus_connection_new_for_address_sync (g_dbus_server_get_client_address (server),
|
||||||
|
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
|
||||||
|
NULL, /* GDBusAuthObserver* */
|
||||||
|
NULL, /* GCancellable */
|
||||||
|
&error);
|
||||||
|
g_assert_no_error (error);
|
||||||
|
g_assert (connection != NULL);
|
||||||
|
|
||||||
|
while (!seen_connection)
|
||||||
|
g_thread_yield ();
|
||||||
|
|
||||||
|
g_object_unref (connection);
|
||||||
|
|
||||||
|
g_main_loop_quit (service_loop);
|
||||||
|
g_dbus_server_stop (server);
|
||||||
|
g_object_unref (server);
|
||||||
|
server = NULL;
|
||||||
|
|
||||||
|
g_thread_join (service_thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc,
|
main (int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
@@ -1460,9 +1547,8 @@ main (int argc,
|
|||||||
|
|
||||||
g_test_add_func ("/gdbus/peer-to-peer", test_peer);
|
g_test_add_func ("/gdbus/peer-to-peer", test_peer);
|
||||||
g_test_add_func ("/gdbus/delayed-message-processing", delayed_message_processing);
|
g_test_add_func ("/gdbus/delayed-message-processing", delayed_message_processing);
|
||||||
#ifdef BUG_631379_FIXED
|
|
||||||
g_test_add_func ("/gdbus/nonce-tcp", test_nonce_tcp);
|
g_test_add_func ("/gdbus/nonce-tcp", test_nonce_tcp);
|
||||||
#endif
|
g_test_add_func ("/gdbus/tcp-anonymous", test_tcp_anonymous);
|
||||||
g_test_add_func ("/gdbus/credentials", test_credentials);
|
g_test_add_func ("/gdbus/credentials", test_credentials);
|
||||||
g_test_add_func ("/gdbus/overflow", test_overflow);
|
g_test_add_func ("/gdbus/overflow", test_overflow);
|
||||||
|
|
||||||
|
@@ -735,16 +735,31 @@ message_serialize_complex (void)
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static void
|
||||||
|
replace (char *blob,
|
||||||
|
gsize len,
|
||||||
|
const char *before,
|
||||||
|
const char *after)
|
||||||
|
{
|
||||||
|
gsize i;
|
||||||
|
gsize slen = strlen (before) + 1;
|
||||||
|
|
||||||
|
g_assert_cmpuint (strlen (before), ==, strlen (after));
|
||||||
|
g_assert_cmpuint (len, >=, slen);
|
||||||
|
|
||||||
|
for (i = 0; i < (len - slen + 1); i++)
|
||||||
|
{
|
||||||
|
if (memcmp (blob + i, before, slen) == 0)
|
||||||
|
memcpy (blob + i, after, slen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
message_serialize_invalid (void)
|
message_serialize_invalid (void)
|
||||||
{
|
{
|
||||||
guint n;
|
guint n;
|
||||||
|
|
||||||
/* Here we're relying on libdbus-1's DBusMessage type not checking
|
/* Other things we could check (note that GDBus _does_ check for all
|
||||||
* anything. If that were to change, we'd need to do our own
|
|
||||||
* thing.
|
|
||||||
*
|
|
||||||
* Other things we could check (note that GDBus _does_ check for all
|
|
||||||
* these things - we just don't have test-suit coverage for it)
|
* these things - we just don't have test-suit coverage for it)
|
||||||
*
|
*
|
||||||
* - array exceeding 64 MiB (2^26 bytes) - unfortunately libdbus-1 checks
|
* - array exceeding 64 MiB (2^26 bytes) - unfortunately libdbus-1 checks
|
||||||
@@ -769,9 +784,13 @@ message_serialize_invalid (void)
|
|||||||
DBusMessage *dbus_message;
|
DBusMessage *dbus_message;
|
||||||
char *blob;
|
char *blob;
|
||||||
int blob_len;
|
int blob_len;
|
||||||
|
/* these are in pairs with matching length */
|
||||||
|
const gchar *valid_utf8_str = "this is valid...";
|
||||||
const gchar *invalid_utf8_str = "this is invalid\xff";
|
const gchar *invalid_utf8_str = "this is invalid\xff";
|
||||||
const gchar *invalid_object_path = "/this/is/not a valid object path";
|
const gchar *valid_signature = "a{sv}a{sv}a{sv}aiai";
|
||||||
const gchar *invalid_signature = "not valid signature";
|
const gchar *invalid_signature = "not valid signature";
|
||||||
|
const gchar *valid_object_path = "/this/is/a/valid/dbus/object/path";
|
||||||
|
const gchar *invalid_object_path = "/this/is/not a valid object path!";
|
||||||
|
|
||||||
dbus_message = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_CALL);
|
dbus_message = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_CALL);
|
||||||
dbus_message_set_serial (dbus_message, 0x41);
|
dbus_message_set_serial (dbus_message, 0x41);
|
||||||
@@ -782,21 +801,21 @@ message_serialize_invalid (void)
|
|||||||
case 0:
|
case 0:
|
||||||
/* invalid UTF-8 */
|
/* invalid UTF-8 */
|
||||||
dbus_message_append_args (dbus_message,
|
dbus_message_append_args (dbus_message,
|
||||||
DBUS_TYPE_STRING, &invalid_utf8_str,
|
DBUS_TYPE_STRING, &valid_utf8_str,
|
||||||
DBUS_TYPE_INVALID);
|
DBUS_TYPE_INVALID);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
/* invalid object path */
|
/* invalid object path */
|
||||||
dbus_message_append_args (dbus_message,
|
dbus_message_append_args (dbus_message,
|
||||||
DBUS_TYPE_OBJECT_PATH, &invalid_object_path,
|
DBUS_TYPE_OBJECT_PATH, &valid_object_path,
|
||||||
DBUS_TYPE_INVALID);
|
DBUS_TYPE_INVALID);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
/* invalid signature */
|
/* invalid signature */
|
||||||
dbus_message_append_args (dbus_message,
|
dbus_message_append_args (dbus_message,
|
||||||
DBUS_TYPE_SIGNATURE, &invalid_signature,
|
DBUS_TYPE_SIGNATURE, &valid_signature,
|
||||||
DBUS_TYPE_INVALID);
|
DBUS_TYPE_INVALID);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -805,6 +824,11 @@ message_serialize_invalid (void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dbus_message_marshal (dbus_message, &blob, &blob_len);
|
dbus_message_marshal (dbus_message, &blob, &blob_len);
|
||||||
|
/* hack up the message to be invalid by replacing each valid string
|
||||||
|
* with its invalid counterpart */
|
||||||
|
replace (blob, blob_len, valid_utf8_str, invalid_utf8_str);
|
||||||
|
replace (blob, blob_len, valid_object_path, invalid_object_path);
|
||||||
|
replace (blob, blob_len, valid_signature, invalid_signature);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
message = g_dbus_message_new_from_blob ((guchar *) blob,
|
message = g_dbus_message_new_from_blob ((guchar *) blob,
|
||||||
|
@@ -278,7 +278,7 @@ use_inet_address (gboolean synchronous)
|
|||||||
{
|
{
|
||||||
GSocketAddressEnumerator *enumerator;
|
GSocketAddressEnumerator *enumerator;
|
||||||
GSocketAddress *sockaddr;
|
GSocketAddress *sockaddr;
|
||||||
GInetAddress *addr;
|
GInetAddress *addr = NULL;
|
||||||
guint port = 0;
|
guint port = 0;
|
||||||
gchar **ip_and_port;
|
gchar **ip_and_port;
|
||||||
|
|
||||||
|
@@ -206,6 +206,9 @@ libglib_2_0_la_SOURCES = \
|
|||||||
gprintf.c \
|
gprintf.c \
|
||||||
gprintfint.h
|
gprintfint.h
|
||||||
|
|
||||||
|
if OS_UNIX
|
||||||
|
libglib_2_0_la_SOURCES += glib-unix.c
|
||||||
|
endif
|
||||||
|
|
||||||
EXTRA_libglib_2_0_la_SOURCES = \
|
EXTRA_libglib_2_0_la_SOURCES = \
|
||||||
giounix.c \
|
giounix.c \
|
||||||
@@ -219,6 +222,10 @@ glibinclude_HEADERS = \
|
|||||||
glib-object.h \
|
glib-object.h \
|
||||||
glib.h
|
glib.h
|
||||||
|
|
||||||
|
if OS_UNIX
|
||||||
|
glibinclude_HEADERS += glib-unix.h
|
||||||
|
endif
|
||||||
|
|
||||||
glibsubincludedir=$(includedir)/glib-2.0/glib
|
glibsubincludedir=$(includedir)/glib-2.0/glib
|
||||||
glibsubinclude_HEADERS = \
|
glibsubinclude_HEADERS = \
|
||||||
galloca.h \
|
galloca.h \
|
||||||
|
@@ -2385,10 +2385,9 @@ g_date_time_format (GDateTime *datetime,
|
|||||||
gint64 offset = g_date_time_get_utc_offset (datetime)
|
gint64 offset = g_date_time_get_utc_offset (datetime)
|
||||||
/ USEC_PER_SECOND;
|
/ USEC_PER_SECOND;
|
||||||
|
|
||||||
g_string_append_printf (outstr, "%c%02d%02d",
|
g_string_append_printf (outstr, "%+03d%02d",
|
||||||
offset >= 0 ? '+' : '-',
|
|
||||||
(int) offset / 3600,
|
(int) offset / 3600,
|
||||||
(int) offset / 60 % 60);
|
(int) abs(offset) / 60 % 60);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_string_append (outstr, "+0000");
|
g_string_append (outstr, "+0000");
|
||||||
|
12
glib/ghash.c
12
glib/ghash.c
@@ -479,22 +479,28 @@ g_hash_table_remove_all_nodes (GHashTable *hash_table,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (notify &&
|
||||||
|
(hash_table->key_destroy_func != NULL ||
|
||||||
|
hash_table->value_destroy_func != NULL))
|
||||||
|
{
|
||||||
for (i = 0; i < hash_table->size; i++)
|
for (i = 0; i < hash_table->size; i++)
|
||||||
{
|
{
|
||||||
GHashNode *node = &hash_table->nodes [i];
|
GHashNode *node = &hash_table->nodes [i];
|
||||||
|
|
||||||
if (node->key_hash > 1)
|
if (node->key_hash > 1)
|
||||||
{
|
{
|
||||||
if (notify && hash_table->key_destroy_func)
|
if (hash_table->key_destroy_func != NULL)
|
||||||
hash_table->key_destroy_func (node->key);
|
hash_table->key_destroy_func (node->key);
|
||||||
|
|
||||||
if (notify && hash_table->value_destroy_func)
|
if (hash_table->value_destroy_func != NULL)
|
||||||
hash_table->value_destroy_func (node->value);
|
hash_table->value_destroy_func (node->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* We need to set node->key_hash = 0 for all nodes - might as well be GC
|
/* We need to set node->key_hash = 0 for all nodes - might as well be GC
|
||||||
* friendly and clear everything */
|
* friendly and clear everything
|
||||||
|
*/
|
||||||
memset (hash_table->nodes, 0, hash_table->size * sizeof (GHashNode));
|
memset (hash_table->nodes, 0, hash_table->size * sizeof (GHashNode));
|
||||||
|
|
||||||
hash_table->nnodes = 0;
|
hash_table->nnodes = 0;
|
||||||
|
214
glib/glib-unix.c
Normal file
214
glib/glib-unix.c
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
/* GLIB - Library of useful routines for C programming
|
||||||
|
* Copyright (C) 2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* glib-unix.c: UNIX specific API wrappers and convenience functions
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* Authors: Colin Walters <walters@verbum.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "glib-unix.h"
|
||||||
|
#include "gmain-internal.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:gunix
|
||||||
|
* @title: UNIX-specific utilities and integration
|
||||||
|
* @short_description: pipes, signal handling
|
||||||
|
* @include: glib-unix.h
|
||||||
|
*
|
||||||
|
* Most of GLib is intended to be portable; in constrast, this set of
|
||||||
|
* functions is designed for programs which explicitly target UNIX, or
|
||||||
|
* are using it to build higher level abstractions which would be
|
||||||
|
* conditionally compiled if the platform matches G_OS_UNIX.
|
||||||
|
*
|
||||||
|
* To use these functions, you must explicitly include the
|
||||||
|
* "glib-unix.h" header.
|
||||||
|
*/
|
||||||
|
|
||||||
|
GQuark
|
||||||
|
g_unix_error_quark (void)
|
||||||
|
{
|
||||||
|
return g_quark_from_static_string ("g-unix-error-quark");
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
g_unix_set_error_from_errno (GError **error)
|
||||||
|
{
|
||||||
|
int saved_errno = errno;
|
||||||
|
g_set_error_literal (error,
|
||||||
|
G_UNIX_ERROR,
|
||||||
|
0,
|
||||||
|
g_strerror (errno));
|
||||||
|
errno = saved_errno;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
g_unix_set_error_from_errno_saved (GError **error,
|
||||||
|
int saved_errno)
|
||||||
|
{
|
||||||
|
g_set_error_literal (error,
|
||||||
|
G_UNIX_ERROR,
|
||||||
|
0,
|
||||||
|
g_strerror (saved_errno));
|
||||||
|
errno = saved_errno;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_unix_pipe_flags:
|
||||||
|
* @fds: Array of two integers
|
||||||
|
* @flags: Bitfield of file descriptor flags, see "man 2 fcntl"
|
||||||
|
* @error: a #GError
|
||||||
|
*
|
||||||
|
* Similar to the UNIX pipe() call, but on modern systems like Linux
|
||||||
|
* uses the pipe2() system call, which atomically creates a pipe with
|
||||||
|
* the configured flags. The only supported flag currently is
|
||||||
|
* %FD_CLOEXEC. If for example you want to configure %O_NONBLOCK, that
|
||||||
|
* must still be done separately with fcntl().
|
||||||
|
*
|
||||||
|
* <note>This function does *not* take %O_CLOEXEC, it takes %FD_CLOEXEC as if
|
||||||
|
* for fcntl(); these are different on Linux/glibc.</note>
|
||||||
|
*
|
||||||
|
* Returns: %TRUE on success, %FALSE if not (and errno will be set).
|
||||||
|
*
|
||||||
|
* Since: 2.30
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
g_unix_pipe_flags (int *fds,
|
||||||
|
int flags,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
int ecode;
|
||||||
|
|
||||||
|
/* We only support FD_CLOEXEC */
|
||||||
|
g_return_val_if_fail ((flags & (FD_CLOEXEC)) == flags, FALSE);
|
||||||
|
|
||||||
|
#ifdef HAVE_PIPE2
|
||||||
|
{
|
||||||
|
int pipe2_flags = 0;
|
||||||
|
if (flags & FD_CLOEXEC)
|
||||||
|
pipe2_flags |= O_CLOEXEC;
|
||||||
|
/* Atomic */
|
||||||
|
ecode = pipe2 (fds, pipe2_flags);
|
||||||
|
if (ecode == -1 && errno != ENOSYS)
|
||||||
|
return g_unix_set_error_from_errno (error);
|
||||||
|
/* Fall through on -ENOSYS, we must be running on an old kernel */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
ecode = pipe (fds);
|
||||||
|
if (ecode == -1)
|
||||||
|
return g_unix_set_error_from_errno (error);
|
||||||
|
ecode = fcntl (fds[0], flags);
|
||||||
|
if (ecode == -1)
|
||||||
|
{
|
||||||
|
int saved_errno = errno;
|
||||||
|
close (fds[0]);
|
||||||
|
return g_unix_set_error_from_errno_saved (error, saved_errno);
|
||||||
|
}
|
||||||
|
ecode = fcntl (fds[0], flags);
|
||||||
|
if (ecode == -1)
|
||||||
|
{
|
||||||
|
int saved_errno = errno;
|
||||||
|
close (fds[0]);
|
||||||
|
close (fds[1]);
|
||||||
|
return g_unix_set_error_from_errno_saved (error, saved_errno);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_unix_signal_source_new:
|
||||||
|
* @signum: A signal number
|
||||||
|
*
|
||||||
|
* Create a #GSource that will be dispatched upon delivery of the UNIX
|
||||||
|
* signal @signum. Currently only %SIGHUP, %SIGINT, and %SIGTERM can
|
||||||
|
* be monitored. Note that unlike the UNIX default, all sources which
|
||||||
|
* have created a watch will be dispatched, regardless of which
|
||||||
|
* underlying thread invoked g_unix_signal_create_watch().
|
||||||
|
*
|
||||||
|
* For example, an effective use of this function is to handle SIGTERM
|
||||||
|
* cleanly; flushing any outstanding files, and then calling
|
||||||
|
* g_main_loop_quit (). It is not safe to do any of this a regular
|
||||||
|
* UNIX signal handler; your handler may be invoked while malloc() or
|
||||||
|
* another library function is running, causing reentrancy if you
|
||||||
|
* attempt to use it from the handler. None of the GLib/GObject API
|
||||||
|
* is safe against this kind of reentrancy.
|
||||||
|
*
|
||||||
|
* The interaction of this source when combined with native UNIX
|
||||||
|
* functions like sigprocmask() is not defined.
|
||||||
|
*
|
||||||
|
* <note>For reliable behavior, if your program links to gthread
|
||||||
|
* (either directly or indirectly via GObject, GIO, or a higher level
|
||||||
|
* library), you should ensure g_thread_init() is called before using
|
||||||
|
* this function. For example, if your program uses GObject, call
|
||||||
|
* g_type_init().</note>
|
||||||
|
*
|
||||||
|
* The source will not initially be associated with any #GMainContext
|
||||||
|
* and must be added to one with g_source_attach() before it will be
|
||||||
|
* executed.
|
||||||
|
*
|
||||||
|
* Returns: A newly created #GSource
|
||||||
|
*/
|
||||||
|
GSource *
|
||||||
|
g_unix_signal_source_new (int signum)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (signum == SIGHUP || signum == SIGINT || signum == SIGTERM, NULL);
|
||||||
|
|
||||||
|
return _g_main_create_unix_signal_watch (signum);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_unix_signal_add_watch_full:
|
||||||
|
* @signum: Signal number
|
||||||
|
* @priority: the priority of the signal source. Typically this will be in
|
||||||
|
* the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
|
||||||
|
* @handler: Callback
|
||||||
|
* @user_data: Data for @handler
|
||||||
|
* @notify: #GDestroyNotify for @handler
|
||||||
|
*
|
||||||
|
* A convenience function for g_unix_signal_source_new(), which
|
||||||
|
* attaches to the default #GMainContext. You can remove the watch
|
||||||
|
* using g_source_remove().
|
||||||
|
*
|
||||||
|
* Returns: An ID (greater than 0) for the event source
|
||||||
|
*/
|
||||||
|
guint
|
||||||
|
g_unix_signal_add_watch_full (int signum,
|
||||||
|
int priority,
|
||||||
|
GSourceFunc handler,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify notify)
|
||||||
|
{
|
||||||
|
guint id;
|
||||||
|
GSource *source;
|
||||||
|
|
||||||
|
source = g_unix_signal_source_new (signum);
|
||||||
|
|
||||||
|
if (priority != G_PRIORITY_DEFAULT)
|
||||||
|
g_source_set_priority (source, priority);
|
||||||
|
|
||||||
|
g_source_set_callback (source, handler, user_data, notify);
|
||||||
|
id = g_source_attach (source, NULL);
|
||||||
|
g_source_unref (source);
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
82
glib/glib-unix.h
Normal file
82
glib/glib-unix.h
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/* glib-unix.h - Unix specific integration
|
||||||
|
* Copyright (C) 2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __G_UNIX_H__
|
||||||
|
#define __G_UNIX_H__
|
||||||
|
|
||||||
|
/* We need to include the UNIX headers needed to use the APIs below,
|
||||||
|
* but we also take this opportunity to include a wide selection of
|
||||||
|
* other UNIX headers. If one of the headers below is broken on some
|
||||||
|
* system, work around it here (or better, fix the system or tell
|
||||||
|
* people to use a better one).
|
||||||
|
*/
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
|
#define _G_GNU_SOURCE_TEMPORARILY_DEFINED
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#ifdef _G_GNU_SOURCE_TEMPORARILY_DEFINED
|
||||||
|
#undef _GNU_SOURCE
|
||||||
|
#undef _G_GNU_SOURCE_TEMPORARILY_DEFINED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#ifndef G_OS_UNIX
|
||||||
|
#error "This header may only be used on UNIX"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* G_UNIX_ERROR:
|
||||||
|
*
|
||||||
|
* Error domain for API in the "g_unix_" namespace. Note that there
|
||||||
|
* is no exported enumeration mapping %errno. Instead, all functions
|
||||||
|
* ensure that %errno is relevant. The code for all #G_UNIX_ERROR is
|
||||||
|
* always %0, and the error message is always generated via
|
||||||
|
* g_strerror().
|
||||||
|
*
|
||||||
|
* It is expected that most code will not look at %errno from these
|
||||||
|
* APIs. Important cases where one would want to differentiate between
|
||||||
|
* errors are already covered by existing cross-platform GLib API,
|
||||||
|
* such as e.g. #GFile wrapping %ENOENT. However, it is provided for
|
||||||
|
* completeness, at least.
|
||||||
|
*/
|
||||||
|
#define G_UNIX_ERROR (g_unix_error_quark())
|
||||||
|
|
||||||
|
GQuark g_unix_error_quark (void);
|
||||||
|
|
||||||
|
gboolean g_unix_pipe_flags (int *fds,
|
||||||
|
int flags,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
GSource *g_unix_signal_source_new (int signum);
|
||||||
|
|
||||||
|
guint g_unix_signal_add_watch_full (int signum,
|
||||||
|
int priority,
|
||||||
|
GSourceFunc handler,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify notify);
|
||||||
|
|
||||||
|
#endif
|
@@ -1451,6 +1451,7 @@ g_test_config_vars
|
|||||||
#endif
|
#endif
|
||||||
g_test_create_case
|
g_test_create_case
|
||||||
g_test_create_suite
|
g_test_create_suite
|
||||||
|
g_test_fail
|
||||||
g_test_get_root
|
g_test_get_root
|
||||||
g_test_init
|
g_test_init
|
||||||
g_test_log_buffer_free
|
g_test_log_buffer_free
|
||||||
@@ -1977,6 +1978,17 @@ g_hostname_to_unicode
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if IN_HEADER(__G_UNIX_H__)
|
||||||
|
#if IN_FILE(__G_UNIX_C__)
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
g_unix_pipe_flags
|
||||||
|
g_unix_error_quark
|
||||||
|
g_unix_signal_source_new
|
||||||
|
g_unix_signal_add_watch_full
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef INCLUDE_VARIABLES
|
#ifdef INCLUDE_VARIABLES
|
||||||
g_ascii_table
|
g_ascii_table
|
||||||
g_utf8_skip
|
g_utf8_skip
|
||||||
|
35
glib/gmain-internal.h
Normal file
35
glib/gmain-internal.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/* gmain-internal.h - GLib-internal mainloop API
|
||||||
|
* Copyright (C) 2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined (GLIB_COMPILATION)
|
||||||
|
#error "This is a private header"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __G_MAIN_INTERNAL_H__
|
||||||
|
#define __G_MAIN_INTERNAL_H__
|
||||||
|
|
||||||
|
#include "gmain.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
GSource *_g_main_create_unix_signal_watch (int signum);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __G_MAIN_H__ */
|
485
glib/gmain.c
485
glib/gmain.c
@@ -62,6 +62,10 @@
|
|||||||
#define G_MAIN_POLL_DEBUG
|
#define G_MAIN_POLL_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
#include "glib-unix.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -73,6 +77,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif /* HAVE_UNISTD_H */
|
#endif /* HAVE_UNISTD_H */
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#define STRICT
|
#define STRICT
|
||||||
@@ -84,11 +89,6 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif /* G_OS_BEOS */
|
#endif /* G_OS_BEOS */
|
||||||
|
|
||||||
#ifdef G_OS_UNIX
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gmain.h"
|
#include "gmain.h"
|
||||||
|
|
||||||
#include "garray.h"
|
#include "garray.h"
|
||||||
@@ -188,6 +188,7 @@
|
|||||||
|
|
||||||
typedef struct _GTimeoutSource GTimeoutSource;
|
typedef struct _GTimeoutSource GTimeoutSource;
|
||||||
typedef struct _GChildWatchSource GChildWatchSource;
|
typedef struct _GChildWatchSource GChildWatchSource;
|
||||||
|
typedef struct _GUnixSignalWatchSource GUnixSignalWatchSource;
|
||||||
typedef struct _GPollRec GPollRec;
|
typedef struct _GPollRec GPollRec;
|
||||||
typedef struct _GSourceCallback GSourceCallback;
|
typedef struct _GSourceCallback GSourceCallback;
|
||||||
|
|
||||||
@@ -306,6 +307,13 @@ struct _GChildWatchSource
|
|||||||
#endif /* G_OS_WIN32 */
|
#endif /* G_OS_WIN32 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _GUnixSignalWatchSource
|
||||||
|
{
|
||||||
|
GSource source;
|
||||||
|
int signum;
|
||||||
|
gboolean pending;
|
||||||
|
};
|
||||||
|
|
||||||
struct _GPollRec
|
struct _GPollRec
|
||||||
{
|
{
|
||||||
GPollFD *fd;
|
GPollFD *fd;
|
||||||
@@ -365,6 +373,8 @@ static void g_main_context_remove_poll_unlocked (GMainContext *context,
|
|||||||
GPollFD *fd);
|
GPollFD *fd);
|
||||||
static void g_main_context_wakeup_unlocked (GMainContext *context);
|
static void g_main_context_wakeup_unlocked (GMainContext *context);
|
||||||
|
|
||||||
|
static void _g_main_wake_up_all_contexts (void);
|
||||||
|
|
||||||
static gboolean g_timeout_prepare (GSource *source,
|
static gboolean g_timeout_prepare (GSource *source,
|
||||||
gint *timeout);
|
gint *timeout);
|
||||||
static gboolean g_timeout_check (GSource *source);
|
static gboolean g_timeout_check (GSource *source);
|
||||||
@@ -377,6 +387,18 @@ static gboolean g_child_watch_check (GSource *source);
|
|||||||
static gboolean g_child_watch_dispatch (GSource *source,
|
static gboolean g_child_watch_dispatch (GSource *source,
|
||||||
GSourceFunc callback,
|
GSourceFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
static void g_unix_signal_handler (int signum);
|
||||||
|
static void init_unix_signal_wakeup_state_unlocked (void);
|
||||||
|
static void init_unix_signal_wakeup_state (void);
|
||||||
|
static gboolean g_unix_signal_watch_prepare (GSource *source,
|
||||||
|
gint *timeout);
|
||||||
|
static gboolean g_unix_signal_watch_check (GSource *source);
|
||||||
|
static gboolean g_unix_signal_watch_dispatch (GSource *source,
|
||||||
|
GSourceFunc callback,
|
||||||
|
gpointer user_data);
|
||||||
|
static void g_unix_signal_watch_finalize (GSource *source);
|
||||||
|
#endif
|
||||||
static gboolean g_idle_prepare (GSource *source,
|
static gboolean g_idle_prepare (GSource *source,
|
||||||
gint *timeout);
|
gint *timeout);
|
||||||
static gboolean g_idle_check (GSource *source);
|
static gboolean g_idle_check (GSource *source);
|
||||||
@@ -389,15 +411,47 @@ static GMainContext *default_main_context;
|
|||||||
static GSList *main_contexts_without_pipe = NULL;
|
static GSList *main_contexts_without_pipe = NULL;
|
||||||
|
|
||||||
#ifndef G_OS_WIN32
|
#ifndef G_OS_WIN32
|
||||||
/* Child status monitoring code */
|
|
||||||
|
/* The UNIX signal pipe contains a single byte specifying which
|
||||||
|
* signal was received.
|
||||||
|
*/
|
||||||
|
#define _UNIX_SIGNAL_PIPE_SIGCHLD_CHAR 'C'
|
||||||
|
#define _UNIX_SIGNAL_PIPE_SIGHUP_CHAR 'H'
|
||||||
|
#define _UNIX_SIGNAL_PIPE_SIGINT_CHAR 'I'
|
||||||
|
#define _UNIX_SIGNAL_PIPE_SIGTERM_CHAR 'T'
|
||||||
|
/* Guards all the data below */
|
||||||
|
G_LOCK_DEFINE_STATIC (unix_signal_lock);
|
||||||
enum {
|
enum {
|
||||||
CHILD_WATCH_UNINITIALIZED,
|
UNIX_SIGNAL_UNINITIALIZED = 0,
|
||||||
CHILD_WATCH_INITIALIZED_SINGLE,
|
UNIX_SIGNAL_INITIALIZED_SINGLE,
|
||||||
CHILD_WATCH_INITIALIZED_THREADED
|
UNIX_SIGNAL_INITIALIZED_THREADED
|
||||||
};
|
};
|
||||||
static gint child_watch_init_state = CHILD_WATCH_UNINITIALIZED;
|
static gint unix_signal_init_state = UNIX_SIGNAL_UNINITIALIZED;
|
||||||
|
typedef struct {
|
||||||
|
gboolean sigchld_handler_installed : 1;
|
||||||
|
gboolean sighup_handler_installed : 1;
|
||||||
|
gboolean sigint_handler_installed : 1;
|
||||||
|
gboolean sigterm_handler_installed : 1;
|
||||||
|
|
||||||
|
/* These are only used in the UNIX_SIGNAL_INITIALIZED_SINGLE case */
|
||||||
|
gboolean sighup_delivered : 1;
|
||||||
|
gboolean sigint_delivered : 1;
|
||||||
|
gboolean sigterm_delivered : 1;
|
||||||
|
} UnixSignalState;
|
||||||
|
static UnixSignalState unix_signal_state;
|
||||||
|
static gint unix_signal_wake_up_pipe[2];
|
||||||
|
GSList *unix_signal_watches;
|
||||||
|
|
||||||
|
/* Not guarded ( FIXME should it be? ) */
|
||||||
static gint child_watch_count = 1;
|
static gint child_watch_count = 1;
|
||||||
static gint child_watch_wake_up_pipe[2] = {0, 0};
|
|
||||||
|
static GSourceFuncs g_unix_signal_funcs =
|
||||||
|
{
|
||||||
|
g_unix_signal_watch_prepare,
|
||||||
|
g_unix_signal_watch_check,
|
||||||
|
g_unix_signal_watch_dispatch,
|
||||||
|
g_unix_signal_watch_finalize
|
||||||
|
};
|
||||||
#endif /* !G_OS_WIN32 */
|
#endif /* !G_OS_WIN32 */
|
||||||
G_LOCK_DEFINE_STATIC (main_context_list);
|
G_LOCK_DEFINE_STATIC (main_context_list);
|
||||||
static GSList *main_context_list = NULL;
|
static GSList *main_context_list = NULL;
|
||||||
@@ -515,23 +569,14 @@ g_main_context_unref (GMainContext *context)
|
|||||||
static void
|
static void
|
||||||
g_main_context_init_pipe (GMainContext *context)
|
g_main_context_init_pipe (GMainContext *context)
|
||||||
{
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
# ifndef G_OS_WIN32
|
# ifndef G_OS_WIN32
|
||||||
if (context->wake_up_pipe[0] != -1)
|
if (context->wake_up_pipe[0] != -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef HAVE_PIPE2
|
if (!g_unix_pipe_flags (context->wake_up_pipe, FD_CLOEXEC, &error))
|
||||||
/* if this fails, we fall through and try pipe */
|
g_error ("Cannot create pipe main loop wake-up: %s", error->message);
|
||||||
pipe2 (context->wake_up_pipe, O_CLOEXEC);
|
|
||||||
#endif
|
|
||||||
if (context->wake_up_pipe[0] == -1)
|
|
||||||
{
|
|
||||||
if (pipe (context->wake_up_pipe) < 0)
|
|
||||||
g_error ("Cannot create pipe main loop wake-up: %s\n",
|
|
||||||
g_strerror (errno));
|
|
||||||
|
|
||||||
fcntl (context->wake_up_pipe[0], F_SETFD, FD_CLOEXEC);
|
|
||||||
fcntl (context->wake_up_pipe[1], F_SETFD, FD_CLOEXEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
context->wake_up_rec.fd = context->wake_up_pipe[0];
|
context->wake_up_rec.fd = context->wake_up_pipe[0];
|
||||||
context->wake_up_rec.events = G_IO_IN;
|
context->wake_up_rec.events = G_IO_IN;
|
||||||
@@ -3727,6 +3772,30 @@ g_main_context_get_poll_func (GMainContext *context)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_g_main_wake_up_all_contexts (void)
|
||||||
|
{
|
||||||
|
GSList *list;
|
||||||
|
|
||||||
|
/* We were woken up. Wake up all other contexts in all other threads */
|
||||||
|
G_LOCK (main_context_list);
|
||||||
|
for (list = main_context_list; list; list = list->next)
|
||||||
|
{
|
||||||
|
GMainContext *context;
|
||||||
|
|
||||||
|
context = list->data;
|
||||||
|
if (g_atomic_int_get (&context->ref_count) > 0)
|
||||||
|
/* Due to racing conditions we can find ref_count == 0, in
|
||||||
|
* that case, however, the context is still not destroyed
|
||||||
|
* and no poll can be active, otherwise the ref_count
|
||||||
|
* wouldn't be 0
|
||||||
|
*/
|
||||||
|
g_main_context_wakeup (context);
|
||||||
|
}
|
||||||
|
G_UNLOCK (main_context_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* HOLDS: context's lock */
|
/* HOLDS: context's lock */
|
||||||
/* Wake the main loop up from a poll() */
|
/* Wake the main loop up from a poll() */
|
||||||
static void
|
static void
|
||||||
@@ -4232,13 +4301,169 @@ g_child_watch_prepare (GSource *source,
|
|||||||
return check_for_child_exited (source);
|
return check_for_child_exited (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
g_child_watch_check (GSource *source)
|
g_child_watch_check (GSource *source)
|
||||||
{
|
{
|
||||||
return check_for_child_exited (source);
|
return check_for_child_exited (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
check_for_signal_delivery (GSource *source)
|
||||||
|
{
|
||||||
|
GUnixSignalWatchSource *unix_signal_source = (GUnixSignalWatchSource*) source;
|
||||||
|
gboolean delivered;
|
||||||
|
|
||||||
|
G_LOCK (unix_signal_lock);
|
||||||
|
if (unix_signal_init_state == UNIX_SIGNAL_INITIALIZED_SINGLE)
|
||||||
|
{
|
||||||
|
switch (unix_signal_source->signum)
|
||||||
|
{
|
||||||
|
case SIGHUP:
|
||||||
|
delivered = unix_signal_state.sighup_delivered;
|
||||||
|
break;
|
||||||
|
case SIGINT:
|
||||||
|
delivered = unix_signal_state.sigint_delivered;
|
||||||
|
break;
|
||||||
|
case SIGTERM:
|
||||||
|
delivered = unix_signal_state.sigterm_delivered;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
delivered = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_assert (unix_signal_init_state == UNIX_SIGNAL_INITIALIZED_THREADED);
|
||||||
|
delivered = unix_signal_source->pending;
|
||||||
|
}
|
||||||
|
G_UNLOCK (unix_signal_lock);
|
||||||
|
|
||||||
|
return delivered;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
g_unix_signal_watch_prepare (GSource *source,
|
||||||
|
gint *timeout)
|
||||||
|
{
|
||||||
|
*timeout = -1;
|
||||||
|
|
||||||
|
return check_for_signal_delivery (source);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
g_unix_signal_watch_check (GSource *source)
|
||||||
|
{
|
||||||
|
return check_for_signal_delivery (source);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
g_unix_signal_watch_dispatch (GSource *source,
|
||||||
|
GSourceFunc callback,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GUnixSignalWatchSource *unix_signal_source;
|
||||||
|
|
||||||
|
unix_signal_source = (GUnixSignalWatchSource *) source;
|
||||||
|
|
||||||
|
if (!callback)
|
||||||
|
{
|
||||||
|
g_warning ("Unix signal source dispatched without callback\n"
|
||||||
|
"You must call g_source_set_callback().");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
(callback) (user_data);
|
||||||
|
|
||||||
|
G_LOCK (unix_signal_lock);
|
||||||
|
if (unix_signal_init_state == UNIX_SIGNAL_INITIALIZED_SINGLE)
|
||||||
|
{
|
||||||
|
switch (unix_signal_source->signum)
|
||||||
|
{
|
||||||
|
case SIGHUP:
|
||||||
|
unix_signal_state.sighup_delivered = FALSE;
|
||||||
|
break;
|
||||||
|
case SIGINT:
|
||||||
|
unix_signal_state.sigint_delivered = FALSE;
|
||||||
|
break;
|
||||||
|
case SIGTERM:
|
||||||
|
unix_signal_state.sigterm_delivered = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_assert (unix_signal_init_state == UNIX_SIGNAL_INITIALIZED_THREADED);
|
||||||
|
unix_signal_source->pending = FALSE;
|
||||||
|
}
|
||||||
|
G_UNLOCK (unix_signal_lock);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ensure_unix_signal_handler_installed_unlocked (int signum)
|
||||||
|
{
|
||||||
|
struct sigaction action;
|
||||||
|
|
||||||
|
switch (signum)
|
||||||
|
{
|
||||||
|
case SIGHUP:
|
||||||
|
if (unix_signal_state.sighup_handler_installed)
|
||||||
|
return;
|
||||||
|
unix_signal_state.sighup_handler_installed = TRUE;
|
||||||
|
break;
|
||||||
|
case SIGINT:
|
||||||
|
if (unix_signal_state.sigint_handler_installed)
|
||||||
|
return;
|
||||||
|
unix_signal_state.sigint_handler_installed = TRUE;
|
||||||
|
break;
|
||||||
|
case SIGTERM:
|
||||||
|
if (unix_signal_state.sigterm_handler_installed)
|
||||||
|
return;
|
||||||
|
unix_signal_state.sigterm_handler_installed = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
init_unix_signal_wakeup_state_unlocked ();
|
||||||
|
|
||||||
|
action.sa_handler = g_unix_signal_handler;
|
||||||
|
sigemptyset (&action.sa_mask);
|
||||||
|
action.sa_flags = 0;
|
||||||
|
sigaction (signum, &action, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
GSource *
|
||||||
|
_g_main_create_unix_signal_watch (int signum)
|
||||||
|
{
|
||||||
|
GSource *source;
|
||||||
|
GUnixSignalWatchSource *unix_signal_source;
|
||||||
|
|
||||||
|
init_unix_signal_wakeup_state ();
|
||||||
|
|
||||||
|
source = g_source_new (&g_unix_signal_funcs, sizeof (GUnixSignalWatchSource));
|
||||||
|
unix_signal_source = (GUnixSignalWatchSource *) source;
|
||||||
|
|
||||||
|
unix_signal_source->signum = signum;
|
||||||
|
unix_signal_source->pending = FALSE;
|
||||||
|
|
||||||
|
G_LOCK (unix_signal_lock);
|
||||||
|
ensure_unix_signal_handler_installed_unlocked (signum);
|
||||||
|
unix_signal_watches = g_slist_prepend (unix_signal_watches, unix_signal_source);
|
||||||
|
G_UNLOCK (unix_signal_lock);
|
||||||
|
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
g_unix_signal_watch_finalize (GSource *source)
|
||||||
|
{
|
||||||
|
G_LOCK (unix_signal_lock);
|
||||||
|
unix_signal_watches = g_slist_remove (unix_signal_watches, source);
|
||||||
|
G_UNLOCK (unix_signal_lock);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* G_OS_WIN32 */
|
#endif /* G_OS_WIN32 */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -4267,110 +4492,202 @@ g_child_watch_dispatch (GSource *source,
|
|||||||
#ifndef G_OS_WIN32
|
#ifndef G_OS_WIN32
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_child_watch_signal_handler (int signum)
|
g_unix_signal_handler (int signum)
|
||||||
{
|
{
|
||||||
|
if (signum == SIGCHLD)
|
||||||
child_watch_count ++;
|
child_watch_count ++;
|
||||||
|
|
||||||
if (child_watch_init_state == CHILD_WATCH_INITIALIZED_THREADED)
|
if (unix_signal_init_state == UNIX_SIGNAL_INITIALIZED_THREADED)
|
||||||
{
|
{
|
||||||
write (child_watch_wake_up_pipe[1], "B", 1);
|
char buf[1];
|
||||||
|
switch (signum)
|
||||||
|
{
|
||||||
|
case SIGCHLD:
|
||||||
|
buf[0] = _UNIX_SIGNAL_PIPE_SIGCHLD_CHAR;
|
||||||
|
break;
|
||||||
|
case SIGHUP:
|
||||||
|
buf[0] = _UNIX_SIGNAL_PIPE_SIGHUP_CHAR;
|
||||||
|
break;
|
||||||
|
case SIGINT:
|
||||||
|
buf[0] = _UNIX_SIGNAL_PIPE_SIGINT_CHAR;
|
||||||
|
break;
|
||||||
|
case SIGTERM:
|
||||||
|
buf[0] = _UNIX_SIGNAL_PIPE_SIGTERM_CHAR;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* Shouldn't happen */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
write (unix_signal_wake_up_pipe[1], buf, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We count on the signal interrupting the poll in the same thread.
|
/* We count on the signal interrupting the poll in the same thread. */
|
||||||
*/
|
switch (signum)
|
||||||
|
{
|
||||||
|
case SIGCHLD:
|
||||||
|
/* Nothing to do - the handler will call waitpid() */
|
||||||
|
break;
|
||||||
|
case SIGHUP:
|
||||||
|
unix_signal_state.sighup_delivered = TRUE;
|
||||||
|
break;
|
||||||
|
case SIGINT:
|
||||||
|
unix_signal_state.sigint_delivered = TRUE;
|
||||||
|
break;
|
||||||
|
case SIGTERM:
|
||||||
|
unix_signal_state.sigterm_delivered = TRUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_child_watch_source_init_single (void)
|
deliver_unix_signal (int signum)
|
||||||
{
|
{
|
||||||
struct sigaction action;
|
GSList *iter;
|
||||||
|
g_assert (signum == SIGHUP || signum == SIGINT || signum == SIGTERM);
|
||||||
|
|
||||||
g_assert (! g_thread_supported());
|
G_LOCK (unix_signal_lock);
|
||||||
g_assert (child_watch_init_state == CHILD_WATCH_UNINITIALIZED);
|
for (iter = unix_signal_watches; iter; iter = iter->next)
|
||||||
|
{
|
||||||
|
GUnixSignalWatchSource *source = iter->data;
|
||||||
|
|
||||||
child_watch_init_state = CHILD_WATCH_INITIALIZED_SINGLE;
|
if (source->signum != signum)
|
||||||
|
continue;
|
||||||
|
|
||||||
action.sa_handler = g_child_watch_signal_handler;
|
source->pending = TRUE;
|
||||||
sigemptyset (&action.sa_mask);
|
}
|
||||||
action.sa_flags = SA_NOCLDSTOP;
|
G_UNLOCK (unix_signal_lock);
|
||||||
sigaction (SIGCHLD, &action, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
G_GNUC_NORETURN static gpointer
|
static gpointer unix_signal_helper_thread (gpointer data) G_GNUC_NORETURN;
|
||||||
child_watch_helper_thread (gpointer data)
|
|
||||||
|
/*
|
||||||
|
* This thread is created whenever anything in GLib needs
|
||||||
|
* to deal with UNIX signals; at present, just SIGCHLD
|
||||||
|
* from g_child_watch_source_new().
|
||||||
|
*
|
||||||
|
* Note: We could eventually make this thread a more public interface
|
||||||
|
* and allow e.g. GDBus to use it instead of its own worker thread.
|
||||||
|
*/
|
||||||
|
static gpointer
|
||||||
|
unix_signal_helper_thread (gpointer data)
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
gchar b[20];
|
gchar b[128];
|
||||||
GSList *list;
|
ssize_t i, bytes_read;
|
||||||
|
gboolean sigterm_received = FALSE;
|
||||||
|
gboolean sigint_received = FALSE;
|
||||||
|
gboolean sighup_received = FALSE;
|
||||||
|
|
||||||
read (child_watch_wake_up_pipe[0], b, 20);
|
bytes_read = read (unix_signal_wake_up_pipe[0], b, sizeof (b));
|
||||||
|
if (bytes_read < 0)
|
||||||
/* We were woken up. Wake up all other contexts in all other threads */
|
|
||||||
G_LOCK (main_context_list);
|
|
||||||
for (list = main_context_list; list; list = list->next)
|
|
||||||
{
|
{
|
||||||
GMainContext *context;
|
g_warning ("Failed to read from child watch wake up pipe: %s",
|
||||||
|
strerror (errno));
|
||||||
context = list->data;
|
/* Not much we can do here sanely; just wait a second and hope
|
||||||
if (g_atomic_int_get (&context->ref_count) > 0)
|
* it was transient.
|
||||||
/* Due to racing conditions we can find ref_count == 0, in
|
*/
|
||||||
* that case, however, the context is still not destroyed
|
g_usleep (G_USEC_PER_SEC);
|
||||||
* and no poll can be active, otherwise the ref_count
|
continue;
|
||||||
* wouldn't be 0 */
|
}
|
||||||
g_main_context_wakeup (context);
|
for (i = 0; i < bytes_read; i++)
|
||||||
|
{
|
||||||
|
switch (b[i])
|
||||||
|
{
|
||||||
|
case _UNIX_SIGNAL_PIPE_SIGCHLD_CHAR:
|
||||||
|
/* The child watch source will call waitpid() in its
|
||||||
|
* prepare() and check() methods; however, we don't
|
||||||
|
* know which pid exited, so we need to wake up
|
||||||
|
* all contexts. Note: actually we could get the pid
|
||||||
|
* from the "siginfo_t" via the handler, but to pass
|
||||||
|
* that info down the pipe would require a more structured
|
||||||
|
* data stream (as opposed to a single byte).
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
case _UNIX_SIGNAL_PIPE_SIGTERM_CHAR:
|
||||||
|
sigterm_received = TRUE;
|
||||||
|
break;
|
||||||
|
case _UNIX_SIGNAL_PIPE_SIGHUP_CHAR:
|
||||||
|
sighup_received = TRUE;
|
||||||
|
break;
|
||||||
|
case _UNIX_SIGNAL_PIPE_SIGINT_CHAR:
|
||||||
|
sigint_received = TRUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_warning ("Invalid char '%c' read from child watch pipe", b[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (sigterm_received)
|
||||||
|
deliver_unix_signal (SIGTERM);
|
||||||
|
if (sigint_received)
|
||||||
|
deliver_unix_signal (SIGINT);
|
||||||
|
if (sighup_received)
|
||||||
|
deliver_unix_signal (SIGHUP);
|
||||||
|
_g_main_wake_up_all_contexts ();
|
||||||
}
|
}
|
||||||
G_UNLOCK (main_context_list);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_child_watch_source_init_multi_threaded (void)
|
init_unix_signal_wakeup_state_unlocked (void)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
struct sigaction action;
|
|
||||||
|
|
||||||
g_assert (g_thread_supported());
|
if (!g_thread_supported ())
|
||||||
|
{
|
||||||
|
/* There is nothing to do for initializing in the non-threaded
|
||||||
|
* case.
|
||||||
|
*/
|
||||||
|
if (unix_signal_init_state == UNIX_SIGNAL_UNINITIALIZED)
|
||||||
|
unix_signal_init_state = UNIX_SIGNAL_INITIALIZED_SINGLE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pipe (child_watch_wake_up_pipe) < 0)
|
if (unix_signal_init_state == UNIX_SIGNAL_INITIALIZED_THREADED)
|
||||||
g_error ("Cannot create wake up pipe: %s\n", g_strerror (errno));
|
return;
|
||||||
fcntl (child_watch_wake_up_pipe[1], F_SETFL, O_NONBLOCK | fcntl (child_watch_wake_up_pipe[1], F_GETFL));
|
|
||||||
|
if (!g_unix_pipe_flags (unix_signal_wake_up_pipe, FD_CLOEXEC, &error))
|
||||||
|
g_error ("Cannot create UNIX signal wake up pipe: %s\n", error->message);
|
||||||
|
fcntl (unix_signal_wake_up_pipe[1], F_SETFL, O_NONBLOCK | fcntl (unix_signal_wake_up_pipe[1], F_GETFL));
|
||||||
|
|
||||||
/* We create a helper thread that polls on the wakeup pipe indefinitely */
|
/* We create a helper thread that polls on the wakeup pipe indefinitely */
|
||||||
/* FIXME: Think this through for races */
|
if (g_thread_create (unix_signal_helper_thread, NULL, FALSE, &error) == NULL)
|
||||||
if (g_thread_create (child_watch_helper_thread, NULL, FALSE, &error) == NULL)
|
g_error ("Cannot create a thread to monitor UNIX signals: %s\n", error->message);
|
||||||
g_error ("Cannot create a thread to monitor child exit status: %s\n", error->message);
|
|
||||||
child_watch_init_state = CHILD_WATCH_INITIALIZED_THREADED;
|
|
||||||
|
|
||||||
action.sa_handler = g_child_watch_signal_handler;
|
unix_signal_init_state = UNIX_SIGNAL_INITIALIZED_THREADED;
|
||||||
sigemptyset (&action.sa_mask);
|
|
||||||
action.sa_flags = SA_RESTART | SA_NOCLDSTOP;
|
|
||||||
sigaction (SIGCHLD, &action, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_child_watch_source_init_promote_single_to_threaded (void)
|
init_unix_signal_wakeup_state (void)
|
||||||
{
|
{
|
||||||
g_child_watch_source_init_multi_threaded ();
|
G_LOCK (unix_signal_lock);
|
||||||
|
|
||||||
|
init_unix_signal_wakeup_state_unlocked ();
|
||||||
|
|
||||||
|
G_UNLOCK (unix_signal_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_child_watch_source_init (void)
|
g_child_watch_source_init (void)
|
||||||
{
|
{
|
||||||
if (g_thread_supported())
|
init_unix_signal_wakeup_state ();
|
||||||
|
|
||||||
|
G_LOCK (unix_signal_lock);
|
||||||
|
if (!unix_signal_state.sigchld_handler_installed)
|
||||||
{
|
{
|
||||||
if (child_watch_init_state == CHILD_WATCH_UNINITIALIZED)
|
struct sigaction action;
|
||||||
g_child_watch_source_init_multi_threaded ();
|
action.sa_handler = g_unix_signal_handler;
|
||||||
else if (child_watch_init_state == CHILD_WATCH_INITIALIZED_SINGLE)
|
sigemptyset (&action.sa_mask);
|
||||||
g_child_watch_source_init_promote_single_to_threaded ();
|
action.sa_flags = SA_RESTART | SA_NOCLDSTOP;
|
||||||
}
|
sigaction (SIGCHLD, &action, NULL);
|
||||||
else
|
unix_signal_state.sigchld_handler_installed = TRUE;
|
||||||
{
|
|
||||||
if (child_watch_init_state == CHILD_WATCH_UNINITIALIZED)
|
|
||||||
g_child_watch_source_init_single ();
|
|
||||||
}
|
}
|
||||||
|
G_UNLOCK (unix_signal_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !G_OS_WIN32 */
|
#endif /* !G_OS_WIN32 */
|
||||||
|
@@ -124,6 +124,8 @@ struct _GMarkupParseContext
|
|||||||
gint line_number;
|
gint line_number;
|
||||||
gint char_number;
|
gint char_number;
|
||||||
|
|
||||||
|
GMarkupParseState state;
|
||||||
|
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
GDestroyNotify dnotify;
|
GDestroyNotify dnotify;
|
||||||
|
|
||||||
@@ -134,7 +136,6 @@ struct _GMarkupParseContext
|
|||||||
GString *partial_chunk;
|
GString *partial_chunk;
|
||||||
GSList *spare_chunks;
|
GSList *spare_chunks;
|
||||||
|
|
||||||
GMarkupParseState state;
|
|
||||||
GSList *tag_stack;
|
GSList *tag_stack;
|
||||||
GSList *tag_stack_gstr;
|
GSList *tag_stack_gstr;
|
||||||
GSList *spare_list_nodes;
|
GSList *spare_list_nodes;
|
||||||
|
@@ -548,14 +548,10 @@ g_logv (const gchar *log_domain,
|
|||||||
else
|
else
|
||||||
abort ();
|
abort ();
|
||||||
#else
|
#else
|
||||||
#if defined (G_ENABLE_DEBUG) && defined (SIGTRAP)
|
|
||||||
if (!(test_level & G_LOG_FLAG_RECURSION))
|
if (!(test_level & G_LOG_FLAG_RECURSION))
|
||||||
G_BREAKPOINT ();
|
G_BREAKPOINT ();
|
||||||
else
|
else
|
||||||
abort ();
|
abort ();
|
||||||
#else /* !G_ENABLE_DEBUG || !SIGTRAP */
|
|
||||||
abort ();
|
|
||||||
#endif /* !G_ENABLE_DEBUG || !SIGTRAP */
|
|
||||||
#endif /* !G_OS_WIN32 */
|
#endif /* !G_OS_WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,7 +814,6 @@ _g_log_fallback_handler (const gchar *log_domain,
|
|||||||
#ifndef G_OS_WIN32
|
#ifndef G_OS_WIN32
|
||||||
gchar pid_string[FORMAT_UNSIGNED_BUFSIZE];
|
gchar pid_string[FORMAT_UNSIGNED_BUFSIZE];
|
||||||
#endif
|
#endif
|
||||||
gboolean is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
|
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
/* we cannot call _any_ GLib functions in this fallback handler,
|
/* we cannot call _any_ GLib functions in this fallback handler,
|
||||||
@@ -855,10 +850,6 @@ _g_log_fallback_handler (const gchar *log_domain,
|
|||||||
write_string (fd, level_prefix);
|
write_string (fd, level_prefix);
|
||||||
write_string (fd, ": ");
|
write_string (fd, ": ");
|
||||||
write_string (fd, message);
|
write_string (fd, message);
|
||||||
if (is_fatal)
|
|
||||||
write_string (fd, "\naborting...\n");
|
|
||||||
else
|
|
||||||
write_string (fd, "\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -927,7 +918,6 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
const gchar *message,
|
const gchar *message,
|
||||||
gpointer unused_data)
|
gpointer unused_data)
|
||||||
{
|
{
|
||||||
gboolean is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
|
|
||||||
gchar level_prefix[STRING_BUFFER_SIZE], *string;
|
gchar level_prefix[STRING_BUFFER_SIZE], *string;
|
||||||
GString *gstring;
|
GString *gstring;
|
||||||
int fd;
|
int fd;
|
||||||
@@ -988,9 +978,6 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
|
|
||||||
g_string_free (msg, TRUE);
|
g_string_free (msg, TRUE);
|
||||||
}
|
}
|
||||||
if (is_fatal)
|
|
||||||
g_string_append (gstring, "\naborting...\n");
|
|
||||||
else
|
|
||||||
g_string_append (gstring, "\n");
|
g_string_append (gstring, "\n");
|
||||||
|
|
||||||
string = g_string_free (gstring, FALSE);
|
string = g_string_free (gstring, FALSE);
|
||||||
|
@@ -139,8 +139,8 @@ struct _GMatchInfo
|
|||||||
GRegexMatchFlags match_opts; /* options used at match time on the regex */
|
GRegexMatchFlags match_opts; /* options used at match time on the regex */
|
||||||
gint matches; /* number of matching sub patterns */
|
gint matches; /* number of matching sub patterns */
|
||||||
gint pos; /* position in the string where last match left off */
|
gint pos; /* position in the string where last match left off */
|
||||||
gint *offsets; /* array of offsets paired 0,1 ; 2,3 ; 3,4 etc */
|
|
||||||
gint n_offsets; /* number of offsets */
|
gint n_offsets; /* number of offsets */
|
||||||
|
gint *offsets; /* array of offsets paired 0,1 ; 2,3 ; 3,4 etc */
|
||||||
gint *workspace; /* workspace for pcre_dfa_exec() */
|
gint *workspace; /* workspace for pcre_dfa_exec() */
|
||||||
gint n_workspace; /* number of workspace elements */
|
gint n_workspace; /* number of workspace elements */
|
||||||
const gchar *string; /* string passed to the match function */
|
const gchar *string; /* string passed to the match function */
|
||||||
|
@@ -1422,12 +1422,18 @@ g_sequence_iter_move (GSequenceIter *iter,
|
|||||||
gint delta)
|
gint delta)
|
||||||
{
|
{
|
||||||
gint new_pos;
|
gint new_pos;
|
||||||
|
gint len;
|
||||||
|
|
||||||
g_return_val_if_fail (iter != NULL, NULL);
|
g_return_val_if_fail (iter != NULL, NULL);
|
||||||
|
|
||||||
|
len = g_sequence_get_length (get_sequence (iter));
|
||||||
|
|
||||||
new_pos = node_get_pos (iter) + delta;
|
new_pos = node_get_pos (iter) + delta;
|
||||||
|
|
||||||
new_pos = clamp_position (get_sequence (iter), new_pos);
|
if (new_pos < 0)
|
||||||
|
new_pos = 0;
|
||||||
|
else if (new_pos > len)
|
||||||
|
new_pos = len;
|
||||||
|
|
||||||
return node_get_by_pos (iter, new_pos);
|
return node_get_by_pos (iter, new_pos);
|
||||||
}
|
}
|
||||||
|
@@ -101,6 +101,7 @@ static GRand *test_run_rand = NULL;
|
|||||||
static gchar *test_run_name = "";
|
static gchar *test_run_name = "";
|
||||||
static guint test_run_forks = 0;
|
static guint test_run_forks = 0;
|
||||||
static guint test_run_count = 0;
|
static guint test_run_count = 0;
|
||||||
|
static guint test_run_success = FALSE;
|
||||||
static guint test_skip_count = 0;
|
static guint test_skip_count = 0;
|
||||||
static GTimer *test_user_timer = NULL;
|
static GTimer *test_user_timer = NULL;
|
||||||
static double test_user_stamp = 0;
|
static double test_user_stamp = 0;
|
||||||
@@ -722,9 +723,11 @@ g_test_minimized_result (double minimized_quantity,
|
|||||||
long double largs = minimized_quantity;
|
long double largs = minimized_quantity;
|
||||||
gchar *buffer;
|
gchar *buffer;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
buffer = g_strdup_vprintf (format, args);
|
buffer = g_strdup_vprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
g_test_log (G_TEST_LOG_MIN_RESULT, buffer, NULL, 1, &largs);
|
g_test_log (G_TEST_LOG_MIN_RESULT, buffer, NULL, 1, &largs);
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
}
|
}
|
||||||
@@ -751,9 +754,11 @@ g_test_maximized_result (double maximized_quantity,
|
|||||||
long double largs = maximized_quantity;
|
long double largs = maximized_quantity;
|
||||||
gchar *buffer;
|
gchar *buffer;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
buffer = g_strdup_vprintf (format, args);
|
buffer = g_strdup_vprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
g_test_log (G_TEST_LOG_MAX_RESULT, buffer, NULL, 1, &largs);
|
g_test_log (G_TEST_LOG_MAX_RESULT, buffer, NULL, 1, &largs);
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
}
|
}
|
||||||
@@ -773,9 +778,11 @@ g_test_message (const char *format,
|
|||||||
{
|
{
|
||||||
gchar *buffer;
|
gchar *buffer;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
buffer = g_strdup_vprintf (format, args);
|
buffer = g_strdup_vprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
g_test_log (G_TEST_LOG_MESSAGE, buffer, NULL, 0, NULL);
|
g_test_log (G_TEST_LOG_MESSAGE, buffer, NULL, 0, NULL);
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
}
|
}
|
||||||
@@ -820,8 +827,10 @@ void
|
|||||||
g_test_bug (const char *bug_uri_snippet)
|
g_test_bug (const char *bug_uri_snippet)
|
||||||
{
|
{
|
||||||
char *c;
|
char *c;
|
||||||
|
|
||||||
g_return_if_fail (test_uri_base != NULL);
|
g_return_if_fail (test_uri_base != NULL);
|
||||||
g_return_if_fail (bug_uri_snippet != NULL);
|
g_return_if_fail (bug_uri_snippet != NULL);
|
||||||
|
|
||||||
c = strstr (test_uri_base, "%s");
|
c = strstr (test_uri_base, "%s");
|
||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
@@ -853,6 +862,7 @@ g_test_get_root (void)
|
|||||||
g_free (test_suite_root->name);
|
g_free (test_suite_root->name);
|
||||||
test_suite_root->name = g_strdup ("");
|
test_suite_root->name = g_strdup ("");
|
||||||
}
|
}
|
||||||
|
|
||||||
return test_suite_root;
|
return test_suite_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -914,10 +924,12 @@ g_test_create_case (const char *test_name,
|
|||||||
GTestFixtureFunc data_teardown)
|
GTestFixtureFunc data_teardown)
|
||||||
{
|
{
|
||||||
GTestCase *tc;
|
GTestCase *tc;
|
||||||
|
|
||||||
g_return_val_if_fail (test_name != NULL, NULL);
|
g_return_val_if_fail (test_name != NULL, NULL);
|
||||||
g_return_val_if_fail (strchr (test_name, '/') == NULL, NULL);
|
g_return_val_if_fail (strchr (test_name, '/') == NULL, NULL);
|
||||||
g_return_val_if_fail (test_name[0] != 0, NULL);
|
g_return_val_if_fail (test_name[0] != 0, NULL);
|
||||||
g_return_val_if_fail (data_test != NULL, NULL);
|
g_return_val_if_fail (data_test != NULL, NULL);
|
||||||
|
|
||||||
tc = g_slice_new0 (GTestCase);
|
tc = g_slice_new0 (GTestCase);
|
||||||
tc->name = g_strdup (test_name);
|
tc->name = g_strdup (test_name);
|
||||||
tc->test_data = (gpointer) test_data;
|
tc->test_data = (gpointer) test_data;
|
||||||
@@ -925,6 +937,7 @@ g_test_create_case (const char *test_name,
|
|||||||
tc->fixture_setup = (void*) data_setup;
|
tc->fixture_setup = (void*) data_setup;
|
||||||
tc->fixture_test = (void*) data_test;
|
tc->fixture_test = (void*) data_test;
|
||||||
tc->fixture_teardown = (void*) data_teardown;
|
tc->fixture_teardown = (void*) data_teardown;
|
||||||
|
|
||||||
return tc;
|
return tc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,6 +998,31 @@ g_test_add_vtable (const char *testpath,
|
|||||||
g_strfreev (segments);
|
g_strfreev (segments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_test_fail:
|
||||||
|
*
|
||||||
|
* Indicates that a test failed. This function can be called
|
||||||
|
* multiple times from the same test. You can use this function
|
||||||
|
* if your test failed in a recoverable way.
|
||||||
|
*
|
||||||
|
* Do not use this function if the failure of a test could cause
|
||||||
|
* other tests to malfunction.
|
||||||
|
*
|
||||||
|
* Calling this function will not stop the test from running, you
|
||||||
|
* need to return from the test function yourself. So you can
|
||||||
|
* produce additional diagnostic messages or even continue running
|
||||||
|
* the test.
|
||||||
|
*
|
||||||
|
* If not called from inside a test, this function does nothing.
|
||||||
|
*
|
||||||
|
* @Since: 2.30
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
g_test_fail (void)
|
||||||
|
{
|
||||||
|
test_run_success = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GTestFunc:
|
* GTestFunc:
|
||||||
*
|
*
|
||||||
@@ -1081,6 +1119,7 @@ g_test_suite_add (GTestSuite *suite,
|
|||||||
{
|
{
|
||||||
g_return_if_fail (suite != NULL);
|
g_return_if_fail (suite != NULL);
|
||||||
g_return_if_fail (test_case != NULL);
|
g_return_if_fail (test_case != NULL);
|
||||||
|
|
||||||
suite->cases = g_slist_prepend (suite->cases, test_case);
|
suite->cases = g_slist_prepend (suite->cases, test_case);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1099,6 +1138,7 @@ g_test_suite_add_suite (GTestSuite *suite,
|
|||||||
{
|
{
|
||||||
g_return_if_fail (suite != NULL);
|
g_return_if_fail (suite != NULL);
|
||||||
g_return_if_fail (nestedsuite != NULL);
|
g_return_if_fail (nestedsuite != NULL);
|
||||||
|
|
||||||
suite->suites = g_slist_prepend (suite->suites, nestedsuite);
|
suite->suites = g_slist_prepend (suite->suites, nestedsuite);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1138,7 +1178,9 @@ g_test_queue_destroy (GDestroyNotify destroy_func,
|
|||||||
gpointer destroy_data)
|
gpointer destroy_data)
|
||||||
{
|
{
|
||||||
DestroyEntry *dentry;
|
DestroyEntry *dentry;
|
||||||
|
|
||||||
g_return_if_fail (destroy_func != NULL);
|
g_return_if_fail (destroy_func != NULL);
|
||||||
|
|
||||||
dentry = g_slice_new0 (DestroyEntry);
|
dentry = g_slice_new0 (DestroyEntry);
|
||||||
dentry->destroy_func = destroy_func;
|
dentry->destroy_func = destroy_func;
|
||||||
dentry->destroy_data = destroy_data;
|
dentry->destroy_data = destroy_data;
|
||||||
@@ -1146,10 +1188,12 @@ g_test_queue_destroy (GDestroyNotify destroy_func,
|
|||||||
test_destroy_queue = dentry;
|
test_destroy_queue = dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static gboolean
|
||||||
test_case_run (GTestCase *tc)
|
test_case_run (GTestCase *tc)
|
||||||
{
|
{
|
||||||
gchar *old_name = test_run_name, *old_base = g_strdup (test_uri_base);
|
gchar *old_name = test_run_name, *old_base = g_strdup (test_uri_base);
|
||||||
|
gboolean success = TRUE;
|
||||||
|
|
||||||
test_run_name = g_strconcat (old_name, "/", tc->name, NULL);
|
test_run_name = g_strconcat (old_name, "/", tc->name, NULL);
|
||||||
if (++test_run_count <= test_skip_count)
|
if (++test_run_count <= test_skip_count)
|
||||||
g_test_log (G_TEST_LOG_SKIP_CASE, test_run_name, NULL, 0, NULL);
|
g_test_log (G_TEST_LOG_SKIP_CASE, test_run_name, NULL, 0, NULL);
|
||||||
@@ -1165,6 +1209,7 @@ test_case_run (GTestCase *tc)
|
|||||||
void *fixture;
|
void *fixture;
|
||||||
g_test_log (G_TEST_LOG_START_CASE, test_run_name, NULL, 0, NULL);
|
g_test_log (G_TEST_LOG_START_CASE, test_run_name, NULL, 0, NULL);
|
||||||
test_run_forks = 0;
|
test_run_forks = 0;
|
||||||
|
test_run_success = TRUE;
|
||||||
g_test_log_set_fatal_handler (NULL, NULL);
|
g_test_log_set_fatal_handler (NULL, NULL);
|
||||||
g_timer_start (test_run_timer);
|
g_timer_start (test_run_timer);
|
||||||
fixture = tc->fixture_size ? g_malloc0 (tc->fixture_size) : tc->test_data;
|
fixture = tc->fixture_size ? g_malloc0 (tc->fixture_size) : tc->test_data;
|
||||||
@@ -1185,7 +1230,9 @@ test_case_run (GTestCase *tc)
|
|||||||
if (tc->fixture_size)
|
if (tc->fixture_size)
|
||||||
g_free (fixture);
|
g_free (fixture);
|
||||||
g_timer_stop (test_run_timer);
|
g_timer_stop (test_run_timer);
|
||||||
largs[0] = 0; /* OK */
|
success = test_run_success;
|
||||||
|
test_run_success = FALSE;
|
||||||
|
largs[0] = success ? 0 : 1; /* OK */
|
||||||
largs[1] = test_run_forks;
|
largs[1] = test_run_forks;
|
||||||
largs[2] = g_timer_elapsed (test_run_timer, NULL);
|
largs[2] = g_timer_elapsed (test_run_timer, NULL);
|
||||||
g_test_log (G_TEST_LOG_STOP_CASE, NULL, NULL, G_N_ELEMENTS (largs), largs);
|
g_test_log (G_TEST_LOG_STOP_CASE, NULL, NULL, G_N_ELEMENTS (largs), largs);
|
||||||
@@ -1195,17 +1242,20 @@ test_case_run (GTestCase *tc)
|
|||||||
test_run_name = old_name;
|
test_run_name = old_name;
|
||||||
g_free (test_uri_base);
|
g_free (test_uri_base);
|
||||||
test_uri_base = old_base;
|
test_uri_base = old_base;
|
||||||
return 0;
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
g_test_run_suite_internal (GTestSuite *suite,
|
g_test_run_suite_internal (GTestSuite *suite,
|
||||||
const char *path)
|
const char *path)
|
||||||
{
|
{
|
||||||
guint n_bad = 0, n_good = 0, bad_suite = 0, l;
|
guint n_bad = 0, l;
|
||||||
gchar *rest, *old_name = test_run_name;
|
gchar *rest, *old_name = test_run_name;
|
||||||
GSList *slist, *reversed;
|
GSList *slist, *reversed;
|
||||||
|
|
||||||
g_return_val_if_fail (suite != NULL, -1);
|
g_return_val_if_fail (suite != NULL, -1);
|
||||||
|
|
||||||
while (path[0] == '/')
|
while (path[0] == '/')
|
||||||
path++;
|
path++;
|
||||||
l = strlen (path);
|
l = strlen (path);
|
||||||
@@ -1219,8 +1269,8 @@ g_test_run_suite_internal (GTestSuite *suite,
|
|||||||
guint n = l ? strlen (tc->name) : 0;
|
guint n = l ? strlen (tc->name) : 0;
|
||||||
if (l == n && strncmp (path, tc->name, n) == 0)
|
if (l == n && strncmp (path, tc->name, n) == 0)
|
||||||
{
|
{
|
||||||
n_good++;
|
if (!test_case_run (tc))
|
||||||
n_bad += test_case_run (tc) != 0;
|
n_bad++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_slist_free (reversed);
|
g_slist_free (reversed);
|
||||||
@@ -1230,12 +1280,13 @@ g_test_run_suite_internal (GTestSuite *suite,
|
|||||||
GTestSuite *ts = slist->data;
|
GTestSuite *ts = slist->data;
|
||||||
guint n = l ? strlen (ts->name) : 0;
|
guint n = l ? strlen (ts->name) : 0;
|
||||||
if (l == n && strncmp (path, ts->name, n) == 0)
|
if (l == n && strncmp (path, ts->name, n) == 0)
|
||||||
bad_suite += g_test_run_suite_internal (ts, rest ? rest : "") != 0;
|
n_bad += g_test_run_suite_internal (ts, rest ? rest : "");
|
||||||
}
|
}
|
||||||
g_slist_free (reversed);
|
g_slist_free (reversed);
|
||||||
g_free (test_run_name);
|
g_free (test_run_name);
|
||||||
test_run_name = old_name;
|
test_run_name = old_name;
|
||||||
return n_bad || bad_suite;
|
|
||||||
|
return n_bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1257,9 +1308,12 @@ int
|
|||||||
g_test_run_suite (GTestSuite *suite)
|
g_test_run_suite (GTestSuite *suite)
|
||||||
{
|
{
|
||||||
guint n_bad = 0;
|
guint n_bad = 0;
|
||||||
|
|
||||||
g_return_val_if_fail (g_test_config_vars->test_initialized, -1);
|
g_return_val_if_fail (g_test_config_vars->test_initialized, -1);
|
||||||
g_return_val_if_fail (g_test_run_once == TRUE, -1);
|
g_return_val_if_fail (g_test_run_once == TRUE, -1);
|
||||||
|
|
||||||
g_test_run_once = FALSE;
|
g_test_run_once = FALSE;
|
||||||
|
|
||||||
if (!test_paths)
|
if (!test_paths)
|
||||||
test_paths = g_slist_prepend (test_paths, "");
|
test_paths = g_slist_prepend (test_paths, "");
|
||||||
while (test_paths)
|
while (test_paths)
|
||||||
@@ -1271,7 +1325,7 @@ g_test_run_suite (GTestSuite *suite)
|
|||||||
path++;
|
path++;
|
||||||
if (!n) /* root suite, run unconditionally */
|
if (!n) /* root suite, run unconditionally */
|
||||||
{
|
{
|
||||||
n_bad += 0 != g_test_run_suite_internal (suite, path);
|
n_bad += g_test_run_suite_internal (suite, path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* regular suite, match path */
|
/* regular suite, match path */
|
||||||
@@ -1279,8 +1333,9 @@ g_test_run_suite (GTestSuite *suite)
|
|||||||
l = strlen (path);
|
l = strlen (path);
|
||||||
l = rest ? MIN (l, rest - path) : l;
|
l = rest ? MIN (l, rest - path) : l;
|
||||||
if ((!l || l == n) && strncmp (path, suite->name, n) == 0)
|
if ((!l || l == n) && strncmp (path, suite->name, n) == 0)
|
||||||
n_bad += 0 != g_test_run_suite_internal (suite, rest ? rest : "");
|
n_bad += g_test_run_suite_internal (suite, rest ? rest : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
return n_bad;
|
return n_bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1294,6 +1349,7 @@ gtest_default_log_handler (const gchar *log_domain,
|
|||||||
gboolean fatal = FALSE;
|
gboolean fatal = FALSE;
|
||||||
gchar *msg;
|
gchar *msg;
|
||||||
guint i = 0;
|
guint i = 0;
|
||||||
|
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
strv[i++] = log_domain;
|
strv[i++] = log_domain;
|
||||||
@@ -1321,9 +1377,11 @@ gtest_default_log_handler (const gchar *log_domain,
|
|||||||
strv[i++] = ": ";
|
strv[i++] = ": ";
|
||||||
strv[i++] = message;
|
strv[i++] = message;
|
||||||
strv[i++] = NULL;
|
strv[i++] = NULL;
|
||||||
|
|
||||||
msg = g_strjoinv ("", (gchar**) strv);
|
msg = g_strjoinv ("", (gchar**) strv);
|
||||||
g_test_log (fatal ? G_TEST_LOG_ERROR : G_TEST_LOG_MESSAGE, msg, NULL, 0, NULL);
|
g_test_log (fatal ? G_TEST_LOG_ERROR : G_TEST_LOG_MESSAGE, msg, NULL, 0, NULL);
|
||||||
g_log_default_handler (log_domain, log_level, message, unused_data);
|
g_log_default_handler (log_domain, log_level, message, unused_data);
|
||||||
|
|
||||||
g_free (msg);
|
g_free (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1336,6 +1394,7 @@ g_assertion_message (const char *domain,
|
|||||||
{
|
{
|
||||||
char lstr[32];
|
char lstr[32];
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (!message)
|
if (!message)
|
||||||
message = "code should not be reached";
|
message = "code should not be reached";
|
||||||
g_snprintf (lstr, 32, "%d", line);
|
g_snprintf (lstr, 32, "%d", line);
|
||||||
|
@@ -107,6 +107,8 @@ void g_test_add_func (const char *testpath,
|
|||||||
void g_test_add_data_func (const char *testpath,
|
void g_test_add_data_func (const char *testpath,
|
||||||
gconstpointer test_data,
|
gconstpointer test_data,
|
||||||
GTestDataFunc test_func);
|
GTestDataFunc test_func);
|
||||||
|
/* tell about failure */
|
||||||
|
void g_test_fail (void);
|
||||||
|
|
||||||
/* hook up a test with fixture under test path */
|
/* hook up a test with fixture under test path */
|
||||||
#define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
|
#define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
|
||||||
|
@@ -146,29 +146,41 @@ static GHashTable/*<string?, GTimeZone>*/ *time_zones;
|
|||||||
void
|
void
|
||||||
g_time_zone_unref (GTimeZone *tz)
|
g_time_zone_unref (GTimeZone *tz)
|
||||||
{
|
{
|
||||||
g_assert (tz->ref_count > 0);
|
int ref_count;
|
||||||
|
|
||||||
if (g_atomic_int_dec_and_test (&tz->ref_count))
|
again:
|
||||||
|
ref_count = g_atomic_int_get (&tz->ref_count);
|
||||||
|
|
||||||
|
g_assert (ref_count > 0);
|
||||||
|
|
||||||
|
if (ref_count == 1)
|
||||||
{
|
{
|
||||||
if G_UNLIKELY (tz == local_timezone)
|
if G_UNLIKELY (tz == local_timezone)
|
||||||
{
|
{
|
||||||
g_critical ("The last reference on the local timezone was just "
|
g_critical ("The last reference on the local timezone was just "
|
||||||
"dropped, but GTimeZone itself still owns one. This "
|
"dropped, but GTimeZone itself still owns one. This "
|
||||||
"means that g_time_zone_unref() was called too many "
|
"means that g_time_zone_unref() was called too many "
|
||||||
"times. Restoring the refcount to 1.");
|
"times. Returning without lowering the refcount.");
|
||||||
|
|
||||||
/* We don't want to just inc this back again since if there
|
/* We don't want to just inc this back again since if there
|
||||||
* are refcounting bugs in the code then maybe we are already
|
* are refcounting bugs in the code then maybe we are already
|
||||||
* at -1 and inc will just take us back to 0. Set to 1 to be
|
* at -1 and inc will just take us back to 0. Set to 1 to be
|
||||||
* sure.
|
* sure.
|
||||||
*/
|
*/
|
||||||
tz->ref_count = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tz->name != NULL)
|
if (tz->name != NULL)
|
||||||
{
|
{
|
||||||
G_LOCK(time_zones);
|
G_LOCK(time_zones);
|
||||||
|
|
||||||
|
/* someone else might have grabbed a ref in the meantime */
|
||||||
|
if G_UNLIKELY (g_atomic_int_get (&tz->ref_count) != 1)
|
||||||
|
{
|
||||||
|
G_UNLOCK(time_zones);
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
|
|
||||||
g_hash_table_remove (time_zones, tz->name);
|
g_hash_table_remove (time_zones, tz->name);
|
||||||
G_UNLOCK(time_zones);
|
G_UNLOCK(time_zones);
|
||||||
}
|
}
|
||||||
@@ -180,6 +192,11 @@ g_time_zone_unref (GTimeZone *tz)
|
|||||||
|
|
||||||
g_slice_free (GTimeZone, tz);
|
g_slice_free (GTimeZone, tz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if G_UNLIKELY (!g_atomic_int_compare_and_exchange (&tz->ref_count,
|
||||||
|
ref_count,
|
||||||
|
ref_count - 1))
|
||||||
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -594,27 +611,27 @@ interval_valid (GTimeZone *tz,
|
|||||||
/**
|
/**
|
||||||
* g_time_zone_adjust_time:
|
* g_time_zone_adjust_time:
|
||||||
* @tz: a #GTimeZone
|
* @tz: a #GTimeZone
|
||||||
* @type: the #GTimeType of @time
|
* @type: the #GTimeType of @time_
|
||||||
* @time: a pointer to a number of seconds since January 1, 1970
|
* @time_: a pointer to a number of seconds since January 1, 1970
|
||||||
*
|
*
|
||||||
* Finds an interval within @tz that corresponds to the given @time,
|
* Finds an interval within @tz that corresponds to the given @time_,
|
||||||
* possibly adjusting @time if required to fit into an interval.
|
* possibly adjusting @time_ if required to fit into an interval.
|
||||||
* The meaning of @time depends on @type.
|
* The meaning of @time_ depends on @type.
|
||||||
*
|
*
|
||||||
* This function is similar to g_time_zone_find_interval(), with the
|
* This function is similar to g_time_zone_find_interval(), with the
|
||||||
* difference that it always succeeds (by making the adjustments
|
* difference that it always succeeds (by making the adjustments
|
||||||
* described below).
|
* described below).
|
||||||
*
|
*
|
||||||
* In any of the cases where g_time_zone_find_interval() succeeds then
|
* In any of the cases where g_time_zone_find_interval() succeeds then
|
||||||
* this function returns the same value, without modifying @time.
|
* this function returns the same value, without modifying @time_.
|
||||||
*
|
*
|
||||||
* This function may, however, modify @time in order to deal with
|
* This function may, however, modify @time_ in order to deal with
|
||||||
* non-existent times. If the non-existent local @time of 02:30 were
|
* non-existent times. If the non-existent local @time_ of 02:30 were
|
||||||
* requested on March 13th 2010 in Toronto then this function would
|
* requested on March 13th 2010 in Toronto then this function would
|
||||||
* adjust @time to be 03:00 and return the interval containing the
|
* adjust @time_ to be 03:00 and return the interval containing the
|
||||||
* adjusted time.
|
* adjusted time.
|
||||||
*
|
*
|
||||||
* Returns: the interval containing @time, never -1
|
* Returns: the interval containing @time_, never -1
|
||||||
*
|
*
|
||||||
* Since: 2.26
|
* Since: 2.26
|
||||||
**/
|
**/
|
||||||
|
@@ -65,11 +65,11 @@ void g_time_zone_unref (GTimeZo
|
|||||||
|
|
||||||
gint g_time_zone_find_interval (GTimeZone *tz,
|
gint g_time_zone_find_interval (GTimeZone *tz,
|
||||||
GTimeType type,
|
GTimeType type,
|
||||||
gint64 time);
|
gint64 time_);
|
||||||
|
|
||||||
gint g_time_zone_adjust_time (GTimeZone *tz,
|
gint g_time_zone_adjust_time (GTimeZone *tz,
|
||||||
GTimeType type,
|
GTimeType type,
|
||||||
gint64 *time);
|
gint64 *time_);
|
||||||
|
|
||||||
const gchar * g_time_zone_get_abbreviation (GTimeZone *tz,
|
const gchar * g_time_zone_get_abbreviation (GTimeZone *tz,
|
||||||
gint interval);
|
gint interval);
|
||||||
|
@@ -2693,7 +2693,7 @@ g_variant_iter_free (GVariantIter *iter)
|
|||||||
* GVariantIter iter;
|
* GVariantIter iter;
|
||||||
* GVariant *child;
|
* GVariant *child;
|
||||||
*
|
*
|
||||||
* g_variant_iter_init (&iter, dictionary);
|
* g_variant_iter_init (&iter, container);
|
||||||
* while ((child = g_variant_iter_next_value (&iter)))
|
* while ((child = g_variant_iter_next_value (&iter)))
|
||||||
* {
|
* {
|
||||||
* g_print ("type '%s'\n", g_variant_get_type_string (child));
|
* g_print ("type '%s'\n", g_variant_get_type_string (child));
|
||||||
|
@@ -260,6 +260,8 @@ typedef struct _GVariantType GVariantType;
|
|||||||
*
|
*
|
||||||
* The type of a dictionary mapping strings to variants (the ubiquitous
|
* The type of a dictionary mapping strings to variants (the ubiquitous
|
||||||
* "a{sv}" type).
|
* "a{sv}" type).
|
||||||
|
*
|
||||||
|
* Since: 2.30
|
||||||
**/
|
**/
|
||||||
#define G_VARIANT_TYPE_VARDICT ((const GVariantType *) "a{sv}")
|
#define G_VARIANT_TYPE_VARDICT ((const GVariantType *) "a{sv}")
|
||||||
|
|
||||||
|
@@ -170,6 +170,13 @@ sort_LDADD = $(progs_ldadd)
|
|||||||
|
|
||||||
if OS_UNIX
|
if OS_UNIX
|
||||||
|
|
||||||
|
TEST_PROGS += unix
|
||||||
|
unix_LDADD = $(progs_ldadd)
|
||||||
|
|
||||||
|
TEST_PROGS += unix-nothreads
|
||||||
|
unix_nothreads_SOURCES = unix.c
|
||||||
|
unix_nothreads_LDADD = $(progs_ldadd)
|
||||||
|
|
||||||
# some testing of gtester funcitonality
|
# some testing of gtester funcitonality
|
||||||
XMLLINT=xmllint
|
XMLLINT=xmllint
|
||||||
gtester-xmllint-check: # check testreport xml with xmllint if present
|
gtester-xmllint-check: # check testreport xml with xmllint if present
|
||||||
|
@@ -1023,11 +1023,29 @@ test_all_dates (void)
|
|||||||
g_time_zone_unref (timezone);
|
g_time_zone_unref (timezone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_z (void)
|
||||||
|
{
|
||||||
|
GTimeZone *tz;
|
||||||
|
GDateTime *dt;
|
||||||
|
|
||||||
|
g_test_bug ("642935");
|
||||||
|
|
||||||
|
tz = g_time_zone_new ("-08:00");
|
||||||
|
dt = g_date_time_new (tz, 0, 0, 0, 0, 0, 0);
|
||||||
|
gchar *p = g_date_time_format (dt, "%z");
|
||||||
|
g_assert_cmpstr (p, ==, "-0800");
|
||||||
|
g_date_time_unref (dt);
|
||||||
|
g_free (p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
gint
|
gint
|
||||||
main (gint argc,
|
main (gint argc,
|
||||||
gchar *argv[])
|
gchar *argv[])
|
||||||
{
|
{
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
g_test_bug_base ("http://bugzilla.gnome.org/");
|
||||||
|
|
||||||
/* GDateTime Tests */
|
/* GDateTime Tests */
|
||||||
|
|
||||||
@@ -1065,6 +1083,7 @@ main (gint argc,
|
|||||||
g_test_add_func ("/GDateTime/to_utc", test_GDateTime_to_utc);
|
g_test_add_func ("/GDateTime/to_utc", test_GDateTime_to_utc);
|
||||||
g_test_add_func ("/GDateTime/now_utc", test_GDateTime_now_utc);
|
g_test_add_func ("/GDateTime/now_utc", test_GDateTime_now_utc);
|
||||||
g_test_add_func ("/GDateTime/dst", test_GDateTime_dst);
|
g_test_add_func ("/GDateTime/dst", test_GDateTime_dst);
|
||||||
|
g_test_add_func ("/GDateTime/test_z", test_z);
|
||||||
g_test_add_func ("/GDateTime/test-all-dates", test_all_dates);
|
g_test_add_func ("/GDateTime/test-all-dates", test_all_dates);
|
||||||
|
|
||||||
return g_test_run ();
|
return g_test_run ();
|
||||||
|
@@ -172,7 +172,8 @@ static void crcinit(void)
|
|||||||
int i, j;
|
int i, j;
|
||||||
guint sum;
|
guint sum;
|
||||||
|
|
||||||
for (i = 0; i < 128; ++i) {
|
for (i = 0; i < 128; ++i)
|
||||||
|
{
|
||||||
sum = 0L;
|
sum = 0L;
|
||||||
for (j = 7 - 1; j >= 0; --j)
|
for (j = 7 - 1; j >= 0; --j)
|
||||||
if (i & (1 << j))
|
if (i & (1 << j))
|
||||||
@@ -184,7 +185,8 @@ static void crcinit(void)
|
|||||||
/*
|
/*
|
||||||
- hash - Honeyman's nice hashing function
|
- hash - Honeyman's nice hashing function
|
||||||
*/
|
*/
|
||||||
static guint honeyman_hash(gconstpointer key)
|
static guint
|
||||||
|
honeyman_hash (gconstpointer key)
|
||||||
{
|
{
|
||||||
const gchar *name = (const gchar *) key;
|
const gchar *name = (const gchar *) key;
|
||||||
gint size;
|
gint size;
|
||||||
@@ -195,28 +197,30 @@ static guint honeyman_hash(gconstpointer key)
|
|||||||
|
|
||||||
size = strlen (name);
|
size = strlen (name);
|
||||||
|
|
||||||
while (size--) {
|
while (size--)
|
||||||
sum = (sum >> 7) ^ CrcTable[(sum ^ (*name++)) & 0x7f];
|
sum = (sum >> 7) ^ CrcTable[(sum ^ (*name++)) & 0x7f];
|
||||||
}
|
|
||||||
|
|
||||||
return(sum);
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean second_hash_cmp (gconstpointer a, gconstpointer b)
|
static gboolean
|
||||||
|
second_hash_cmp (gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
return (strcmp (a, b) == 0);
|
return strcmp (a, b) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static guint one_hash(gconstpointer key)
|
static guint
|
||||||
|
one_hash (gconstpointer key)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void not_even_foreach (gpointer key,
|
static void
|
||||||
|
not_even_foreach (gpointer key,
|
||||||
gpointer value,
|
gpointer value,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -240,7 +244,8 @@ static void not_even_foreach (gpointer key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean remove_even_foreach (gpointer key,
|
static gboolean
|
||||||
|
remove_even_foreach (gpointer key,
|
||||||
gpointer value,
|
gpointer value,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -265,7 +270,8 @@ static gboolean remove_even_foreach (gpointer key,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void second_hash_test (gconstpointer d)
|
static void
|
||||||
|
second_hash_test (gconstpointer d)
|
||||||
{
|
{
|
||||||
gboolean simple_hash = GPOINTER_TO_INT (d);
|
gboolean simple_hash = GPOINTER_TO_INT (d);
|
||||||
|
|
||||||
@@ -342,7 +348,8 @@ static void second_hash_test (gconstpointer d)
|
|||||||
g_hash_table_destroy (h);
|
g_hash_table_destroy (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean find_first (gpointer key,
|
static gboolean
|
||||||
|
find_first (gpointer key,
|
||||||
gpointer value,
|
gpointer value,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -352,7 +359,8 @@ static gboolean find_first (gpointer key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void direct_hash_test (void)
|
static void
|
||||||
|
direct_hash_test (void)
|
||||||
{
|
{
|
||||||
gint i, rc;
|
gint i, rc;
|
||||||
GHashTable *h;
|
GHashTable *h;
|
||||||
@@ -360,17 +368,14 @@ static void direct_hash_test (void)
|
|||||||
h = g_hash_table_new (NULL, NULL);
|
h = g_hash_table_new (NULL, NULL);
|
||||||
g_assert (h != NULL);
|
g_assert (h != NULL);
|
||||||
for (i = 1; i <= 20; i++)
|
for (i = 1; i <= 20; i++)
|
||||||
{
|
|
||||||
g_hash_table_insert (h, GINT_TO_POINTER (i),
|
g_hash_table_insert (h, GINT_TO_POINTER (i),
|
||||||
GINT_TO_POINTER (i + 42));
|
GINT_TO_POINTER (i + 42));
|
||||||
}
|
|
||||||
|
|
||||||
g_assert (g_hash_table_size (h) == 20);
|
g_assert (g_hash_table_size (h) == 20);
|
||||||
|
|
||||||
for (i = 1; i <= 20; i++)
|
for (i = 1; i <= 20; i++)
|
||||||
{
|
{
|
||||||
rc = GPOINTER_TO_INT (
|
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, GINT_TO_POINTER (i)));
|
||||||
g_hash_table_lookup (h, GINT_TO_POINTER (i)));
|
|
||||||
|
|
||||||
g_assert (rc != 0);
|
g_assert (rc != 0);
|
||||||
g_assert ((rc - 42) == i);
|
g_assert ((rc - 42) == i);
|
||||||
@@ -379,7 +384,8 @@ static void direct_hash_test (void)
|
|||||||
g_hash_table_destroy (h);
|
g_hash_table_destroy (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void int64_hash_test (void)
|
static void
|
||||||
|
int64_hash_test (void)
|
||||||
{
|
{
|
||||||
gint i, rc;
|
gint i, rc;
|
||||||
GHashTable *h;
|
GHashTable *h;
|
||||||
@@ -407,7 +413,8 @@ static void int64_hash_test (void)
|
|||||||
g_hash_table_destroy (h);
|
g_hash_table_destroy (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void double_hash_test (void)
|
static void
|
||||||
|
double_hash_test (void)
|
||||||
{
|
{
|
||||||
gint i, rc;
|
gint i, rc;
|
||||||
GHashTable *h;
|
GHashTable *h;
|
||||||
@@ -443,7 +450,8 @@ string_free (gpointer data)
|
|||||||
g_string_free (s, TRUE);
|
g_string_free (s, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void string_hash_test (void)
|
static void
|
||||||
|
string_hash_test (void)
|
||||||
{
|
{
|
||||||
gint i, rc;
|
gint i, rc;
|
||||||
GHashTable *h;
|
GHashTable *h;
|
||||||
@@ -648,6 +656,42 @@ test_lookup_null_key (void)
|
|||||||
g_hash_table_unref (h);
|
g_hash_table_unref (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint destroy_key_counter;
|
||||||
|
|
||||||
|
static void
|
||||||
|
key_destroy (gpointer key)
|
||||||
|
{
|
||||||
|
destroy_key_counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_remove_all (void)
|
||||||
|
{
|
||||||
|
GHashTable *h;
|
||||||
|
|
||||||
|
h = g_hash_table_new_full (g_str_hash, g_str_equal, key_destroy, value_destroy);
|
||||||
|
g_hash_table_insert (h, "abc", "ABC");
|
||||||
|
g_hash_table_insert (h, "cde", "CDE");
|
||||||
|
g_hash_table_insert (h, "xyz", "XYZ");
|
||||||
|
|
||||||
|
destroy_counter = 0;
|
||||||
|
destroy_key_counter = 0;
|
||||||
|
|
||||||
|
g_hash_table_steal_all (h);
|
||||||
|
g_assert_cmpint (destroy_counter, ==, 0);
|
||||||
|
g_assert_cmpint (destroy_key_counter, ==, 0);
|
||||||
|
|
||||||
|
g_hash_table_insert (h, "abc", "ABC");
|
||||||
|
g_hash_table_insert (h, "cde", "CDE");
|
||||||
|
g_hash_table_insert (h, "xyz", "XYZ");
|
||||||
|
|
||||||
|
g_hash_table_remove_all (h);
|
||||||
|
g_assert_cmpint (destroy_counter, ==, 3);
|
||||||
|
g_assert_cmpint (destroy_key_counter, ==, 3);
|
||||||
|
|
||||||
|
g_hash_table_unref (h);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -663,6 +707,7 @@ main (int argc, char *argv[])
|
|||||||
g_test_add_func ("/hash/double", double_hash_test);
|
g_test_add_func ("/hash/double", double_hash_test);
|
||||||
g_test_add_func ("/hash/string", string_hash_test);
|
g_test_add_func ("/hash/string", string_hash_test);
|
||||||
g_test_add_func ("/hash/ref", test_hash_ref);
|
g_test_add_func ("/hash/ref", test_hash_ref);
|
||||||
|
g_test_add_func ("/hash/remove-all", test_remove_all);
|
||||||
|
|
||||||
/* tests for individual bugs */
|
/* tests for individual bugs */
|
||||||
g_test_add_func ("/hash/lookup-null-key", test_lookup_null_key);
|
g_test_add_func ("/hash/lookup-null-key", test_lookup_null_key);
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
|
#include <config.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_empty (void)
|
test_empty (void)
|
||||||
@@ -8,7 +12,7 @@ test_empty (void)
|
|||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
file = g_mapped_file_new ("empty", FALSE, &error);
|
file = g_mapped_file_new (SRCDIR "/empty", FALSE, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
g_assert (g_mapped_file_get_contents (file) == NULL);
|
g_assert (g_mapped_file_get_contents (file) == NULL);
|
||||||
@@ -38,8 +42,14 @@ test_writable (void)
|
|||||||
const gchar *old = "MMMMMMMMMMMMMMMMMMMMMMMMM";
|
const gchar *old = "MMMMMMMMMMMMMMMMMMMMMMMMM";
|
||||||
const gchar *new = "abcdefghijklmnopqrstuvxyz";
|
const gchar *new = "abcdefghijklmnopqrstuvxyz";
|
||||||
|
|
||||||
|
if (access (SRCDIR "/4096-random-bytes", W_OK) != 0)
|
||||||
|
{
|
||||||
|
g_test_message ("Skipping writable mapping test");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
file = g_mapped_file_new ("4096-random-bytes", TRUE, &error);
|
file = g_mapped_file_new (SRCDIR "/4096-random-bytes", TRUE, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
contents = g_mapped_file_get_contents (file);
|
contents = g_mapped_file_get_contents (file);
|
||||||
@@ -51,7 +61,7 @@ test_writable (void)
|
|||||||
g_mapped_file_free (file);
|
g_mapped_file_free (file);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
file = g_mapped_file_new ("4096-random-bytes", TRUE, &error);
|
file = g_mapped_file_new (SRCDIR "/4096-random-bytes", TRUE, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
contents = g_mapped_file_get_contents (file);
|
contents = g_mapped_file_get_contents (file);
|
||||||
|
@@ -1210,6 +1210,35 @@ test_out_of_range_jump (void)
|
|||||||
|
|
||||||
g_assert (g_sequence_iter_is_begin (iter));
|
g_assert (g_sequence_iter_is_begin (iter));
|
||||||
g_assert (g_sequence_iter_is_end (iter));
|
g_assert (g_sequence_iter_is_end (iter));
|
||||||
|
|
||||||
|
g_sequence_free (seq);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_iter_move (void)
|
||||||
|
{
|
||||||
|
GSequence *seq = g_sequence_new (NULL);
|
||||||
|
GSequenceIter *iter;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
for (i = 0; i < 10; ++i)
|
||||||
|
g_sequence_append (seq, GINT_TO_POINTER (i));
|
||||||
|
|
||||||
|
iter = g_sequence_get_begin_iter (seq);
|
||||||
|
iter = g_sequence_iter_move (iter, 5);
|
||||||
|
g_assert_cmpint (GPOINTER_TO_INT (g_sequence_get (iter)), ==, 5);
|
||||||
|
|
||||||
|
iter = g_sequence_iter_move (iter, -10);
|
||||||
|
g_assert (g_sequence_iter_is_begin (iter));
|
||||||
|
|
||||||
|
iter = g_sequence_get_end_iter (seq);
|
||||||
|
iter = g_sequence_iter_move (iter, -5);
|
||||||
|
g_assert_cmpint (GPOINTER_TO_INT (g_sequence_get (iter)), ==, 5);
|
||||||
|
|
||||||
|
iter = g_sequence_iter_move (iter, 10);
|
||||||
|
g_assert (g_sequence_iter_is_end (iter));
|
||||||
|
|
||||||
|
g_sequence_free (seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1326,6 +1355,8 @@ test_stable_sort (void)
|
|||||||
iter = g_sequence_iter_next (iter);
|
iter = g_sequence_iter_next (iter);
|
||||||
g_sequence_check (seq);
|
g_sequence_check (seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_sequence_free (seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -1340,6 +1371,7 @@ main (int argc,
|
|||||||
|
|
||||||
/* Standalone tests */
|
/* Standalone tests */
|
||||||
g_test_add_func ("/sequence/out-of-range-jump", test_out_of_range_jump);
|
g_test_add_func ("/sequence/out-of-range-jump", test_out_of_range_jump);
|
||||||
|
g_test_add_func ("/sequence/iter-move", test_iter_move);
|
||||||
g_test_add_func ("/sequence/insert-sorted-non-pointer", test_insert_sorted_non_pointer);
|
g_test_add_func ("/sequence/insert-sorted-non-pointer", test_insert_sorted_non_pointer);
|
||||||
g_test_add_func ("/sequence/stable-sort", test_stable_sort);
|
g_test_add_func ("/sequence/stable-sort", test_stable_sort);
|
||||||
|
|
||||||
|
141
glib/tests/unix.c
Normal file
141
glib/tests/unix.c
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This work is provided "as is"; redistribution and modification
|
||||||
|
* in whole or in part, in any medium, physical or electronic is
|
||||||
|
* permitted without restriction.
|
||||||
|
*
|
||||||
|
* This work is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* In no event shall the authors or contributors be liable for any
|
||||||
|
* direct, indirect, incidental, special, exemplary, or consequential
|
||||||
|
* damages (including, but not limited to, procurement of substitute
|
||||||
|
* goods or services; loss of use, data, or profits; or business
|
||||||
|
* interruption) however caused and on any theory of liability, whether
|
||||||
|
* in contract, strict liability, or tort (including negligence or
|
||||||
|
* otherwise) arising in any way out of the use of this software, even
|
||||||
|
* if advised of the possibility of such damage.
|
||||||
|
*
|
||||||
|
* Author: Colin Walters <walters@verbum.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "glib-unix.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_pipe (void)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
int pipefd[2];
|
||||||
|
char buf[1024];
|
||||||
|
ssize_t bytes_read;
|
||||||
|
|
||||||
|
g_unix_pipe_flags (pipefd, FD_CLOEXEC, NULL);
|
||||||
|
g_assert_no_error (error);
|
||||||
|
|
||||||
|
write (pipefd[1], "hello", sizeof ("hello"));
|
||||||
|
memset (buf, 0, sizeof (buf));
|
||||||
|
bytes_read = read (pipefd[0], buf, sizeof(buf) - 1);
|
||||||
|
g_assert_cmpint (bytes_read, >, 0);
|
||||||
|
|
||||||
|
close (pipefd[0]);
|
||||||
|
close (pipefd[1]);
|
||||||
|
|
||||||
|
g_assert (g_str_has_prefix (buf, "hello"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean sighup_received = FALSE;
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
on_sighup_received (gpointer user_data)
|
||||||
|
{
|
||||||
|
GMainLoop *loop = user_data;
|
||||||
|
g_main_loop_quit (loop);
|
||||||
|
sighup_received = TRUE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
sighup_not_received (gpointer data)
|
||||||
|
{
|
||||||
|
GMainLoop *loop = data;
|
||||||
|
(void) loop;
|
||||||
|
g_error ("Timed out waiting for SIGHUP");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
exit_mainloop (gpointer data)
|
||||||
|
{
|
||||||
|
GMainLoop *loop = data;
|
||||||
|
g_main_loop_quit (loop);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_sighup (void)
|
||||||
|
{
|
||||||
|
GMainLoop *mainloop;
|
||||||
|
|
||||||
|
mainloop = g_main_loop_new (NULL, FALSE);
|
||||||
|
|
||||||
|
sighup_received = FALSE;
|
||||||
|
g_unix_signal_add_watch_full (SIGHUP,
|
||||||
|
G_PRIORITY_DEFAULT,
|
||||||
|
on_sighup_received,
|
||||||
|
mainloop,
|
||||||
|
NULL);
|
||||||
|
kill (getpid (), SIGHUP);
|
||||||
|
g_assert (!sighup_received);
|
||||||
|
g_timeout_add (5000, sighup_not_received, mainloop);
|
||||||
|
g_main_loop_run (mainloop);
|
||||||
|
g_assert (sighup_received);
|
||||||
|
sighup_received = FALSE;
|
||||||
|
|
||||||
|
/* Ensure we don't get double delivery */
|
||||||
|
g_timeout_add (500, exit_mainloop, mainloop);
|
||||||
|
g_main_loop_run (mainloop);
|
||||||
|
g_assert (!sighup_received);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_sighup_add_remove (void)
|
||||||
|
{
|
||||||
|
GMainLoop *mainloop;
|
||||||
|
guint id;
|
||||||
|
|
||||||
|
mainloop = g_main_loop_new (NULL, FALSE);
|
||||||
|
|
||||||
|
sighup_received = FALSE;
|
||||||
|
id = g_unix_signal_add_watch_full (SIGHUP,
|
||||||
|
G_PRIORITY_DEFAULT,
|
||||||
|
on_sighup_received,
|
||||||
|
mainloop,
|
||||||
|
NULL);
|
||||||
|
g_source_remove (id);
|
||||||
|
kill (getpid (), SIGHUP);
|
||||||
|
g_assert (!sighup_received);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc,
|
||||||
|
char *argv[])
|
||||||
|
{
|
||||||
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
|
#ifdef TEST_THREADED
|
||||||
|
g_thread_init (NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
g_test_add_func ("/glib-unix/pipe", test_pipe);
|
||||||
|
g_test_add_func ("/glib-unix/sighup", test_sighup);
|
||||||
|
g_test_add_func ("/glib-unix/sighup_again", test_sighup);
|
||||||
|
g_test_add_func ("/glib-unix/sighup_add_remove", test_sighup_add_remove);
|
||||||
|
|
||||||
|
return g_test_run();
|
||||||
|
}
|
@@ -13,3 +13,8 @@ TEST_PROGS += 1bit-emufutex
|
|||||||
1bit_emufutex_SOURCES = 1bit-mutex.c
|
1bit_emufutex_SOURCES = 1bit-mutex.c
|
||||||
1bit_emufutex_CFLAGS = -DTEST_EMULATED_FUTEX
|
1bit_emufutex_CFLAGS = -DTEST_EMULATED_FUTEX
|
||||||
1bit_emufutex_LDADD = $(progs_ldadd) $(top_builddir)/gthread/libgthread-2.0.la
|
1bit_emufutex_LDADD = $(progs_ldadd) $(top_builddir)/gthread/libgthread-2.0.la
|
||||||
|
|
||||||
|
TEST_PROGS += unix-multithreaded
|
||||||
|
unix_multithreaded_SOURCES = $(top_srcdir)/glib/tests/unix.c
|
||||||
|
unix_multithreaded_CFLAGS = -DTEST_THREADED
|
||||||
|
unix_multithreaded_LDADD = $(progs_ldadd) $(top_builddir)/gthread/libgthread-2.0.la
|
||||||
|
Reference in New Issue
Block a user