mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 07:56:17 +01:00
Merge branch 'master' into gdbus-codegen
This commit is contained in:
commit
0e352fdb18
88
NEWS
88
NEWS
@ -1,29 +1,107 @@
|
||||
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
|
||||
match strcmp() semantics
|
||||
* 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
|
||||
- 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
|
||||
|
||||
* 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:
|
||||
635099 Memory leak in gdbus introspection when parsing xml
|
||||
640489 $ and ^ do not match lines if G_REGEX_MULTILINE|G_R...
|
||||
642042 Overriding GDBus org.freedesktop.DBus.Properties im...
|
||||
642052 g_timeout_add(_seconds) cannot handle large intervals
|
||||
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
|
||||
Afrikaans
|
||||
Bulgarian
|
||||
Bengali India
|
||||
Korean
|
||||
Polish
|
||||
British English
|
||||
Bulgarian
|
||||
Catalan
|
||||
Czech
|
||||
Danish
|
||||
French
|
||||
Galician
|
||||
German
|
||||
Greek
|
||||
Gujarati
|
||||
Hebrew
|
||||
Hungarian
|
||||
Italian
|
||||
Japanese
|
||||
Korean
|
||||
Lithuanian
|
||||
Polish
|
||||
Portuguese
|
||||
Romanian
|
||||
Serbian
|
||||
Simplified Chinese
|
||||
Spanish
|
||||
Swedish
|
||||
Traditional Chinese
|
||||
Uighur
|
||||
Vietnamese
|
||||
|
||||
|
||||
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/
|
||||
|
||||
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
|
||||
(Send mail to gtk-list-request@gnome.org with the subject "subscribe")
|
||||
|
@ -26,4 +26,8 @@ EXTRA_DIST = \
|
||||
gio.vcxproj.filtersin \
|
||||
testglib.vcxproj \
|
||||
testglib.vcxproj.filters \
|
||||
glib-compile-schemas.vcxproj \
|
||||
glib-compile-schemas.vcxproj.filters \
|
||||
gsettings.vcxproj \
|
||||
gsettings.vcxproj.filters \
|
||||
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\glib-compile-schemas.exe $(CopyDir)\bin
|
||||
|
||||
copy $(SolutionDir)$(Configuration)\$(Platform)\bin\gsettings.exe $(CopyDir)\bin
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
mkdir $(CopyDir)\share\glib-2.0\schemas
|
||||
copy ..\..\..\gio\gschema.dtd $(CopyDir)\share\glib-2.0\schemas
|
||||
|
||||
</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>
|
||||
<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
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testglib", "testglib.vcxproj", "{64E09909-5599-40C0-B808-27F55F7B823C}"
|
||||
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}"
|
||||
EndProject
|
||||
Global
|
||||
@ -176,6 +180,38 @@ Global
|
||||
{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.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.Build.0 = Debug|Win32
|
||||
{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.vcprojin \
|
||||
testglib.vcproj \
|
||||
glib-compile-schemas.vcproj \
|
||||
gsettings.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}
|
||||
EndProjectSection
|
||||
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}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{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}
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753} = {F172EFFC-E30F-4593-809E-DB2024B1E753}
|
||||
{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
|
||||
EndProject
|
||||
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|x64.ActiveCfg = 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.Build.0 = Debug|Win32
|
||||
{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

|
||||
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\glib-compile-schemas.exe $(OutDir)\bin

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

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

|
||||
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

|
||||
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
|
||||
|
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_minor_version], [29])
|
||||
m4_define([glib_micro_version], [2])
|
||||
m4_define([glib_micro_version], [3])
|
||||
m4_define([glib_interface_age], [0])
|
||||
m4_define([glib_binary_age],
|
||||
[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(atexit on_exit timegm gmtime_r)
|
||||
# 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([[
|
||||
#define _GNU_SOURCE
|
||||
#include <stdlib.h>
|
||||
@ -609,9 +609,9 @@ main (int argc, char **argv)
|
||||
return 0;
|
||||
else
|
||||
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_DEFINE(HAVE_QSORT_R, 1, [Define to 1 if you have the 'qsort_r' function])
|
||||
else
|
||||
|
@ -1400,6 +1400,8 @@ g_desktop_app_info_new
|
||||
g_desktop_app_info_get_filename
|
||||
g_desktop_app_info_get_is_hidden
|
||||
g_desktop_app_info_set_desktop_env
|
||||
GDesktopAppLaunchCallback
|
||||
g_desktop_app_info_launch_uris_as_manager
|
||||
<SUBSECTION Standard>
|
||||
GDesktopAppInfoClass
|
||||
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_any
|
||||
g_inet_address_new_loopback
|
||||
g_inet_address_equal
|
||||
g_inet_address_to_bytes
|
||||
g_inet_address_get_native_size
|
||||
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>KEY</replaceable></arg>
|
||||
</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>
|
||||
<command>gsettings</command>
|
||||
<arg choice="plain">list-schemas</arg>
|
||||
@ -151,6 +156,13 @@ Resets <replaceable>KEY</replaceable> to its default value.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>reset-recursively</option></term>
|
||||
<listitem><para>
|
||||
Reset all keys under the given <replaceable>SCHEMA</replaceable>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>list-schemas</option></term>
|
||||
<listitem><para>
|
||||
|
@ -109,6 +109,15 @@ chmod a-w win32.cache # prevent configure from changing it
|
||||
built-in version in that case.
|
||||
</para>
|
||||
</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>
|
||||
<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/bookmarkfile.xml" />
|
||||
<xi:include href="xml/testing.xml" />
|
||||
<xi:include href="xml/gunix.xml" />
|
||||
<xi:include href="xml/windows.xml" />
|
||||
</chapter>
|
||||
|
||||
@ -199,6 +200,10 @@ synchronize their operation.
|
||||
<title>Index of new symbols in 2.28</title>
|
||||
<xi:include href="xml/api-index-2.28.xml"><xi:fallback /></xi:include>
|
||||
</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>
|
||||
|
||||
|
@ -840,11 +840,6 @@ g_io_channel_set_encoding
|
||||
g_io_channel_get_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>
|
||||
g_io_channel_read
|
||||
GIOError
|
||||
@ -853,6 +848,9 @@ g_io_channel_seek
|
||||
g_io_channel_close
|
||||
|
||||
<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_watch_funcs
|
||||
</SECTION>
|
||||
@ -1926,6 +1924,16 @@ g_win32_ftruncate
|
||||
|
||||
</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
|
||||
|
||||
<SECTION>
|
||||
@ -2800,6 +2808,7 @@ GTestDataFunc
|
||||
g_test_add_data_func
|
||||
g_test_add
|
||||
|
||||
g_test_fail
|
||||
g_test_message
|
||||
g_test_bug_base
|
||||
g_test_bug
|
||||
|
@ -141,7 +141,9 @@ g_action_group_default_init (GActionGroupInterface *class)
|
||||
g_action_group_signals[SIGNAL_ACTION_STATE_CHANGED] =
|
||||
g_signal_new (I_("action-state-changed"),
|
||||
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,
|
||||
action_state_changed),
|
||||
NULL, NULL,
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gapplicationcommandline.h"
|
||||
#include "gapplicationimpl.h"
|
||||
#include "gactiongroup.h"
|
||||
#include "gsettings.h"
|
||||
|
||||
#include "gioenumtypes.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_param_spec_uint ("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,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
@ -1006,14 +1007,17 @@ g_application_register (GApplication *application,
|
||||
|
||||
if (!application->priv->is_registered)
|
||||
{
|
||||
application->priv->impl =
|
||||
g_application_impl_register (application, application->priv->id,
|
||||
application->priv->flags,
|
||||
&application->priv->remote_actions,
|
||||
cancellable, error);
|
||||
if (~application->priv->flags & G_APPLICATION_NON_UNIQUE)
|
||||
{
|
||||
application->priv->impl =
|
||||
g_application_impl_register (application, application->priv->id,
|
||||
application->priv->flags,
|
||||
&application->priv->remote_actions,
|
||||
cancellable, error);
|
||||
|
||||
if (application->priv->impl == NULL)
|
||||
return FALSE;
|
||||
if (application->priv->impl == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
application->priv->is_remote = application->priv->remote_actions != NULL;
|
||||
application->priv->is_registered = TRUE;
|
||||
@ -1326,6 +1330,8 @@ g_application_run (GApplication *application,
|
||||
if (application->priv->impl)
|
||||
g_application_impl_flush (application->priv->impl);
|
||||
|
||||
g_settings_sync ();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -659,6 +659,9 @@ g_application_impl_register (GApplication *application,
|
||||
g_dbus_connection_unregister_object (impl->session_bus,
|
||||
impl->object_id);
|
||||
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)
|
||||
{
|
||||
|
@ -258,25 +258,13 @@ is_valid_nonce_tcp (const gchar *address_entry,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (nonce_file == NULL)
|
||||
if (host != NULL)
|
||||
{
|
||||
g_set_error (error,
|
||||
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;
|
||||
/* TODO: validate host */
|
||||
}
|
||||
|
||||
nonce_file = nonce_file; /* To avoid -Wunused-but-set-variable */
|
||||
|
||||
ret= TRUE;
|
||||
|
||||
out:
|
||||
@ -351,14 +339,9 @@ is_valid_tcp (const gchar *address_entry,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (host == NULL)
|
||||
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;
|
||||
/* TODO: validate host */
|
||||
}
|
||||
|
||||
ret= TRUE;
|
||||
|
@ -663,7 +663,8 @@ _g_dbus_auth_run_client (GDBusAuth *auth,
|
||||
if (line == NULL)
|
||||
goto out;
|
||||
debug_print ("CLIENT: WaitingForReject, read '%s'", line);
|
||||
foobar:
|
||||
|
||||
choose_mechanism:
|
||||
if (!g_str_has_prefix (line, "REJECTED "))
|
||||
{
|
||||
g_set_error (error,
|
||||
@ -739,7 +740,7 @@ _g_dbus_auth_run_client (GDBusAuth *auth,
|
||||
}
|
||||
else if (g_str_has_prefix (line, "REJECTED "))
|
||||
{
|
||||
goto foobar;
|
||||
goto choose_mechanism;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -841,6 +842,13 @@ _g_dbus_auth_run_client (GDBusAuth *auth,
|
||||
}
|
||||
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
|
||||
{
|
||||
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 (!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->state = G_DBUS_AUTH_MECHANISM_STATE_ACCEPTED;
|
||||
|
@ -652,6 +652,7 @@ keyring_generate_entry (const gchar *cookie_context,
|
||||
lines = NULL;
|
||||
new_contents = NULL;
|
||||
have_id = FALSE;
|
||||
use_id = 0;
|
||||
use_cookie = NULL;
|
||||
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_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 (error == NULL || *error == NULL, NULL);
|
||||
|
||||
@ -2264,15 +2264,20 @@ initable_init (GInitable *initable,
|
||||
|
||||
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->stream != NULL)
|
||||
ret = TRUE;
|
||||
else
|
||||
g_assert (connection->initialization_error != NULL);
|
||||
ret = TRUE;
|
||||
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
|
||||
* properties:
|
||||
|
@ -3197,8 +3197,8 @@ g_dbus_message_lock (GDBusMessage *message)
|
||||
* This operation can fail if e.g. @message contains file descriptors
|
||||
* 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
|
||||
* g_object_unref().
|
||||
* Returns: (transfer full): A new #GDBusMessage or %NULL if @error is set.
|
||||
* Free with g_object_unref().
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -3212,7 +3212,7 @@ g_dbus_message_copy (GDBusMessage *message,
|
||||
GVariant *header_value;
|
||||
|
||||
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->type = message->type;
|
||||
@ -3255,4 +3255,3 @@ g_dbus_message_copy (GDBusMessage *message,
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -399,10 +399,10 @@ struct GDBusWorker
|
||||
* only user) - we might want it to affect messages sent to the other peer too?
|
||||
*/
|
||||
gboolean frozen;
|
||||
GDBusCapabilityFlags capabilities;
|
||||
GQueue *received_messages_while_frozen;
|
||||
|
||||
GIOStream *stream;
|
||||
GDBusCapabilityFlags capabilities;
|
||||
GCancellable *cancellable;
|
||||
GDBusWorkerMessageReceivedCallback message_received_callback;
|
||||
GDBusWorkerMessageAboutToBeSentCallback message_about_to_be_sent_callback;
|
||||
@ -425,9 +425,9 @@ struct GDBusWorker
|
||||
gint read_num_ancillary_messages;
|
||||
|
||||
/* used for writing */
|
||||
gint num_writes_pending;
|
||||
GMutex *write_lock;
|
||||
GQueue *write_queue;
|
||||
gint num_writes_pending;
|
||||
guint64 write_num_messages_written;
|
||||
GList *write_pending_flushes;
|
||||
gboolean flush_pending;
|
||||
|
@ -83,9 +83,9 @@
|
||||
struct _GDBusProxyPrivate
|
||||
{
|
||||
GBusType bus_type;
|
||||
GDBusProxyFlags flags;
|
||||
GDBusConnection *connection;
|
||||
|
||||
GDBusProxyFlags flags;
|
||||
gchar *name;
|
||||
gchar *name_owner;
|
||||
gchar *object_path;
|
||||
@ -505,7 +505,7 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
|
||||
*/
|
||||
signals[PROPERTIES_CHANGED_SIGNAL] = g_signal_new ("g-properties-changed",
|
||||
G_TYPE_DBUS_PROXY,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
|
||||
G_STRUCT_OFFSET (GDBusProxyClass, g_properties_changed),
|
||||
NULL,
|
||||
NULL,
|
||||
@ -528,7 +528,7 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
|
||||
*/
|
||||
signals[SIGNAL_SIGNAL] = g_signal_new ("g-signal",
|
||||
G_TYPE_DBUS_PROXY,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
|
||||
G_STRUCT_OFFSET (GDBusProxyClass, g_signal),
|
||||
NULL,
|
||||
NULL,
|
||||
@ -1037,14 +1037,13 @@ on_name_owner_changed (GDBusConnection *connection,
|
||||
g_hash_table_size (proxy->priv->properties) > 0)
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
GVariant *changed_properties;
|
||||
GPtrArray *invalidated_properties;
|
||||
GHashTableIter iter;
|
||||
const gchar *key;
|
||||
|
||||
/* Build changed_properties (always empty) and invalidated_properties ... */
|
||||
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);
|
||||
g_hash_table_iter_init (&iter, proxy->priv->properties);
|
||||
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 */
|
||||
g_signal_emit (proxy, signals[PROPERTIES_CHANGED_SIGNAL],
|
||||
0,
|
||||
changed_properties,
|
||||
g_variant_builder_end (&builder) /* consumed */,
|
||||
(const gchar* const *) invalidated_properties->pdata);
|
||||
g_variant_unref (changed_properties);
|
||||
g_ptr_array_unref (invalidated_properties);
|
||||
}
|
||||
g_object_notify (G_OBJECT (proxy), "g-name-owner");
|
||||
|
@ -63,7 +63,13 @@
|
||||
* @include: gio/gio.h
|
||||
*
|
||||
* #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>
|
||||
*/
|
||||
@ -979,11 +985,16 @@ on_run (GSocketService *service,
|
||||
|
||||
if (server->flags & G_DBUS_SERVER_FLAGS_RUN_IN_THREAD)
|
||||
{
|
||||
gboolean claimed;
|
||||
|
||||
claimed = FALSE;
|
||||
g_signal_emit (server,
|
||||
_signals[NEW_CONNECTION_SIGNAL],
|
||||
0,
|
||||
connection);
|
||||
g_dbus_connection_start_message_processing (connection);
|
||||
connection,
|
||||
&claimed);
|
||||
if (claimed)
|
||||
g_dbus_connection_start_message_processing (connection);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
else
|
||||
|
@ -64,8 +64,14 @@
|
||||
#define ADDED_ASSOCIATIONS_GROUP "Added Associations"
|
||||
#define REMOVED_ASSOCIATIONS_GROUP "Removed Associations"
|
||||
#define MIME_CACHE_GROUP "MIME Cache"
|
||||
#define GENERIC_NAME_KEY "GenericName"
|
||||
#define FULL_NAME_KEY "X-GNOME-FullName"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_FILENAME
|
||||
};
|
||||
|
||||
static void g_desktop_app_info_iface_init (GAppInfoIface *iface);
|
||||
static GList * get_all_desktop_entries_for_mime_type (const char *base_mime_type,
|
||||
const char **except,
|
||||
@ -88,7 +94,7 @@ struct _GDesktopAppInfo
|
||||
char *filename;
|
||||
|
||||
char *name;
|
||||
/* FIXME: what about GenericName ? */
|
||||
char *generic_name;
|
||||
char *fullname;
|
||||
char *comment;
|
||||
char *icon_name;
|
||||
@ -99,6 +105,7 @@ struct _GDesktopAppInfo
|
||||
char *exec;
|
||||
char *binary;
|
||||
char *path;
|
||||
char *categories;
|
||||
|
||||
guint nodisplay : 1;
|
||||
guint hidden : 1;
|
||||
@ -161,6 +168,7 @@ g_desktop_app_info_finalize (GObject *object)
|
||||
g_free (info->desktop_id);
|
||||
g_free (info->filename);
|
||||
g_free (info->name);
|
||||
g_free (info->generic_name);
|
||||
g_free (info->fullname);
|
||||
g_free (info->comment);
|
||||
g_free (info->icon_name);
|
||||
@ -172,16 +180,69 @@ g_desktop_app_info_finalize (GObject *object)
|
||||
g_free (info->exec);
|
||||
g_free (info->binary);
|
||||
g_free (info->path);
|
||||
g_free (info->categories);
|
||||
|
||||
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
|
||||
g_desktop_app_info_class_init (GDesktopAppInfoClass *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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -205,29 +266,19 @@ binary_from_exec (const char *exec)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
static gboolean
|
||||
g_desktop_app_info_load_from_keyfile (GDesktopAppInfo *info,
|
||||
GKeyFile *key_file)
|
||||
{
|
||||
GDesktopAppInfo *info;
|
||||
char *start_group;
|
||||
char *type;
|
||||
char *try_exec;
|
||||
|
||||
|
||||
start_group = g_key_file_get_start_group (key_file);
|
||||
if (start_group == NULL || strcmp (start_group, G_KEY_FILE_DESKTOP_GROUP) != 0)
|
||||
{
|
||||
g_free (start_group);
|
||||
return NULL;
|
||||
return FALSE;
|
||||
}
|
||||
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)
|
||||
{
|
||||
g_free (type);
|
||||
return NULL;
|
||||
return FALSE;
|
||||
}
|
||||
g_free (type);
|
||||
|
||||
@ -253,15 +304,13 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
||||
if (t == NULL)
|
||||
{
|
||||
g_free (try_exec);
|
||||
return NULL;
|
||||
return FALSE;
|
||||
}
|
||||
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->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->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;
|
||||
@ -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->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->categories = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_CATEGORIES, NULL);
|
||||
|
||||
info->icon = NULL;
|
||||
if (info->icon_name)
|
||||
@ -311,6 +361,53 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -325,23 +422,14 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
|
||||
GDesktopAppInfo *
|
||||
g_desktop_app_info_new_from_filename (const char *filename)
|
||||
{
|
||||
GKeyFile *key_file;
|
||||
GDesktopAppInfo *info = NULL;
|
||||
|
||||
key_file = g_key_file_new ();
|
||||
|
||||
if (g_key_file_load_from_file (key_file,
|
||||
filename,
|
||||
G_KEY_FILE_NONE,
|
||||
NULL))
|
||||
info = g_object_new (G_TYPE_DESKTOP_APP_INFO, "filename", filename, NULL);
|
||||
if (!g_desktop_app_info_load_file (info))
|
||||
{
|
||||
info = g_desktop_app_info_new_from_keyfile (key_file);
|
||||
if (info)
|
||||
info->filename = g_strdup (filename);
|
||||
}
|
||||
|
||||
g_key_file_free (key_file);
|
||||
|
||||
g_object_unref (info);
|
||||
return NULL;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@ -430,6 +518,7 @@ g_desktop_app_info_dup (GAppInfo *appinfo)
|
||||
new_info->desktop_id = g_strdup (info->desktop_id);
|
||||
|
||||
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->comment = g_strdup (info->comment);
|
||||
new_info->nodisplay = info->nodisplay;
|
||||
@ -555,6 +644,31 @@ g_desktop_app_info_get_icon (GAppInfo *appinfo)
|
||||
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 *
|
||||
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_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)
|
||||
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
|
||||
FULL_NAME_KEY, info->fullname);
|
||||
@ -1932,10 +2050,10 @@ g_app_info_create_from_commandline (const char *commandline,
|
||||
info->filename = NULL;
|
||||
info->desktop_id = NULL;
|
||||
|
||||
info->terminal = flags & G_APP_INFO_CREATE_NEEDS_TERMINAL;
|
||||
info->startup_notify = flags & G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION;
|
||||
info->terminal = (flags & G_APP_INFO_CREATE_NEEDS_TERMINAL) != 0;
|
||||
info->startup_notify = (flags & G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION) != 0;
|
||||
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);
|
||||
else
|
||||
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_generic_name (GDesktopAppInfo *info);
|
||||
const char * g_desktop_app_info_get_categories (GDesktopAppInfo *info);
|
||||
|
||||
GDesktopAppInfo *g_desktop_app_info_new (const char *desktop_id);
|
||||
gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
|
||||
|
||||
|
@ -2096,12 +2096,13 @@ typedef struct {
|
||||
struct _GFileAttributeMatcher {
|
||||
gboolean all;
|
||||
SubMatcher sub_matchers[ON_STACK_MATCHERS];
|
||||
gint ref;
|
||||
|
||||
GArray *more_sub_matchers;
|
||||
|
||||
/* Interator */
|
||||
guint32 iterator_ns;
|
||||
int iterator_pos;
|
||||
int ref;
|
||||
gint iterator_pos;
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -64,8 +64,8 @@ struct _GFilenameCompleter {
|
||||
|
||||
GFile *basenames_dir;
|
||||
gboolean basenames_are_escaped;
|
||||
GList *basenames;
|
||||
gboolean dirs_only;
|
||||
GList *basenames;
|
||||
|
||||
LoadBasenamesData *basename_loader;
|
||||
};
|
||||
|
@ -113,7 +113,7 @@ g_filter_input_stream_class_init (GFilterInputStreamClass *klass)
|
||||
g_param_spec_boolean ("close-base-stream",
|
||||
P_("Close Base Stream"),
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -866,3 +866,32 @@ g_inet_address_get_is_mc_site_local (GInetAddress *address)
|
||||
else
|
||||
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);
|
||||
|
||||
gboolean g_inet_address_equal (GInetAddress *address,
|
||||
GInetAddress *other_address);
|
||||
|
||||
gchar * g_inet_address_to_string (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_keyfile
|
||||
g_desktop_app_info_new
|
||||
g_desktop_app_info_get_categories
|
||||
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_type G_GNUC_CONST
|
||||
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_get_native_size
|
||||
g_inet_address_to_string
|
||||
g_inet_address_equal
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -1265,6 +1265,11 @@ typedef enum
|
||||
* when editing a git commit message. The environment is available
|
||||
* to the #GApplication::command-line signal handler, via
|
||||
* 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.
|
||||
*
|
||||
@ -1278,7 +1283,9 @@ typedef enum
|
||||
|
||||
G_APPLICATION_HANDLES_OPEN = (1 << 2),
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -51,11 +51,10 @@ struct _GIOSchedulerJob {
|
||||
GSourceFunc cancel_func; /* Runs under job map lock */
|
||||
gpointer data;
|
||||
GDestroyNotify destroy_notify;
|
||||
|
||||
gint io_priority;
|
||||
GCancellable *cancellable;
|
||||
GMainContext *context;
|
||||
|
||||
gint io_priority;
|
||||
guint idle_tag;
|
||||
};
|
||||
|
||||
|
@ -24,13 +24,16 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <gstdio.h>
|
||||
#include <locale.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.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 "strinfo.c"
|
||||
|
||||
|
@ -47,8 +47,8 @@ struct _GLocalDirectoryMonitor
|
||||
gchar *dirname;
|
||||
GFileMonitorFlags flags;
|
||||
/* For mount emulation */
|
||||
GUnixMountMonitor *mount_monitor;
|
||||
gboolean was_mounted;
|
||||
GUnixMountMonitor *mount_monitor;
|
||||
};
|
||||
|
||||
struct _GLocalDirectoryMonitorClass
|
||||
|
@ -1297,8 +1297,8 @@ g_local_file_read (GFile *file,
|
||||
GError **error)
|
||||
{
|
||||
GLocalFile *local = G_LOCAL_FILE (file);
|
||||
int fd;
|
||||
struct stat buf;
|
||||
int fd, ret;
|
||||
GLocalFileStat buf;
|
||||
|
||||
fd = g_open (local->filename, O_RDONLY|O_BINARY, 0);
|
||||
if (fd == -1)
|
||||
@ -1312,7 +1312,13 @@ g_local_file_read (GFile *file,
|
||||
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);
|
||||
g_set_error_literal (error, G_IO_ERROR,
|
||||
|
@ -1883,7 +1883,7 @@ set_unix_mode (char *filename,
|
||||
const GFileAttributeValue *value,
|
||||
GError **error)
|
||||
{
|
||||
guint32 val;
|
||||
guint32 val = 0;
|
||||
int res = 0;
|
||||
|
||||
if (!get_uint32 (value, &val, error))
|
||||
@ -1934,7 +1934,7 @@ set_unix_uid_gid (char *filename,
|
||||
GError **error)
|
||||
{
|
||||
int res;
|
||||
guint32 val;
|
||||
guint32 val = 0;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
|
||||
@ -2070,8 +2070,8 @@ set_mtime_atime (char *filename,
|
||||
GError **error)
|
||||
{
|
||||
int res;
|
||||
guint64 val;
|
||||
guint32 val_usec;
|
||||
guint64 val = 0;
|
||||
guint32 val_usec = 0;
|
||||
struct stat statbuf;
|
||||
gboolean got_stat = FALSE;
|
||||
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 */
|
||||
if (fstat (tmpfd, &tmp_statbuf) != 0 ||
|
||||
if (tres != 0 ||
|
||||
original_stat.st_uid != tmp_statbuf.st_uid ||
|
||||
original_stat.st_gid != tmp_statbuf.st_gid ||
|
||||
original_stat.st_mode != tmp_statbuf.st_mode)
|
||||
|
@ -212,6 +212,36 @@ g_resolver_maybe_reload (GResolver *resolver)
|
||||
#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:
|
||||
* @resolver: a #GResolver
|
||||
@ -225,9 +255,12 @@ g_resolver_maybe_reload (GResolver *resolver)
|
||||
* a wrapper around g_inet_address_new_from_string()).
|
||||
*
|
||||
* On success, g_resolver_lookup_by_name() will return a #GList of
|
||||
* #GInetAddress, sorted in order of preference. (That is, you should
|
||||
* attempt to connect to the first address first, then the second if
|
||||
* the first fails, etc.)
|
||||
* #GInetAddress, sorted in order of preference and guaranteed to not
|
||||
* contain duplicates. That is, if using the result to connect to
|
||||
* @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
|
||||
* value from #GResolverError.
|
||||
@ -272,6 +305,8 @@ g_resolver_lookup_by_name (GResolver *resolver,
|
||||
addrs = G_RESOLVER_GET_CLASS (resolver)->
|
||||
lookup_by_name (resolver, hostname, cancellable, error);
|
||||
|
||||
remove_duplicates (addrs);
|
||||
|
||||
g_free (ascii_hostname);
|
||||
return addrs;
|
||||
}
|
||||
@ -354,6 +389,8 @@ g_resolver_lookup_by_name_finish (GResolver *resolver,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
GList *addrs;
|
||||
|
||||
g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
|
||||
|
||||
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);
|
||||
|
||||
remove_duplicates (addrs);
|
||||
|
||||
return addrs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -357,6 +357,54 @@ gsettings_reset (GSettings *settings,
|
||||
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
|
||||
gsettings_writable (GSettings *settings,
|
||||
const gchar *key,
|
||||
@ -409,6 +457,7 @@ gsettings_set (GSettings *settings,
|
||||
GError *error = NULL;
|
||||
GVariant *existing;
|
||||
GVariant *new;
|
||||
GVariant *stored;
|
||||
gchar *freeme = NULL;
|
||||
|
||||
existing = g_settings_get_value (settings, key);
|
||||
@ -442,16 +491,23 @@ gsettings_set (GSettings *settings,
|
||||
if (!g_settings_range_check (settings, key, new))
|
||||
{
|
||||
g_printerr (_("The provided value is outside of the valid range\n"));
|
||||
g_variant_unref (new);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
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 (new);
|
||||
|
||||
g_settings_sync ();
|
||||
|
||||
g_free (freeme);
|
||||
}
|
||||
|
||||
@ -529,6 +585,12 @@ gsettings_help (gboolean requested,
|
||||
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)
|
||||
{
|
||||
description = _("Check if KEY is writable");
|
||||
@ -566,6 +628,7 @@ gsettings_help (gboolean requested,
|
||||
" get Get the value of a key\n"
|
||||
" set Set 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"
|
||||
" monitor Watch for changes\n"
|
||||
"\n"
|
||||
@ -671,6 +734,9 @@ main (int argc, char **argv)
|
||||
else if (argc == 4 && strcmp (argv[1], "reset") == 0)
|
||||
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)
|
||||
function = gsettings_writable;
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
* even need to be started in this case. For this reason, you should
|
||||
* only ever modify #GSettings keys in response to explicit user action.
|
||||
* 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
|
||||
* is careful not to write settings in response to notify signals as a
|
||||
* 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.
|
||||
*
|
||||
* Creating settings objects with an different backend allows accessing settings
|
||||
* from a database other than the usual one. For example, it may make
|
||||
* Creating a #GSettings object with a different backend allows accessing
|
||||
* 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
|
||||
* the system to get a settings object that modifies the system default
|
||||
* settings instead of the settings for this user.
|
||||
|
@ -45,6 +45,13 @@ struct _GSettingsBackendPrivate
|
||||
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
|
||||
* @title: GSettingsBackend
|
||||
@ -982,6 +989,7 @@ g_settings_backend_get_default (void)
|
||||
|
||||
extension_type = g_io_extension_get_type (extension);
|
||||
instance = g_object_new (extension_type, NULL);
|
||||
g_settings_has_backend = TRUE;
|
||||
|
||||
g_once_init_leave (&backend, (gsize) instance);
|
||||
}
|
||||
@ -1021,12 +1029,15 @@ g_settings_backend_get_permission (GSettingsBackend *backend,
|
||||
void
|
||||
g_settings_backend_sync_default (void)
|
||||
{
|
||||
GSettingsBackendClass *class;
|
||||
GSettingsBackend *backend;
|
||||
if (g_settings_has_backend)
|
||||
{
|
||||
GSettingsBackendClass *class;
|
||||
GSettingsBackend *backend;
|
||||
|
||||
backend = g_settings_backend_get_default ();
|
||||
class = G_SETTINGS_BACKEND_GET_CLASS (backend);
|
||||
backend = g_settings_backend_get_default ();
|
||||
class = G_SETTINGS_BACKEND_GET_CLASS (backend);
|
||||
|
||||
if (class->sync)
|
||||
class->sync (backend);
|
||||
if (class->sync)
|
||||
class->sync (backend);
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ g_simple_action_class_init (GSimpleActionClass *class)
|
||||
g_simple_action_signals[SIGNAL_ACTIVATE] =
|
||||
g_signal_new (I_("activate"),
|
||||
G_TYPE_SIMPLE_ACTION,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
|
||||
G_STRUCT_OFFSET (GSimpleActionClass, activate),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VARIANT,
|
||||
|
@ -744,9 +744,13 @@ g_simple_async_result_complete (GSimpleAsyncResult *simple)
|
||||
#endif
|
||||
|
||||
if (simple->callback)
|
||||
simple->callback (simple->source_object,
|
||||
G_ASYNC_RESULT (simple),
|
||||
simple->user_data);
|
||||
{
|
||||
g_main_context_push_thread_default (simple->context);
|
||||
simple->callback (simple->source_object,
|
||||
G_ASYNC_RESULT (simple),
|
||||
simple->user_data);
|
||||
g_main_context_pop_thread_default (simple->context);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1756,15 +1756,17 @@ g_socket_check_connect_result (GSocket *socket,
|
||||
* received, the additional data will be returned in future calls to
|
||||
* g_socket_receive().
|
||||
*
|
||||
* 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 available
|
||||
* and the socket is in non-blocking mode, a %G_IO_ERROR_WOULD_BLOCK error
|
||||
* will be returned. To be notified when data is available, wait for the
|
||||
* If the socket is in blocking mode the call will block until there
|
||||
* is some data to receive, the connection is closed, or there is an
|
||||
* error. If there is no data available and the socket is in
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
@ -1794,7 +1796,8 @@ g_socket_receive (GSocket *socket,
|
||||
* the choice of blocking or non-blocking behavior is determined by
|
||||
* 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
|
||||
*/
|
||||
@ -1876,7 +1879,8 @@ g_socket_receive_with_blocking (GSocket *socket,
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
@ -3182,14 +3186,16 @@ g_socket_send_message (GSocket *socket,
|
||||
* sufficiently-large buffer.
|
||||
*
|
||||
* 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
|
||||
* available and the socket is in 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.
|
||||
* is some data to receive, the connection is closed, or there is an
|
||||
* error. If there is no data available and the socket is in
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
@ -58,7 +58,7 @@
|
||||
* #GSocketClient is a high-level utility class for connecting to a
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* a specific interface.
|
||||
*
|
||||
@ -726,7 +726,7 @@ g_socket_client_class_init (GSocketClientClass *class)
|
||||
* @cancellable: (allow-none): optional #GCancellable object, %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
|
||||
* 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
|
||||
* 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()
|
||||
* or indirectly via g_socket_client_set_local_address(). The socket type
|
||||
* 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.
|
||||
*
|
||||
* @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
|
||||
* lookup is performed). Quoting with [] is supported for all address
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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:
|
||||
* @client: a #GSocketClient.
|
||||
* @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.
|
||||
*
|
||||
* 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:
|
||||
* @client: a #GSocketClient.
|
||||
* @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.
|
||||
*
|
||||
* 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:
|
||||
* @client: a #GSocketClient.
|
||||
* @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.
|
||||
*
|
||||
* 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:
|
||||
* @client: a #GSocketClient.
|
||||
* @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.
|
||||
*
|
||||
* 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
|
||||
* indicated proxy protocol is returned by the #GProxyResolver,
|
||||
* #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
|
||||
* g_socket_connection_get_remote_address() on the returned
|
||||
* #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
|
||||
* 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
|
||||
* custom socket connection types for specific combination of socket
|
||||
* family/type/protocol using g_socket_connection_factory_register_type().
|
||||
@ -404,7 +404,7 @@ G_LOCK_DEFINE_STATIC(connection_factories);
|
||||
* @protocol: a protocol id
|
||||
*
|
||||
* Looks up the #GType to be used when creating socket connections on
|
||||
* sockets with the specified @family,@type and @protocol.
|
||||
* sockets with the specified @family, @type and @protocol.
|
||||
*
|
||||
* If no type is registered, the #GSocketConnection base type is returned.
|
||||
*
|
||||
@ -458,7 +458,7 @@ init_builtin_types (void)
|
||||
* @protocol_id: a protocol id
|
||||
*
|
||||
* Looks up the #GType to be used when creating socket connections on
|
||||
* sockets with the specified @family,@type and @protocol_id.
|
||||
* sockets with the specified @family, @type and @protocol_id.
|
||||
*
|
||||
* If no type is registered, the #GSocketConnection base type is returned.
|
||||
*
|
||||
|
@ -263,7 +263,7 @@ g_socket_listener_add_socket (GSocketListener *listener,
|
||||
*
|
||||
* Note that adding an IPv6 address, depending on the platform,
|
||||
* 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().
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* 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
|
||||
* requesting a binding to port 0 (ie: "any port"). This address, if
|
||||
* requested, belongs to the caller and must be freed.
|
||||
@ -770,7 +770,7 @@ g_socket_listener_accept_socket_async (GSocketListener *listener,
|
||||
* @listener: a #GSocketListener
|
||||
* @result: a #GAsyncResult.
|
||||
* @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.
|
||||
*
|
||||
* 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
|
||||
* @result: a #GAsyncResult.
|
||||
* @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.
|
||||
*
|
||||
* 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:
|
||||
* @listener: a #GSocketListener
|
||||
* @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.
|
||||
*
|
||||
* 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
|
||||
* but don't care about the specific port number.
|
||||
|
@ -34,8 +34,8 @@
|
||||
* signal is emitted.
|
||||
*
|
||||
* A #GSocketService is a subclass of #GSocketListener and you need
|
||||
* to add the addresses you want to accept connections on to the
|
||||
* with the #GSocketListener APIs.
|
||||
* to add the addresses you want to accept connections on with the
|
||||
* #GSocketListener APIs.
|
||||
*
|
||||
* There are two options for implementing a network service based on
|
||||
* #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,
|
||||
* 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
|
||||
*
|
||||
* Since: 2.22
|
||||
|
@ -326,7 +326,7 @@ g_tcp_connection_close_async (GIOStream *stream,
|
||||
* @graceful_disconnect: Whether to do graceful disconnects or not
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* A graceful disconnect means that we can be sure that we successfully sent
|
||||
|
@ -37,7 +37,7 @@
|
||||
* until the connection is closed.
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
* 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_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.
|
||||
* @error: (allow-none): #GError for error reporting, or %NULL to ignore.
|
||||
*
|
||||
* Passes a file descriptor to the recieving side of the
|
||||
* connection. The recieving end has to call g_unix_connection_receive_fd()
|
||||
* Passes a file descriptor to the receiving side of the
|
||||
* connection. The receiving end has to call g_unix_connection_receive_fd()
|
||||
* to accept the file descriptor.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* credentials.
|
||||
*
|
||||
|
@ -24,7 +24,9 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include <fcntl.h>
|
||||
#if !defined(G_OS_WIN32) || !defined(_MSC_VER)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
@ -30,16 +30,20 @@ test_local_cmdline (GApplication *application,
|
||||
|
||||
argv = *arguments;
|
||||
|
||||
for (i = 0; argv[i]; i++)
|
||||
i = 1;
|
||||
while (argv[i])
|
||||
{
|
||||
if (g_str_has_prefix (argv[i], "--local-"))
|
||||
{
|
||||
g_print ("handling argument %s locally\n", argv[i]);
|
||||
for (j = i + 1; argv[j]; j++)
|
||||
{
|
||||
argv[j - 1] = argv[j];
|
||||
argv[j] = NULL;
|
||||
}
|
||||
g_free (argv[i]);
|
||||
for (j = i; argv[j]; j++)
|
||||
argv[j] = argv[j + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
g_print ("not handling argument %s locally\n", argv[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,6 +221,79 @@ basic (void)
|
||||
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
|
||||
properties (void)
|
||||
{
|
||||
@ -289,6 +362,7 @@ main (int argc, char **argv)
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
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/app-id", appid);
|
||||
|
||||
|
@ -1083,7 +1083,6 @@ delayed_message_processing (void)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef BUG_631379_FIXED
|
||||
static gboolean
|
||||
nonce_tcp_on_authorize_authenticated_peer (GDBusAuthObserver *observer,
|
||||
GIOStream *stream,
|
||||
@ -1285,7 +1284,6 @@ test_nonce_tcp (void)
|
||||
g_main_loop_quit (service_loop);
|
||||
g_thread_join (service_thread);
|
||||
}
|
||||
#endif
|
||||
|
||||
static 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
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
@ -1460,9 +1547,8 @@ main (int argc,
|
||||
|
||||
g_test_add_func ("/gdbus/peer-to-peer", test_peer);
|
||||
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);
|
||||
#endif
|
||||
g_test_add_func ("/gdbus/tcp-anonymous", test_tcp_anonymous);
|
||||
g_test_add_func ("/gdbus/credentials", test_credentials);
|
||||
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
|
||||
message_serialize_invalid (void)
|
||||
{
|
||||
guint n;
|
||||
|
||||
/* Here we're relying on libdbus-1's DBusMessage type not checking
|
||||
* 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
|
||||
/* Other things we could check (note that GDBus _does_ check for all
|
||||
* these things - we just don't have test-suit coverage for it)
|
||||
*
|
||||
* - array exceeding 64 MiB (2^26 bytes) - unfortunately libdbus-1 checks
|
||||
@ -769,9 +784,13 @@ message_serialize_invalid (void)
|
||||
DBusMessage *dbus_message;
|
||||
char *blob;
|
||||
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_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 *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_set_serial (dbus_message, 0x41);
|
||||
@ -782,21 +801,21 @@ message_serialize_invalid (void)
|
||||
case 0:
|
||||
/* invalid UTF-8 */
|
||||
dbus_message_append_args (dbus_message,
|
||||
DBUS_TYPE_STRING, &invalid_utf8_str,
|
||||
DBUS_TYPE_STRING, &valid_utf8_str,
|
||||
DBUS_TYPE_INVALID);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* invalid object path */
|
||||
dbus_message_append_args (dbus_message,
|
||||
DBUS_TYPE_OBJECT_PATH, &invalid_object_path,
|
||||
DBUS_TYPE_OBJECT_PATH, &valid_object_path,
|
||||
DBUS_TYPE_INVALID);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* invalid signature */
|
||||
dbus_message_append_args (dbus_message,
|
||||
DBUS_TYPE_SIGNATURE, &invalid_signature,
|
||||
DBUS_TYPE_SIGNATURE, &valid_signature,
|
||||
DBUS_TYPE_INVALID);
|
||||
break;
|
||||
|
||||
@ -805,6 +824,11 @@ message_serialize_invalid (void)
|
||||
break;
|
||||
}
|
||||
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;
|
||||
message = g_dbus_message_new_from_blob ((guchar *) blob,
|
||||
|
@ -278,7 +278,7 @@ use_inet_address (gboolean synchronous)
|
||||
{
|
||||
GSocketAddressEnumerator *enumerator;
|
||||
GSocketAddress *sockaddr;
|
||||
GInetAddress *addr;
|
||||
GInetAddress *addr = NULL;
|
||||
guint port = 0;
|
||||
gchar **ip_and_port;
|
||||
|
||||
|
@ -206,6 +206,9 @@ libglib_2_0_la_SOURCES = \
|
||||
gprintf.c \
|
||||
gprintfint.h
|
||||
|
||||
if OS_UNIX
|
||||
libglib_2_0_la_SOURCES += glib-unix.c
|
||||
endif
|
||||
|
||||
EXTRA_libglib_2_0_la_SOURCES = \
|
||||
giounix.c \
|
||||
@ -219,6 +222,10 @@ glibinclude_HEADERS = \
|
||||
glib-object.h \
|
||||
glib.h
|
||||
|
||||
if OS_UNIX
|
||||
glibinclude_HEADERS += glib-unix.h
|
||||
endif
|
||||
|
||||
glibsubincludedir=$(includedir)/glib-2.0/glib
|
||||
glibsubinclude_HEADERS = \
|
||||
galloca.h \
|
||||
@ -452,7 +459,7 @@ dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/glib.vcproj ../build/win32/vs1
|
||||
done >libglib.vs10.sourcefiles
|
||||
$(CPP) -P - <$(top_srcdir)/build/win32/vs10/glib.vcxprojin >$@
|
||||
rm libglib.vs10.sourcefiles
|
||||
|
||||
|
||||
../build/win32/vs10/glib.vcxproj.filters: $(top_srcdir)/build/win32/vs10/glib.vcxproj.filtersin
|
||||
for F in $(libglib_2_0_la_SOURCES); do \
|
||||
case $$F in \
|
||||
|
@ -2385,10 +2385,9 @@ g_date_time_format (GDateTime *datetime,
|
||||
gint64 offset = g_date_time_get_utc_offset (datetime)
|
||||
/ USEC_PER_SECOND;
|
||||
|
||||
g_string_append_printf (outstr, "%c%02d%02d",
|
||||
offset >= 0 ? '+' : '-',
|
||||
g_string_append_printf (outstr, "%+03d%02d",
|
||||
(int) offset / 3600,
|
||||
(int) offset / 60 % 60);
|
||||
(int) abs(offset) / 60 % 60);
|
||||
}
|
||||
else
|
||||
g_string_append (outstr, "+0000");
|
||||
|
24
glib/ghash.c
24
glib/ghash.c
@ -479,22 +479,28 @@ g_hash_table_remove_all_nodes (GHashTable *hash_table,
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < hash_table->size; i++)
|
||||
if (notify &&
|
||||
(hash_table->key_destroy_func != NULL ||
|
||||
hash_table->value_destroy_func != NULL))
|
||||
{
|
||||
GHashNode *node = &hash_table->nodes [i];
|
||||
|
||||
if (node->key_hash > 1)
|
||||
for (i = 0; i < hash_table->size; i++)
|
||||
{
|
||||
if (notify && hash_table->key_destroy_func)
|
||||
hash_table->key_destroy_func (node->key);
|
||||
GHashNode *node = &hash_table->nodes [i];
|
||||
|
||||
if (notify && hash_table->value_destroy_func)
|
||||
hash_table->value_destroy_func (node->value);
|
||||
if (node->key_hash > 1)
|
||||
{
|
||||
if (hash_table->key_destroy_func != NULL)
|
||||
hash_table->key_destroy_func (node->key);
|
||||
|
||||
if (hash_table->value_destroy_func != NULL)
|
||||
hash_table->value_destroy_func (node->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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));
|
||||
|
||||
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
|
||||
g_test_create_case
|
||||
g_test_create_suite
|
||||
g_test_fail
|
||||
g_test_get_root
|
||||
g_test_init
|
||||
g_test_log_buffer_free
|
||||
@ -1977,6 +1978,17 @@ g_hostname_to_unicode
|
||||
#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
|
||||
g_ascii_table
|
||||
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__ */
|
491
glib/gmain.c
491
glib/gmain.c
@ -62,6 +62,10 @@
|
||||
#define G_MAIN_POLL_DEBUG
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
#include "glib-unix.h"
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
@ -73,6 +77,7 @@
|
||||
#include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#define STRICT
|
||||
@ -84,11 +89,6 @@
|
||||
#include <sys/wait.h>
|
||||
#endif /* G_OS_BEOS */
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
#include <fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include "gmain.h"
|
||||
|
||||
#include "garray.h"
|
||||
@ -188,6 +188,7 @@
|
||||
|
||||
typedef struct _GTimeoutSource GTimeoutSource;
|
||||
typedef struct _GChildWatchSource GChildWatchSource;
|
||||
typedef struct _GUnixSignalWatchSource GUnixSignalWatchSource;
|
||||
typedef struct _GPollRec GPollRec;
|
||||
typedef struct _GSourceCallback GSourceCallback;
|
||||
|
||||
@ -306,6 +307,13 @@ struct _GChildWatchSource
|
||||
#endif /* G_OS_WIN32 */
|
||||
};
|
||||
|
||||
struct _GUnixSignalWatchSource
|
||||
{
|
||||
GSource source;
|
||||
int signum;
|
||||
gboolean pending;
|
||||
};
|
||||
|
||||
struct _GPollRec
|
||||
{
|
||||
GPollFD *fd;
|
||||
@ -365,6 +373,8 @@ static void g_main_context_remove_poll_unlocked (GMainContext *context,
|
||||
GPollFD *fd);
|
||||
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,
|
||||
gint *timeout);
|
||||
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,
|
||||
GSourceFunc callback,
|
||||
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,
|
||||
gint *timeout);
|
||||
static gboolean g_idle_check (GSource *source);
|
||||
@ -389,15 +411,47 @@ static GMainContext *default_main_context;
|
||||
static GSList *main_contexts_without_pipe = NULL;
|
||||
|
||||
#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 {
|
||||
CHILD_WATCH_UNINITIALIZED,
|
||||
CHILD_WATCH_INITIALIZED_SINGLE,
|
||||
CHILD_WATCH_INITIALIZED_THREADED
|
||||
UNIX_SIGNAL_UNINITIALIZED = 0,
|
||||
UNIX_SIGNAL_INITIALIZED_SINGLE,
|
||||
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_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 */
|
||||
G_LOCK_DEFINE_STATIC (main_context_list);
|
||||
static GSList *main_context_list = NULL;
|
||||
@ -515,23 +569,14 @@ g_main_context_unref (GMainContext *context)
|
||||
static void
|
||||
g_main_context_init_pipe (GMainContext *context)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
# ifndef G_OS_WIN32
|
||||
if (context->wake_up_pipe[0] != -1)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_PIPE2
|
||||
/* if this fails, we fall through and try pipe */
|
||||
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);
|
||||
}
|
||||
if (!g_unix_pipe_flags (context->wake_up_pipe, FD_CLOEXEC, &error))
|
||||
g_error ("Cannot create pipe main loop wake-up: %s", error->message);
|
||||
|
||||
context->wake_up_rec.fd = context->wake_up_pipe[0];
|
||||
context->wake_up_rec.events = G_IO_IN;
|
||||
@ -3727,6 +3772,30 @@ g_main_context_get_poll_func (GMainContext *context)
|
||||
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 */
|
||||
/* Wake the main loop up from a poll() */
|
||||
static void
|
||||
@ -4232,13 +4301,169 @@ g_child_watch_prepare (GSource *source,
|
||||
return check_for_child_exited (source);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
g_child_watch_check (GSource *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 */
|
||||
|
||||
static gboolean
|
||||
@ -4267,110 +4492,202 @@ g_child_watch_dispatch (GSource *source,
|
||||
#ifndef G_OS_WIN32
|
||||
|
||||
static void
|
||||
g_child_watch_signal_handler (int signum)
|
||||
g_unix_signal_handler (int signum)
|
||||
{
|
||||
child_watch_count ++;
|
||||
if (signum == SIGCHLD)
|
||||
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
|
||||
{
|
||||
/* 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
|
||||
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_assert (child_watch_init_state == CHILD_WATCH_UNINITIALIZED);
|
||||
G_LOCK (unix_signal_lock);
|
||||
for (iter = unix_signal_watches; iter; iter = iter->next)
|
||||
{
|
||||
GUnixSignalWatchSource *source = iter->data;
|
||||
|
||||
child_watch_init_state = CHILD_WATCH_INITIALIZED_SINGLE;
|
||||
|
||||
action.sa_handler = g_child_watch_signal_handler;
|
||||
sigemptyset (&action.sa_mask);
|
||||
action.sa_flags = SA_NOCLDSTOP;
|
||||
sigaction (SIGCHLD, &action, NULL);
|
||||
if (source->signum != signum)
|
||||
continue;
|
||||
|
||||
source->pending = TRUE;
|
||||
}
|
||||
G_UNLOCK (unix_signal_lock);
|
||||
}
|
||||
|
||||
G_GNUC_NORETURN static gpointer
|
||||
child_watch_helper_thread (gpointer data)
|
||||
static gpointer unix_signal_helper_thread (gpointer data) G_GNUC_NORETURN;
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
gchar b[20];
|
||||
GSList *list;
|
||||
gchar b[128];
|
||||
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);
|
||||
|
||||
/* 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)
|
||||
bytes_read = read (unix_signal_wake_up_pipe[0], b, sizeof (b));
|
||||
if (bytes_read < 0)
|
||||
{
|
||||
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_warning ("Failed to read from child watch wake up pipe: %s",
|
||||
strerror (errno));
|
||||
/* Not much we can do here sanely; just wait a second and hope
|
||||
* it was transient.
|
||||
*/
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
continue;
|
||||
}
|
||||
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
|
||||
g_child_watch_source_init_multi_threaded (void)
|
||||
init_unix_signal_wakeup_state_unlocked (void)
|
||||
{
|
||||
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)
|
||||
g_error ("Cannot create wake up pipe: %s\n", g_strerror (errno));
|
||||
fcntl (child_watch_wake_up_pipe[1], F_SETFL, O_NONBLOCK | fcntl (child_watch_wake_up_pipe[1], F_GETFL));
|
||||
if (unix_signal_init_state == UNIX_SIGNAL_INITIALIZED_THREADED)
|
||||
return;
|
||||
|
||||
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 */
|
||||
/* FIXME: Think this through for races */
|
||||
if (g_thread_create (child_watch_helper_thread, NULL, FALSE, &error) == NULL)
|
||||
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;
|
||||
sigemptyset (&action.sa_mask);
|
||||
action.sa_flags = SA_RESTART | SA_NOCLDSTOP;
|
||||
sigaction (SIGCHLD, &action, NULL);
|
||||
if (g_thread_create (unix_signal_helper_thread, NULL, FALSE, &error) == NULL)
|
||||
g_error ("Cannot create a thread to monitor UNIX signals: %s\n", error->message);
|
||||
|
||||
unix_signal_init_state = UNIX_SIGNAL_INITIALIZED_THREADED;
|
||||
}
|
||||
|
||||
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
|
||||
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)
|
||||
g_child_watch_source_init_multi_threaded ();
|
||||
else if (child_watch_init_state == CHILD_WATCH_INITIALIZED_SINGLE)
|
||||
g_child_watch_source_init_promote_single_to_threaded ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (child_watch_init_state == CHILD_WATCH_UNINITIALIZED)
|
||||
g_child_watch_source_init_single ();
|
||||
struct sigaction action;
|
||||
action.sa_handler = g_unix_signal_handler;
|
||||
sigemptyset (&action.sa_mask);
|
||||
action.sa_flags = SA_RESTART | SA_NOCLDSTOP;
|
||||
sigaction (SIGCHLD, &action, NULL);
|
||||
unix_signal_state.sigchld_handler_installed = TRUE;
|
||||
}
|
||||
G_UNLOCK (unix_signal_lock);
|
||||
}
|
||||
|
||||
#endif /* !G_OS_WIN32 */
|
||||
|
@ -124,6 +124,8 @@ struct _GMarkupParseContext
|
||||
gint line_number;
|
||||
gint char_number;
|
||||
|
||||
GMarkupParseState state;
|
||||
|
||||
gpointer user_data;
|
||||
GDestroyNotify dnotify;
|
||||
|
||||
@ -134,7 +136,6 @@ struct _GMarkupParseContext
|
||||
GString *partial_chunk;
|
||||
GSList *spare_chunks;
|
||||
|
||||
GMarkupParseState state;
|
||||
GSList *tag_stack;
|
||||
GSList *tag_stack_gstr;
|
||||
GSList *spare_list_nodes;
|
||||
|
@ -548,14 +548,10 @@ g_logv (const gchar *log_domain,
|
||||
else
|
||||
abort ();
|
||||
#else
|
||||
#if defined (G_ENABLE_DEBUG) && defined (SIGTRAP)
|
||||
if (!(test_level & G_LOG_FLAG_RECURSION))
|
||||
G_BREAKPOINT ();
|
||||
else
|
||||
abort ();
|
||||
#else /* !G_ENABLE_DEBUG || !SIGTRAP */
|
||||
abort ();
|
||||
#endif /* !G_ENABLE_DEBUG || !SIGTRAP */
|
||||
#endif /* !G_OS_WIN32 */
|
||||
}
|
||||
|
||||
@ -818,7 +814,6 @@ _g_log_fallback_handler (const gchar *log_domain,
|
||||
#ifndef G_OS_WIN32
|
||||
gchar pid_string[FORMAT_UNSIGNED_BUFSIZE];
|
||||
#endif
|
||||
gboolean is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
|
||||
int fd;
|
||||
|
||||
/* 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, ": ");
|
||||
write_string (fd, message);
|
||||
if (is_fatal)
|
||||
write_string (fd, "\naborting...\n");
|
||||
else
|
||||
write_string (fd, "\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -927,7 +918,6 @@ g_log_default_handler (const gchar *log_domain,
|
||||
const gchar *message,
|
||||
gpointer unused_data)
|
||||
{
|
||||
gboolean is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
|
||||
gchar level_prefix[STRING_BUFFER_SIZE], *string;
|
||||
GString *gstring;
|
||||
int fd;
|
||||
@ -988,10 +978,7 @@ g_log_default_handler (const gchar *log_domain,
|
||||
|
||||
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);
|
||||
|
||||
|
@ -139,8 +139,8 @@ struct _GMatchInfo
|
||||
GRegexMatchFlags match_opts; /* options used at match time on the regex */
|
||||
gint matches; /* number of matching sub patterns */
|
||||
gint pos; /* position in the string where last match left off */
|
||||
gint n_offsets; /* number of offsets */
|
||||
gint *offsets; /* array of offsets paired 0,1 ; 2,3 ; 3,4 etc */
|
||||
gint n_offsets; /* number of offsets */
|
||||
gint *workspace; /* workspace for pcre_dfa_exec() */
|
||||
gint n_workspace; /* number of workspace elements */
|
||||
const gchar *string; /* string passed to the match function */
|
||||
|
@ -1422,12 +1422,18 @@ g_sequence_iter_move (GSequenceIter *iter,
|
||||
gint delta)
|
||||
{
|
||||
gint new_pos;
|
||||
gint len;
|
||||
|
||||
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 = 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);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include "gstrfuncs.h"
|
||||
#include "gtimer.h"
|
||||
|
||||
|
||||
|
||||
/* Global variable for storing assertion messages; this is the counterpart to
|
||||
* glibc's (private) __abort_msg variable, and allows developers and crash
|
||||
* analysis systems like Apport and ABRT to fish out assertion messages from
|
||||
@ -101,6 +101,7 @@ static GRand *test_run_rand = NULL;
|
||||
static gchar *test_run_name = "";
|
||||
static guint test_run_forks = 0;
|
||||
static guint test_run_count = 0;
|
||||
static guint test_run_success = FALSE;
|
||||
static guint test_skip_count = 0;
|
||||
static GTimer *test_user_timer = NULL;
|
||||
static double test_user_stamp = 0;
|
||||
@ -722,9 +723,11 @@ g_test_minimized_result (double minimized_quantity,
|
||||
long double largs = minimized_quantity;
|
||||
gchar *buffer;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
buffer = g_strdup_vprintf (format, args);
|
||||
va_end (args);
|
||||
|
||||
g_test_log (G_TEST_LOG_MIN_RESULT, buffer, NULL, 1, &largs);
|
||||
g_free (buffer);
|
||||
}
|
||||
@ -751,9 +754,11 @@ g_test_maximized_result (double maximized_quantity,
|
||||
long double largs = maximized_quantity;
|
||||
gchar *buffer;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
buffer = g_strdup_vprintf (format, args);
|
||||
va_end (args);
|
||||
|
||||
g_test_log (G_TEST_LOG_MAX_RESULT, buffer, NULL, 1, &largs);
|
||||
g_free (buffer);
|
||||
}
|
||||
@ -773,9 +778,11 @@ g_test_message (const char *format,
|
||||
{
|
||||
gchar *buffer;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
buffer = g_strdup_vprintf (format, args);
|
||||
va_end (args);
|
||||
|
||||
g_test_log (G_TEST_LOG_MESSAGE, buffer, NULL, 0, NULL);
|
||||
g_free (buffer);
|
||||
}
|
||||
@ -820,8 +827,10 @@ void
|
||||
g_test_bug (const char *bug_uri_snippet)
|
||||
{
|
||||
char *c;
|
||||
|
||||
g_return_if_fail (test_uri_base != NULL);
|
||||
g_return_if_fail (bug_uri_snippet != NULL);
|
||||
|
||||
c = strstr (test_uri_base, "%s");
|
||||
if (c)
|
||||
{
|
||||
@ -853,6 +862,7 @@ g_test_get_root (void)
|
||||
g_free (test_suite_root->name);
|
||||
test_suite_root->name = g_strdup ("");
|
||||
}
|
||||
|
||||
return test_suite_root;
|
||||
}
|
||||
|
||||
@ -914,10 +924,12 @@ g_test_create_case (const char *test_name,
|
||||
GTestFixtureFunc data_teardown)
|
||||
{
|
||||
GTestCase *tc;
|
||||
|
||||
g_return_val_if_fail (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 (data_test != NULL, NULL);
|
||||
|
||||
tc = g_slice_new0 (GTestCase);
|
||||
tc->name = g_strdup (test_name);
|
||||
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_test = (void*) data_test;
|
||||
tc->fixture_teardown = (void*) data_teardown;
|
||||
|
||||
return tc;
|
||||
}
|
||||
|
||||
@ -985,6 +998,31 @@ g_test_add_vtable (const char *testpath,
|
||||
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:
|
||||
*
|
||||
@ -1081,6 +1119,7 @@ g_test_suite_add (GTestSuite *suite,
|
||||
{
|
||||
g_return_if_fail (suite != NULL);
|
||||
g_return_if_fail (test_case != NULL);
|
||||
|
||||
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 (nestedsuite != NULL);
|
||||
|
||||
suite->suites = g_slist_prepend (suite->suites, nestedsuite);
|
||||
}
|
||||
|
||||
@ -1138,7 +1178,9 @@ g_test_queue_destroy (GDestroyNotify destroy_func,
|
||||
gpointer destroy_data)
|
||||
{
|
||||
DestroyEntry *dentry;
|
||||
|
||||
g_return_if_fail (destroy_func != NULL);
|
||||
|
||||
dentry = g_slice_new0 (DestroyEntry);
|
||||
dentry->destroy_func = destroy_func;
|
||||
dentry->destroy_data = destroy_data;
|
||||
@ -1146,10 +1188,12 @@ g_test_queue_destroy (GDestroyNotify destroy_func,
|
||||
test_destroy_queue = dentry;
|
||||
}
|
||||
|
||||
static int
|
||||
static gboolean
|
||||
test_case_run (GTestCase *tc)
|
||||
{
|
||||
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);
|
||||
if (++test_run_count <= test_skip_count)
|
||||
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;
|
||||
g_test_log (G_TEST_LOG_START_CASE, test_run_name, NULL, 0, NULL);
|
||||
test_run_forks = 0;
|
||||
test_run_success = TRUE;
|
||||
g_test_log_set_fatal_handler (NULL, NULL);
|
||||
g_timer_start (test_run_timer);
|
||||
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)
|
||||
g_free (fixture);
|
||||
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[2] = g_timer_elapsed (test_run_timer, NULL);
|
||||
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;
|
||||
g_free (test_uri_base);
|
||||
test_uri_base = old_base;
|
||||
return 0;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static int
|
||||
g_test_run_suite_internal (GTestSuite *suite,
|
||||
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;
|
||||
GSList *slist, *reversed;
|
||||
|
||||
g_return_val_if_fail (suite != NULL, -1);
|
||||
|
||||
while (path[0] == '/')
|
||||
path++;
|
||||
l = strlen (path);
|
||||
@ -1219,8 +1269,8 @@ g_test_run_suite_internal (GTestSuite *suite,
|
||||
guint n = l ? strlen (tc->name) : 0;
|
||||
if (l == n && strncmp (path, tc->name, n) == 0)
|
||||
{
|
||||
n_good++;
|
||||
n_bad += test_case_run (tc) != 0;
|
||||
if (!test_case_run (tc))
|
||||
n_bad++;
|
||||
}
|
||||
}
|
||||
g_slist_free (reversed);
|
||||
@ -1230,12 +1280,13 @@ g_test_run_suite_internal (GTestSuite *suite,
|
||||
GTestSuite *ts = slist->data;
|
||||
guint n = l ? strlen (ts->name) : 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_free (test_run_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)
|
||||
{
|
||||
guint n_bad = 0;
|
||||
|
||||
g_return_val_if_fail (g_test_config_vars->test_initialized, -1);
|
||||
g_return_val_if_fail (g_test_run_once == TRUE, -1);
|
||||
|
||||
g_test_run_once = FALSE;
|
||||
|
||||
if (!test_paths)
|
||||
test_paths = g_slist_prepend (test_paths, "");
|
||||
while (test_paths)
|
||||
@ -1271,7 +1325,7 @@ g_test_run_suite (GTestSuite *suite)
|
||||
path++;
|
||||
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;
|
||||
}
|
||||
/* regular suite, match path */
|
||||
@ -1279,8 +1333,9 @@ g_test_run_suite (GTestSuite *suite)
|
||||
l = strlen (path);
|
||||
l = rest ? MIN (l, rest - path) : l;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1294,6 +1349,7 @@ gtest_default_log_handler (const gchar *log_domain,
|
||||
gboolean fatal = FALSE;
|
||||
gchar *msg;
|
||||
guint i = 0;
|
||||
|
||||
if (log_domain)
|
||||
{
|
||||
strv[i++] = log_domain;
|
||||
@ -1321,9 +1377,11 @@ gtest_default_log_handler (const gchar *log_domain,
|
||||
strv[i++] = ": ";
|
||||
strv[i++] = message;
|
||||
strv[i++] = NULL;
|
||||
|
||||
msg = g_strjoinv ("", (gchar**) strv);
|
||||
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_free (msg);
|
||||
}
|
||||
|
||||
@ -1336,6 +1394,7 @@ g_assertion_message (const char *domain,
|
||||
{
|
||||
char lstr[32];
|
||||
char *s;
|
||||
|
||||
if (!message)
|
||||
message = "code should not be reached";
|
||||
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,
|
||||
gconstpointer test_data,
|
||||
GTestDataFunc test_func);
|
||||
/* tell about failure */
|
||||
void g_test_fail (void);
|
||||
|
||||
/* hook up a test with fixture under test path */
|
||||
#define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
|
||||
|
@ -146,29 +146,41 @@ static GHashTable/*<string?, GTimeZone>*/ *time_zones;
|
||||
void
|
||||
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)
|
||||
{
|
||||
g_critical ("The last reference on the local timezone was just "
|
||||
"dropped, but GTimeZone itself still owns one. This "
|
||||
"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
|
||||
* 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
|
||||
* sure.
|
||||
*/
|
||||
tz->ref_count = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (tz->name != NULL)
|
||||
{
|
||||
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_UNLOCK(time_zones);
|
||||
}
|
||||
@ -180,6 +192,11 @@ g_time_zone_unref (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:
|
||||
* @tz: a #GTimeZone
|
||||
* @type: the #GTimeType of @time
|
||||
* @time: a pointer to a number of seconds since January 1, 1970
|
||||
* @type: the #GTimeType of @time_
|
||||
* @time_: a pointer to a number of seconds since January 1, 1970
|
||||
*
|
||||
* Finds an interval within @tz that corresponds to the given @time,
|
||||
* possibly adjusting @time if required to fit into an interval.
|
||||
* The meaning of @time depends on @type.
|
||||
* Finds an interval within @tz that corresponds to the given @time_,
|
||||
* possibly adjusting @time_ if required to fit into an interval.
|
||||
* The meaning of @time_ depends on @type.
|
||||
*
|
||||
* This function is similar to g_time_zone_find_interval(), with the
|
||||
* difference that it always succeeds (by making the adjustments
|
||||
* described below).
|
||||
*
|
||||
* 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
|
||||
* non-existent times. If the non-existent local @time of 02:30 were
|
||||
* This function may, however, modify @time_ in order to deal with
|
||||
* non-existent times. If the non-existent local @time_ of 02:30 were
|
||||
* 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.
|
||||
*
|
||||
* Returns: the interval containing @time, never -1
|
||||
* Returns: the interval containing @time_, never -1
|
||||
*
|
||||
* Since: 2.26
|
||||
**/
|
||||
|
@ -65,11 +65,11 @@ void g_time_zone_unref (GTimeZo
|
||||
|
||||
gint g_time_zone_find_interval (GTimeZone *tz,
|
||||
GTimeType type,
|
||||
gint64 time);
|
||||
gint64 time_);
|
||||
|
||||
gint g_time_zone_adjust_time (GTimeZone *tz,
|
||||
GTimeType type,
|
||||
gint64 *time);
|
||||
gint64 *time_);
|
||||
|
||||
const gchar * g_time_zone_get_abbreviation (GTimeZone *tz,
|
||||
gint interval);
|
||||
|
@ -2693,7 +2693,7 @@ g_variant_iter_free (GVariantIter *iter)
|
||||
* GVariantIter iter;
|
||||
* GVariant *child;
|
||||
*
|
||||
* g_variant_iter_init (&iter, dictionary);
|
||||
* g_variant_iter_init (&iter, container);
|
||||
* while ((child = g_variant_iter_next_value (&iter)))
|
||||
* {
|
||||
* 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
|
||||
* "a{sv}" type).
|
||||
*
|
||||
* Since: 2.30
|
||||
**/
|
||||
#define G_VARIANT_TYPE_VARDICT ((const GVariantType *) "a{sv}")
|
||||
|
||||
|
@ -170,6 +170,13 @@ sort_LDADD = $(progs_ldadd)
|
||||
|
||||
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
|
||||
XMLLINT=xmllint
|
||||
gtester-xmllint-check: # check testreport xml with xmllint if present
|
||||
|
@ -1023,11 +1023,29 @@ test_all_dates (void)
|
||||
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
|
||||
main (gint argc,
|
||||
gchar *argv[])
|
||||
{
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
g_test_bug_base ("http://bugzilla.gnome.org/");
|
||||
|
||||
/* 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/now_utc", test_GDateTime_now_utc);
|
||||
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);
|
||||
|
||||
return g_test_run ();
|
||||
|
@ -169,56 +169,60 @@ static guint CrcTable[128];
|
||||
*/
|
||||
static void crcinit(void)
|
||||
{
|
||||
int i, j;
|
||||
guint sum;
|
||||
int i, j;
|
||||
guint sum;
|
||||
|
||||
for (i = 0; i < 128; ++i) {
|
||||
sum = 0L;
|
||||
for (j = 7 - 1; j >= 0; --j)
|
||||
if (i & (1 << j))
|
||||
sum ^= POLY >> j;
|
||||
CrcTable[i] = sum;
|
||||
}
|
||||
for (i = 0; i < 128; ++i)
|
||||
{
|
||||
sum = 0L;
|
||||
for (j = 7 - 1; j >= 0; --j)
|
||||
if (i & (1 << j))
|
||||
sum ^= POLY >> j;
|
||||
CrcTable[i] = sum;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
- hash - Honeyman's nice hashing function
|
||||
*/
|
||||
static guint honeyman_hash(gconstpointer key)
|
||||
static guint
|
||||
honeyman_hash (gconstpointer key)
|
||||
{
|
||||
const gchar *name = (const gchar *) key;
|
||||
gint size;
|
||||
guint sum = 0;
|
||||
const gchar *name = (const gchar *) key;
|
||||
gint size;
|
||||
guint sum = 0;
|
||||
|
||||
g_assert (name != NULL);
|
||||
g_assert (*name != 0);
|
||||
g_assert (name != NULL);
|
||||
g_assert (*name != 0);
|
||||
|
||||
size = strlen(name);
|
||||
size = strlen (name);
|
||||
|
||||
while (size--) {
|
||||
sum = (sum >> 7) ^ CrcTable[(sum ^ (*name++)) & 0x7f];
|
||||
}
|
||||
while (size--)
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
static void not_even_foreach (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
static void
|
||||
not_even_foreach (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
const char *_key = (const char *) key;
|
||||
const char *_value = (const char *) value;
|
||||
@ -240,9 +244,10 @@ static void not_even_foreach (gpointer key,
|
||||
}
|
||||
|
||||
|
||||
static gboolean remove_even_foreach (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
static gboolean
|
||||
remove_even_foreach (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
const char *_key = (const char *) key;
|
||||
const char *_value = (const char *) value;
|
||||
@ -265,174 +270,176 @@ 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);
|
||||
|
||||
int i;
|
||||
char key[20] = "", val[20]="", *v, *orig_key, *orig_val;
|
||||
GHashTable *h;
|
||||
gboolean found;
|
||||
int i;
|
||||
char key[20] = "", val[20]="", *v, *orig_key, *orig_val;
|
||||
GHashTable *h;
|
||||
gboolean found;
|
||||
|
||||
crcinit ();
|
||||
crcinit ();
|
||||
|
||||
h = g_hash_table_new_full (simple_hash ? one_hash : honeyman_hash,
|
||||
second_hash_cmp,
|
||||
g_free, g_free);
|
||||
g_assert (h != NULL);
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
sprintf (key, "%d", i);
|
||||
g_assert (atoi (key) == i);
|
||||
h = g_hash_table_new_full (simple_hash ? one_hash : honeyman_hash,
|
||||
second_hash_cmp,
|
||||
g_free, g_free);
|
||||
g_assert (h != NULL);
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
sprintf (key, "%d", i);
|
||||
g_assert (atoi (key) == i);
|
||||
|
||||
sprintf (val, "%d value", i);
|
||||
g_assert (atoi (val) == i);
|
||||
sprintf (val, "%d value", i);
|
||||
g_assert (atoi (val) == i);
|
||||
|
||||
g_hash_table_insert (h, g_strdup (key), g_strdup (val));
|
||||
}
|
||||
g_hash_table_insert (h, g_strdup (key), g_strdup (val));
|
||||
}
|
||||
|
||||
g_assert (g_hash_table_size (h) == 20);
|
||||
g_assert (g_hash_table_size (h) == 20);
|
||||
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
sprintf (key, "%d", i);
|
||||
g_assert (atoi(key) == i);
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
sprintf (key, "%d", i);
|
||||
g_assert (atoi(key) == i);
|
||||
|
||||
v = (char *) g_hash_table_lookup (h, key);
|
||||
v = (char *) g_hash_table_lookup (h, key);
|
||||
|
||||
g_assert (v != NULL);
|
||||
g_assert (*v != 0);
|
||||
g_assert (atoi (v) == i);
|
||||
}
|
||||
g_assert (v != NULL);
|
||||
g_assert (*v != 0);
|
||||
g_assert (atoi (v) == i);
|
||||
}
|
||||
|
||||
sprintf (key, "%d", 3);
|
||||
g_hash_table_remove (h, key);
|
||||
g_assert (g_hash_table_size (h) == 19);
|
||||
g_hash_table_foreach_remove (h, remove_even_foreach, NULL);
|
||||
g_assert (g_hash_table_size (h) == 9);
|
||||
g_hash_table_foreach (h, not_even_foreach, NULL);
|
||||
sprintf (key, "%d", 3);
|
||||
g_hash_table_remove (h, key);
|
||||
g_assert (g_hash_table_size (h) == 19);
|
||||
g_hash_table_foreach_remove (h, remove_even_foreach, NULL);
|
||||
g_assert (g_hash_table_size (h) == 9);
|
||||
g_hash_table_foreach (h, not_even_foreach, NULL);
|
||||
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
sprintf (key, "%d", i);
|
||||
g_assert (atoi(key) == i);
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
sprintf (key, "%d", i);
|
||||
g_assert (atoi(key) == i);
|
||||
|
||||
sprintf (val, "%d value", i);
|
||||
g_assert (atoi (val) == i);
|
||||
sprintf (val, "%d value", i);
|
||||
g_assert (atoi (val) == i);
|
||||
|
||||
orig_key = orig_val = NULL;
|
||||
found = g_hash_table_lookup_extended (h, key,
|
||||
(gpointer)&orig_key,
|
||||
(gpointer)&orig_val);
|
||||
if ((i % 2) == 0 || i == 3)
|
||||
{
|
||||
g_assert (!found);
|
||||
continue;
|
||||
}
|
||||
orig_key = orig_val = NULL;
|
||||
found = g_hash_table_lookup_extended (h, key,
|
||||
(gpointer)&orig_key,
|
||||
(gpointer)&orig_val);
|
||||
if ((i % 2) == 0 || i == 3)
|
||||
{
|
||||
g_assert (!found);
|
||||
continue;
|
||||
}
|
||||
|
||||
g_assert (found);
|
||||
g_assert (found);
|
||||
|
||||
g_assert (orig_key != NULL);
|
||||
g_assert (strcmp (key, orig_key) == 0);
|
||||
g_assert (orig_key != NULL);
|
||||
g_assert (strcmp (key, orig_key) == 0);
|
||||
|
||||
g_assert (orig_val != NULL);
|
||||
g_assert (strcmp (val, orig_val) == 0);
|
||||
}
|
||||
g_assert (orig_val != NULL);
|
||||
g_assert (strcmp (val, orig_val) == 0);
|
||||
}
|
||||
|
||||
g_hash_table_destroy (h);
|
||||
g_hash_table_destroy (h);
|
||||
}
|
||||
|
||||
static gboolean find_first (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
static gboolean
|
||||
find_first (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint *v = value;
|
||||
gint *v = value;
|
||||
gint *test = user_data;
|
||||
return (*v == *test);
|
||||
}
|
||||
|
||||
|
||||
static void direct_hash_test (void)
|
||||
static void
|
||||
direct_hash_test (void)
|
||||
{
|
||||
gint i, rc;
|
||||
GHashTable *h;
|
||||
gint i, rc;
|
||||
GHashTable *h;
|
||||
|
||||
h = g_hash_table_new (NULL, NULL);
|
||||
g_assert (h != NULL);
|
||||
for (i=1; i<=20; i++)
|
||||
{
|
||||
g_hash_table_insert (h, GINT_TO_POINTER (i),
|
||||
GINT_TO_POINTER (i + 42));
|
||||
}
|
||||
h = g_hash_table_new (NULL, NULL);
|
||||
g_assert (h != NULL);
|
||||
for (i = 1; i <= 20; i++)
|
||||
g_hash_table_insert (h, GINT_TO_POINTER (i),
|
||||
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++)
|
||||
{
|
||||
rc = GPOINTER_TO_INT (
|
||||
g_hash_table_lookup (h, GINT_TO_POINTER (i)));
|
||||
for (i = 1; i <= 20; i++)
|
||||
{
|
||||
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, GINT_TO_POINTER (i)));
|
||||
|
||||
g_assert (rc != 0);
|
||||
g_assert ((rc - 42) == i);
|
||||
}
|
||||
g_assert (rc != 0);
|
||||
g_assert ((rc - 42) == i);
|
||||
}
|
||||
|
||||
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;
|
||||
GHashTable *h;
|
||||
gint64 values[20];
|
||||
gint64 key;
|
||||
gint i, rc;
|
||||
GHashTable *h;
|
||||
gint64 values[20];
|
||||
gint64 key;
|
||||
|
||||
h = g_hash_table_new (g_int64_hash, g_int64_equal);
|
||||
g_assert (h != NULL);
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
values[i] = i + 42;
|
||||
g_hash_table_insert (h, &values[i], GINT_TO_POINTER (i + 42));
|
||||
}
|
||||
h = g_hash_table_new (g_int64_hash, g_int64_equal);
|
||||
g_assert (h != NULL);
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
values[i] = i + 42;
|
||||
g_hash_table_insert (h, &values[i], GINT_TO_POINTER (i + 42));
|
||||
}
|
||||
|
||||
g_assert (g_hash_table_size (h) == 20);
|
||||
g_assert (g_hash_table_size (h) == 20);
|
||||
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
key = i + 42;
|
||||
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, &key));
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
key = i + 42;
|
||||
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, &key));
|
||||
|
||||
g_assert_cmpint (rc, ==, i + 42);
|
||||
}
|
||||
g_assert_cmpint (rc, ==, i + 42);
|
||||
}
|
||||
|
||||
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;
|
||||
GHashTable *h;
|
||||
gdouble values[20];
|
||||
gdouble key;
|
||||
gint i, rc;
|
||||
GHashTable *h;
|
||||
gdouble values[20];
|
||||
gdouble key;
|
||||
|
||||
h = g_hash_table_new (g_double_hash, g_double_equal);
|
||||
g_assert (h != NULL);
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
values[i] = i + 42.5;
|
||||
g_hash_table_insert (h, &values[i], GINT_TO_POINTER (i + 42));
|
||||
}
|
||||
h = g_hash_table_new (g_double_hash, g_double_equal);
|
||||
g_assert (h != NULL);
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
values[i] = i + 42.5;
|
||||
g_hash_table_insert (h, &values[i], GINT_TO_POINTER (i + 42));
|
||||
}
|
||||
|
||||
g_assert (g_hash_table_size (h) == 20);
|
||||
g_assert (g_hash_table_size (h) == 20);
|
||||
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
key = i + 42.5;
|
||||
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, &key));
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
key = i + 42.5;
|
||||
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, &key));
|
||||
|
||||
g_assert_cmpint (rc, ==, i + 42);
|
||||
}
|
||||
g_assert_cmpint (rc, ==, i + 42);
|
||||
}
|
||||
|
||||
g_hash_table_destroy (h);
|
||||
g_hash_table_destroy (h);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -443,39 +450,40 @@ string_free (gpointer data)
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
|
||||
static void string_hash_test (void)
|
||||
static void
|
||||
string_hash_test (void)
|
||||
{
|
||||
gint i, rc;
|
||||
GHashTable *h;
|
||||
GString *s;
|
||||
gint i, rc;
|
||||
GHashTable *h;
|
||||
GString *s;
|
||||
|
||||
h = g_hash_table_new_full ((GHashFunc)g_string_hash, (GEqualFunc)g_string_equal, string_free, NULL);
|
||||
g_assert (h != NULL);
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
s = g_string_new ("");
|
||||
g_string_append_printf (s, "%d", i + 42);
|
||||
g_string_append_c (s, '.');
|
||||
g_string_prepend_unichar (s, 0x2301);
|
||||
g_hash_table_insert (h, s, GINT_TO_POINTER (i + 42));
|
||||
}
|
||||
h = g_hash_table_new_full ((GHashFunc)g_string_hash, (GEqualFunc)g_string_equal, string_free, NULL);
|
||||
g_assert (h != NULL);
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
s = g_string_new ("");
|
||||
g_string_append_printf (s, "%d", i + 42);
|
||||
g_string_append_c (s, '.');
|
||||
g_string_prepend_unichar (s, 0x2301);
|
||||
g_hash_table_insert (h, s, GINT_TO_POINTER (i + 42));
|
||||
}
|
||||
|
||||
g_assert (g_hash_table_size (h) == 20);
|
||||
g_assert (g_hash_table_size (h) == 20);
|
||||
|
||||
s = g_string_new ("");
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
g_string_assign (s, "");
|
||||
g_string_append_printf (s, "%d", i + 42);
|
||||
g_string_append_c (s, '.');
|
||||
g_string_prepend_unichar (s, 0x2301);
|
||||
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, s));
|
||||
s = g_string_new ("");
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
g_string_assign (s, "");
|
||||
g_string_append_printf (s, "%d", i + 42);
|
||||
g_string_append_c (s, '.');
|
||||
g_string_prepend_unichar (s, 0x2301);
|
||||
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, s));
|
||||
|
||||
g_assert_cmpint (rc, ==, i + 42);
|
||||
}
|
||||
g_assert_cmpint (rc, ==, i + 42);
|
||||
}
|
||||
|
||||
g_string_free (s, TRUE);
|
||||
g_hash_table_destroy (h);
|
||||
g_string_free (s, TRUE);
|
||||
g_hash_table_destroy (h);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -648,6 +656,42 @@ test_lookup_null_key (void)
|
||||
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
|
||||
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/string", string_hash_test);
|
||||
g_test_add_func ("/hash/ref", test_hash_ref);
|
||||
g_test_add_func ("/hash/remove-all", test_remove_all);
|
||||
|
||||
/* tests for individual bugs */
|
||||
g_test_add_func ("/hash/lookup-null-key", test_lookup_null_key);
|
||||
|
@ -1,5 +1,9 @@
|
||||
#include <config.h>
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
static void
|
||||
test_empty (void)
|
||||
@ -8,7 +12,7 @@ test_empty (void)
|
||||
GError *error;
|
||||
|
||||
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 (g_mapped_file_get_contents (file) == NULL);
|
||||
@ -38,8 +42,14 @@ test_writable (void)
|
||||
const gchar *old = "MMMMMMMMMMMMMMMMMMMMMMMMM";
|
||||
const gchar *new = "abcdefghijklmnopqrstuvxyz";
|
||||
|
||||
if (access (SRCDIR "/4096-random-bytes", W_OK) != 0)
|
||||
{
|
||||
g_test_message ("Skipping writable mapping test");
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
contents = g_mapped_file_get_contents (file);
|
||||
@ -51,7 +61,7 @@ test_writable (void)
|
||||
g_mapped_file_free (file);
|
||||
|
||||
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);
|
||||
|
||||
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_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
|
||||
@ -1326,6 +1355,8 @@ test_stable_sort (void)
|
||||
iter = g_sequence_iter_next (iter);
|
||||
g_sequence_check (seq);
|
||||
}
|
||||
|
||||
g_sequence_free (seq);
|
||||
}
|
||||
|
||||
int
|
||||
@ -1340,6 +1371,7 @@ main (int argc,
|
||||
|
||||
/* Standalone tests */
|
||||
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/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_CFLAGS = -DTEST_EMULATED_FUTEX
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user