<commit_before>#!/usr/bin/env ruby
#
# Simple notification example.
require 'gir_ffi-gtk3'

GirFFI.setup :Notify

# Both Gtk and Notify need to be init'ed.
Gtk.init
Notify.init "notification test"

# Basic set up of the notification.
nf = Notify::Notification.new "Hello!", "Hi there.", "gtk-dialog-info"
nf.timeout = 3000
nf.urgency = :critical

# Show a button 'Test' in the notification, with a callback function.
nf.add_action "test", "Test", Proc.new { |obj, action, user_data|
  puts "Action #{action} clicked."
}, nil, nil

# In this case, we want the program to end once the notification is gone,
# but not before.
nf.signal_connect("closed") {
  puts "Notification closed."
  Gtk.main_quit
}

# Show the notification.
nf.show

# Start a main loop to wait for the notification to be closed.
Gtk.main<commit_msg>Update 05_notification.rb<commit_after>#!/usr/bin/env ruby
#
# Simple notification example.
require 'gir_ffi-gtk3'

GirFFI.setup :Notify

# Both Gtk and Notify need to be init'ed.
Gtk.init
Notify.init "notification test"

# Basic set up of the notification.
nf = Notify::Notification.new "Hello!", "Hi there.", "gtk-dialog-info"
nf.timeout = 3000
nf.urgency = :critical

# Show a button 'Test' in the notification, with a callback function.
nf.add_action("test", "Test") { |obj, action, user_data|
  puts "Action #{action} clicked."
}

# In this case, we want the program to end once the notification is gone,
# but not before.
nf.signal_connect("closed") {
  puts "Notification closed."
  Gtk.main_quit
}

# Show the notification.
nf.show

# Start a main loop to wait for the notification to be closed.
Gtk.main
{'fraction_non_alphanumeric': 0.11587982832618025, 'fraction_numerical': 0.007357449417535254, 'mean_word_length': 4.264516129032258, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4524273', 'n_tokens_mistral': 553, 'n_tokens_neox': 533, 'n_words': 196}