
    VhB                     z    d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZmZ  G d de
      Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functionaI  
module: gio_mime
author:
  - "Alexei Znamensky (@russoz)"
short_description: Set default handler for MIME type, for applications using Gnome GIO
version_added: 7.5.0
description:
  - This module allows configuring the default handler for a specific MIME type, to be used by applications built with the
    Gnome GIO API.
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: full
  diff_mode:
    support: full
options:
  mime_type:
    description:
      - MIME type for which a default handler will be set.
    type: str
    required: true
  handler:
    description:
      - Default handler will be set for the MIME type.
    type: str
    required: true
notes:
  - This module is a thin wrapper around the C(gio mime) command (and subcommand).
  - See man gio(1) for more details.
seealso:
  - name: C(gio) command manual page
    description: Manual page for the command.
    link: https://man.archlinux.org/man/gio.1
  - name: GIO Documentation
    description: Reference documentation for the GIO API..
    link: https://docs.gtk.org/gio/
z
- name: Set chrome as the default handler for https
  community.general.gio_mime:
    mime_type: x-scheme-handler/https
    handler: google-chrome.desktop
  register: result
aH  
handler:
  description:
    - The handler set as default.
  returned: success
  type: str
  sample: google-chrome.desktop
stdout:
  description:
    - The output of the C(gio) command.
  returned: success
  type: str
  sample: Set google-chrome.desktop as the default for x-scheme-handler/https
stderr:
  description:
    - The error output of the C(gio) command.
  returned: failure
  type: str
  sample: 'gio: Failed to load info for handler "never-existed.desktop"'
version:
  description: Version of gio.
  type: str
  returned: always
  sample: "2.80.0"
  version_added: 10.0.0
)ModuleHelper)gio_mime_runnergio_mime_getc            	       f    e Zd ZdgZ e e edd       edd            d      ZdZd Zd	 Zy
)GioMimehandlerstrT)typerequired)	mime_typer   )argument_specsupports_check_modeFc                 |   t        | j                  d      | _        | j                  d      5 }|j                         \  }}}|j	                         | j
                  _        d d d        | j
                  j                  dt        | j                  | j
                  j                        dd       y # 1 sw Y   QxY w)NT)check_rcversionr   )initial_valuediffchange)
r   modulerunnerrunstripvarsr   set_metar   r   )selfctxrcouterrs        n/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/gio_mime.py__init_module__zGioMime.__init_module__c   s    %dkkDA[[# 	,s779LBS #		DII	, 			9LdiiNaNa4bimvz{	, 	,s   4B22B;c                 X   d}| j                   j                  r| j                  j                  dd|      5 }|j	                         \  }}}|| j                   _        || j                   _        | j                   j                  d|j                  d       d d d        y y # 1 sw Y   y xY w)N)r   zModule executed in check mode zmime mime_type handlerT)
args_ordercheck_mode_skipcheck_mode_returnrun_info   )	verbosity)	r   has_changedr   contextr   stdoutstderrsetr*   )r   r)   r   r    r!   r"   s         r#   __run__zGioMime.__run__j   s    D99  $$0HZ^  sD$  E E  IL"wwyC#&		 #&		 		j#,,!D	E E !E Es   AB  B)N)	__name__
__module____qualname__output_paramsdictr   use_old_vardictr$   r2        r#   r
   r
   X   sG    KM5ed3
 !F O|Er:   r
   c                  ,    t         j                          y )N)r
   executer9   r:   r#   mainr=   t   s    OOr:   __main__N)
__future__r   r   r   r   __metaclass__DOCUMENTATIONEXAMPLESRETURNHansible_collections.community.general.plugins.module_utils.module_helperr   Cansible_collections.community.general.plugins.module_utils.gio_mimer   r   r
   r=   r3   r9   r:   r#   <module>rF      sY    A @%N
6 b mEl E8 zF r:   