gtk_paradise 0.9.120 → 0.11.19
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gtk_paradise might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +4521 -2997
- data/bin/genity +26 -0
- data/bin/gtk_editor +7 -0
- data/doc/README.gen +4484 -2975
- data/doc/todo/TODO_FOR_THE_GTK_PARADISE_PROJECT.md +281 -218
- data/doc/todo/recurring_todo_tasks.md +4 -3
- data/gtk_paradise.gemspec +28 -17
- data/lib/gtk_paradise/app/app.rb +77 -45
- data/lib/gtk_paradise/app/{app_module.rb → app_module/app_module.rb} +1064 -899
- data/lib/gtk_paradise/base_module/base_module.rb +7043 -33
- data/lib/gtk_paradise/base_module/class_methods/class_methods.rb +0 -0
- data/lib/gtk_paradise/base_module/css.rb +200 -268
- data/lib/gtk_paradise/base_module/experimental.rb +119 -0
- data/lib/gtk_paradise/base_module/html_support.rb +40 -15
- data/lib/gtk_paradise/base_module/these_methods_work_for_gtk3_and_gtk4.rb +155 -0
- data/lib/gtk_paradise/base_module_and_app_module/base_module_and_app_module.rb +1 -1
- data/lib/gtk_paradise/colours/colour_palette/material_design.rb +239 -0
- data/lib/gtk_paradise/colours/gtk_colour_constants.rb +8 -2
- data/lib/gtk_paradise/colours/parse.rb +8 -1
- data/lib/gtk_paradise/commandline/commandline.rb +20 -19
- data/lib/gtk_paradise/constants/constants.rb +227 -7
- data/lib/gtk_paradise/css_files/borders.css +81 -0
- data/lib/gtk_paradise/css_files/colours.css +329 -328
- data/lib/gtk_paradise/css_files/css_accordion.css +6 -2
- data/lib/gtk_paradise/css_files/hover_effects.css +588 -0
- data/lib/gtk_paradise/css_files/project.css +153 -189
- data/lib/gtk_paradise/drawing/README.md +3 -0
- data/lib/gtk_paradise/drawing/drawing.rb +68 -0
- data/lib/gtk_paradise/{base_module/colours.rb → drawing/event.rb} +37 -45
- data/lib/gtk_paradise/drawing/star.rb +96 -0
- data/lib/gtk_paradise/drawing/tool.rb +268 -0
- data/lib/gtk_paradise/drawing/turtle.rb +138 -0
- data/lib/gtk_paradise/emojis/emojis.rb +14 -13
- data/lib/gtk_paradise/examples/advanced/001_5x5_grid_example.rb +35 -50
- data/lib/gtk_paradise/examples/advanced/002_advanced_drag_and_drop_example.rb +21 -13
- data/lib/gtk_paradise/examples/advanced/003_html_like_support.rb +4 -25
- data/lib/gtk_paradise/examples/advanced/004_on_hover_example_on_gtk_entry.rb +4 -4
- data/lib/gtk_paradise/examples/advanced/005_csv_example.rb +6 -2
- data/lib/gtk_paradise/examples/advanced/007_label_responding_to_events_example.rb +1 -10
- data/lib/gtk_paradise/examples/advanced/008_options_example.rb +6 -3
- data/lib/gtk_paradise/examples/advanced/009_key_events.rb +1 -1
- data/lib/gtk_paradise/examples/advanced/010_extensive_text_view_example.rb +18 -17
- data/lib/gtk_paradise/examples/advanced/011_moving_blocks_example.rb +3 -3
- data/lib/gtk_paradise/examples/advanced/012_cell_data_sorting_example.rb +3 -4
- data/lib/gtk_paradise/examples/advanced/013_advanced_css_example.rb +86 -49
- data/lib/gtk_paradise/examples/advanced/014_popup_example.rb +9 -9
- data/lib/gtk_paradise/examples/advanced/015_advanced_button_example.rb +7 -19
- data/lib/gtk_paradise/examples/advanced/017_lean_CSS_example.rb +10 -13
- data/lib/gtk_paradise/examples/advanced/018_coloured_text_example.rb +7 -13
- data/lib/gtk_paradise/examples/advanced/019_gtk_entry_showing_the_cursor_position.rb +1 -1
- data/lib/gtk_paradise/examples/advanced/020_scale_this_image.rb +1 -10
- data/lib/gtk_paradise/examples/advanced/021_scroll_events_on_gtk_entry.rb +4 -0
- data/lib/gtk_paradise/examples/advanced/022_autogenerated_CSS_rounded_borders.rb +142 -0
- data/lib/gtk_paradise/examples/advanced/023_append_image_to_buffer.rb +145 -0
- data/lib/gtk_paradise/examples/advanced/024_notebook_with_tab_example.rb +151 -0
- data/lib/gtk_paradise/examples/advanced/025_showing_a_gold_caret_on_black_background.rb +144 -0
- data/lib/gtk_paradise/examples/advanced/026_status_bar_example.rb +153 -0
- data/lib/gtk_paradise/examples/advanced/027_customized_frame_example.rb +141 -0
- data/lib/gtk_paradise/examples/advanced/028_widgets_described_in_a_yaml_file.rb +240 -0
- data/lib/gtk_paradise/examples/cairo/basic_cairo_shapes.rb +1 -1
- data/lib/gtk_paradise/examples/cairo/cairo_transparent_rectangles.rb +9 -5
- data/lib/gtk_paradise/examples/cairo/cairo_write_via_custom_font.rb +81 -0
- data/lib/gtk_paradise/examples/cairo/donut_shape.rb +19 -6
- data/lib/gtk_paradise/examples/cairo/ping_pong_game.rb +2 -3
- data/lib/gtk_paradise/examples/controller/README.md +4 -0
- data/lib/gtk_paradise/examples/controller/controller.rb +2 -0
- data/lib/gtk_paradise/examples/css/001_border_examples.rb +30 -13
- data/lib/gtk_paradise/examples/css/002_import_CSS_file.rb +10 -5
- data/lib/gtk_paradise/examples/drawing/001_example.rb +61 -0
- data/lib/gtk_paradise/examples/drawing/002_example.rb +51 -0
- data/lib/gtk_paradise/examples/drawing/003_example.rb +38 -0
- data/lib/gtk_paradise/examples/drawing/004_example.rb +36 -0
- data/lib/gtk_paradise/examples/drawing/005_example.rb +92 -0
- data/lib/gtk_paradise/examples/drawing/006_example.rb +58 -0
- data/lib/gtk_paradise/examples/drawing/007_example.rb +22 -0
- data/lib/gtk_paradise/examples/drawing/008_example.rb +43 -0
- data/lib/gtk_paradise/examples/drawing/009_example.rb +43 -0
- data/lib/gtk_paradise/examples/drawing/010_example.rb +25 -0
- data/lib/gtk_paradise/examples/drawing/011_example.rb +72 -0
- data/lib/gtk_paradise/examples/drawing/012_example.rb +59 -0
- data/lib/gtk_paradise/examples/drawing/README.md +3 -0
- data/lib/gtk_paradise/examples/drawing/moving_turtle_example.rb +43 -0
- data/lib/gtk_paradise/examples/gdk/001_gdk_screen_properties.rb +58 -0
- data/lib/gtk_paradise/examples/gdk_pixbuf/save_image_example.rb +1 -1
- data/lib/gtk_paradise/examples/gir_ffi/001_hello_world.rb +29 -0
- data/lib/gtk_paradise/examples/gir_ffi/002_upgraded_hello_world.rb +40 -0
- data/lib/gtk_paradise/examples/gir_ffi/003_gtk_application_example.rb +30 -0
- data/lib/gtk_paradise/examples/gir_ffi/004_treeview_example.rb +64 -0
- data/lib/gtk_paradise/examples/gir_ffi/005_complex_example.rb +104 -0
- data/lib/gtk_paradise/examples/gir_ffi/README.md +5 -0
- data/lib/gtk_paradise/examples/glib/parse_glib_settings.rb +1 -1
- data/lib/gtk_paradise/examples/gtk2/008_list_store_example.rb +1 -1
- data/lib/gtk_paradise/examples/gtk3/{061_gtk_entry.rb → 001_gtk_entry.rb} +11 -6
- data/lib/gtk_paradise/examples/gtk3/{009_scrolled_window_example.rb → 002_scrolled_window_example.rb} +6 -4
- data/lib/gtk_paradise/examples/gtk3/{062_toggle_button_example.rb → 003_toggle_button_example.rb} +3 -2
- data/lib/gtk_paradise/examples/gtk3/{081_simple_dialog_example.rb → 004_simple_dialog_example.rb} +19 -12
- data/lib/gtk_paradise/examples/gtk3/005_spinner_example.rb +30 -10
- data/lib/gtk_paradise/examples/gtk3/006_text_view_example.rb +78 -0
- data/lib/gtk_paradise/examples/gtk3/{079_two_windows_example.rb → 007_two_windows_example.rb} +3 -1
- data/lib/gtk_paradise/examples/gtk3/008_search_bar_example.rb +91 -0
- data/lib/gtk_paradise/examples/gtk3/{002_simple_window.rb → 009_simple_window.rb} +14 -6
- data/lib/gtk_paradise/examples/gtk3/{025_switch_example.rb → 010_switch_example.rb} +6 -7
- data/lib/gtk_paradise/examples/gtk3/011_colour_chooser_example.rb +71 -0
- data/lib/gtk_paradise/examples/gtk3/012_show_the_xid_example.rb +18 -0
- data/lib/gtk_paradise/examples/gtk3/013_grab_pointer_forcefully.rb +31 -0
- data/lib/gtk_paradise/examples/gtk3/{083_bottom_left_placement.rb → 015_bottom_left_placement.rb} +3 -1
- data/lib/gtk_paradise/examples/gtk3/{082_scrolling_example.rb → 016_scrolling_example.rb} +2 -2
- data/lib/gtk_paradise/examples/gtk3/{080_extensive_markup_example.rb → 017_extensive_markup_example.rb} +8 -7
- data/lib/gtk_paradise/examples/gtk3/{078_message_dialog_example.rb → 018_message_dialog_example.rb} +3 -5
- data/lib/gtk_paradise/examples/gtk3/{075_tiny_button_via_css.rb → 021_tiny_button_via_css.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{001_font_related_information.rb → 022_font_related_information.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/023_sorted_tree.rb +166 -0
- data/lib/gtk_paradise/examples/gtk3/{004_small_paned_example.rb → 024_small_paned_example.rb} +4 -3
- data/lib/gtk_paradise/examples/gtk3/{007_progress_bar_example.rb → 026_progress_bar_example.rb} +1 -2
- data/lib/gtk_paradise/examples/gtk3/{008_menubar_example.rb → 027_menubar_example.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{010_paned_widget_example.rb → 028_paned_widget_example.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{011_sockets.rb → 029_sockets.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{012_notebook_example.rb → 030_notebook_example.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{013_icon_theme_example.rb → 031_icon_theme_example.rb} +6 -0
- data/lib/gtk_paradise/examples/gtk3/{014_switcher_window.rb → 032_switcher_window.rb} +16 -10
- data/lib/gtk_paradise/examples/gtk3/{016_hello_world_in_gtk3_and_bold_font.rb → 034_hello_world_in_gtk3_and_bold_font.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{017_grid_example.rb → 035_grid_example.rb} +5 -1
- data/lib/gtk_paradise/examples/gtk3/{018_buttons_showcasing_the_relief.rb → 036_buttons_showcasing_the_relief.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{019_text_buffer_example.rb → 037_text_buffer_example.rb} +12 -10
- data/lib/gtk_paradise/examples/gtk3/{022_popup_example.rb → 040_popup_example.rb} +2 -2
- data/lib/gtk_paradise/examples/gtk3/{023_horizontal_and_vertical_scale.rb → 041_horizontal_and_vertical_scale.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{026_hover_button_example_via_css.rb → 043_hover_button_example_via_css.rb} +3 -1
- data/lib/gtk_paradise/examples/gtk3/{027_spin_button_example.rb → 044_spin_button_example.rb} +4 -3
- data/lib/gtk_paradise/examples/gtk3/{028_radio_menu_item_example.rb → 045_radio_menu_item_example.rb} +4 -1
- data/lib/gtk_paradise/examples/gtk3/{029_gtk_dialog_sample.rb → 046_gtk_dialog_sample.rb} +4 -1
- data/lib/gtk_paradise/examples/gtk3/{030_draw_rectangles.rb → 047_draw_rectangles.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{031_colour_choose_button.rb → 048_colour_choose_button.rb} +17 -3
- data/lib/gtk_paradise/examples/gtk3/{032_drag_and_drop_example.rb → 049_drag_and_drop_example.rb} +13 -5
- data/lib/gtk_paradise/examples/gtk3/{033_cell_renderer_pixbuf_example.rb → 050_cell_renderer_pixbuf_example.rb} +17 -6
- data/lib/gtk_paradise/examples/gtk3/051_combo_box_example.rb +74 -0
- data/lib/gtk_paradise/examples/gtk3/{037_css_example_of_a_button_changing_the_background_colour_on_click_event.rb → 053_css_example_of_a_button_changing_the_background_colour_on_click_event.rb} +14 -4
- data/lib/gtk_paradise/examples/gtk3/{036_revealer_example.rb → 053_revealer_example.rb} +10 -6
- data/lib/gtk_paradise/examples/gtk3/{038_ten_labels_in_a_vertical_box_example.rb → 054_ten_labels_in_a_vertical_box_example.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{039_threads_example.rb → 055_threads_example.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{042_colourized_button_example.rb → 058_colourized_button_example.rb} +1 -2
- data/lib/gtk_paradise/examples/gtk3/{043_form_example.rb → 059_form_example.rb} +1 -3
- data/lib/gtk_paradise/examples/gtk3/{044_check_button.rb → 060_check_button.rb} +4 -2
- data/lib/gtk_paradise/examples/gtk3/{046_event_box_example.rb → 062_event_box_example.rb} +2 -1
- data/lib/gtk_paradise/examples/gtk3/{047_examples_with_css.rb → 063_examples_with_css.rb} +91 -3
- data/lib/gtk_paradise/examples/gtk3/{048_accel_group_example.rb → 064_accel_group_example.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{049_change_the_application_theme.rb → 065_change_the_application_theme.rb} +4 -2
- data/lib/gtk_paradise/examples/gtk3/{050_header_bar_example.rb → 066_header_bar_example.rb} +3 -0
- data/lib/gtk_paradise/examples/gtk3/{051_gtk_label_example.rb → 067_gtk_label_example.rb} +3 -2
- data/lib/gtk_paradise/examples/gtk3/{052_popover_example.rb → 068_popover_example.rb} +2 -2
- data/lib/gtk_paradise/examples/gtk3/{053_entry_completion.rb → 069_entry_completion.rb} +2 -0
- data/lib/gtk_paradise/examples/gtk3/{055_button_demo.rb → 071_button_demo.rb} +6 -5
- data/lib/gtk_paradise/examples/gtk3/{056_text_iterator_example.rb → 072_text_iterator_example.rb} +30 -21
- data/lib/gtk_paradise/examples/gtk3/{057_image_example.rb → 073_image_example.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{058_frame_example.rb → 074_frame_example.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{059_gtk_expander.rb → 075_gtk_expander.rb} +2 -0
- data/lib/gtk_paradise/examples/gtk3/{060_ten_vboxes_example.rb → 076_ten_vboxes_example.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{063_button_box_example.rb → 077_button_box_example.rb} +11 -1
- data/lib/gtk_paradise/examples/gtk3/{064_tree_view_column_example.rb → 078_tree_view_column_example.rb} +2 -1
- data/lib/gtk_paradise/examples/gtk3/{066_vertical_boxes.rb → 080_vertical_boxes.rb} +2 -1
- data/lib/gtk_paradise/examples/gtk3/{067_vbox_with_spacing_and_border_width.rb → 081_vbox_with_spacing_and_border_width.rb} +2 -1
- data/lib/gtk_paradise/examples/gtk3/{069_file_chooser_dialog.rb → 082_file_chooser_dialog.rb} +3 -0
- data/lib/gtk_paradise/examples/gtk3/{070_bindings.rb → 083_bindings.rb} +14 -8
- data/lib/gtk_paradise/examples/gtk3/{072_recent_chooser_dialog.rb → 084_recent_chooser_dialog.rb} +2 -2
- data/lib/gtk_paradise/examples/gtk3/{073_showcase_the_cursors.rb → 085_showcase_the_cursors.rb} +30 -5
- data/lib/gtk_paradise/examples/gtk3/{074_app_chooser_button_example.rb → 086_app_chooser_button_example.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/087_calendar_example.rb +41 -0
- data/lib/gtk_paradise/examples/gtk4/001_gtk_entry.rb +88 -0
- data/lib/gtk_paradise/examples/gtk4/002_scrolled_window_example.rb +62 -0
- data/lib/gtk_paradise/examples/gtk4/003_toggle_button_example.rb +23 -0
- data/lib/gtk_paradise/examples/gtk4/004_simple_dialog_example.rb +41 -0
- data/lib/gtk_paradise/examples/gtk4/005_spinner_example.rb +64 -0
- data/lib/gtk_paradise/examples/gtk4/006_text_view_example.rb +77 -0
- data/lib/gtk_paradise/examples/gtk4/007_two_windows_example.rb +55 -0
- data/lib/gtk_paradise/examples/gtk4/008_search_bar_example.rb +88 -0
- data/lib/gtk_paradise/examples/gtk4/009_text_view_example.rb +30 -0
- data/lib/gtk_paradise/examples/gtk4/010_switch_example.rb +52 -0
- data/lib/gtk_paradise/examples/gtk4/074_frame_example.rb +105 -0
- data/lib/gtk_paradise/examples/gtk4/076_ten_vboxes_example.rb +35 -0
- data/lib/gtk_paradise/examples/gtk4/087_calendar_example.rb +47 -0
- data/lib/gtk_paradise/examples/gtk4/100_changed_events_example.rb +77 -0
- data/lib/gtk_paradise/examples/gtk4/101_actionbar_example.rb +55 -0
- data/lib/gtk_paradise/examples/gtk4/102_picture_example.rb +35 -0
- data/lib/gtk_paradise/examples/pango/pango_power.rb +1 -0
- data/lib/gtk_paradise/experimental/experimental.rb +3 -11
- data/lib/gtk_paradise/experimental/experimental_for_gtk4.rb +92 -0
- data/lib/gtk_paradise/fonts/fonts.rb +5 -1
- data/lib/gtk_paradise/gdk/cursor.rb +2 -2
- data/lib/gtk_paradise/{base_module/e.rb → gdk/event_crossing.rb} +6 -8
- data/lib/gtk_paradise/gdk/gdk.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/about.rb +11 -2
- data/lib/gtk_paradise/gtk_classes/about_dialog.rb +6 -2
- data/lib/gtk_paradise/gtk_classes/alignment.rb +4 -1
- data/lib/gtk_paradise/gtk_classes/application.rb +94 -4
- data/lib/gtk_paradise/gtk_classes/application_window.rb +25 -0
- data/lib/gtk_paradise/gtk_classes/box.rb +116 -279
- data/lib/gtk_paradise/gtk_classes/button.rb +55 -37
- data/lib/gtk_paradise/gtk_classes/button_box.rb +9 -1
- data/lib/gtk_paradise/gtk_classes/cell_renderer_text.rb +5 -3
- data/lib/gtk_paradise/gtk_classes/check_button.rb +27 -8
- data/lib/gtk_paradise/gtk_classes/combo_box.rb +4 -1
- data/lib/gtk_paradise/gtk_classes/combo_box_entry.rb +17 -11
- data/lib/gtk_paradise/gtk_classes/combo_box_text.rb +21 -19
- data/lib/gtk_paradise/gtk_classes/dialog.rb +2 -2
- data/lib/gtk_paradise/gtk_classes/entry.rb +256 -124
- data/lib/gtk_paradise/gtk_classes/entry_completion.rb +4 -0
- data/lib/gtk_paradise/gtk_classes/event_box.rb +21 -2
- data/lib/gtk_paradise/gtk_classes/event_button.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/expander.rb +8 -1
- data/lib/gtk_paradise/gtk_classes/file_chooser_dialog.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/file_filter.rb +4 -2
- data/lib/gtk_paradise/gtk_classes/file_selection.rb +4 -3
- data/lib/gtk_paradise/gtk_classes/frame.rb +19 -1
- data/lib/gtk_paradise/gtk_classes/grid.rb +206 -160
- data/lib/gtk_paradise/gtk_classes/hbox.rb +145 -0
- data/lib/gtk_paradise/gtk_classes/header_bar.rb +19 -8
- data/lib/gtk_paradise/gtk_classes/image.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/label.rb +174 -135
- data/lib/gtk_paradise/gtk_classes/menu.rb +7 -3
- data/lib/gtk_paradise/gtk_classes/menu_bar.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/menu_item.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/notebook.rb +114 -64
- data/lib/gtk_paradise/gtk_classes/paned.rb +52 -0
- data/lib/gtk_paradise/gtk_classes/radio_menu_item.rb +19 -1
- data/lib/gtk_paradise/gtk_classes/scale_button.rb +16 -1
- data/lib/gtk_paradise/gtk_classes/scrolled_window.rb +8 -6
- data/lib/gtk_paradise/gtk_classes/search_bar.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/source_buffer.rb +4 -5
- data/lib/gtk_paradise/gtk_classes/spin_button.rb +9 -1
- data/lib/gtk_paradise/gtk_classes/spinner.rb +32 -2
- data/lib/gtk_paradise/gtk_classes/status_icon.rb +2 -0
- data/lib/gtk_paradise/gtk_classes/statusbar.rb +1 -0
- data/lib/gtk_paradise/gtk_classes/style_context.rb +71 -0
- data/lib/gtk_paradise/gtk_classes/text_buffer.rb +45 -19
- data/lib/gtk_paradise/gtk_classes/text_view.rb +20 -3
- data/lib/gtk_paradise/gtk_classes/toggle_button.rb +3 -0
- data/lib/gtk_paradise/gtk_classes/toolbar.rb +2 -2
- data/lib/gtk_paradise/gtk_classes/tree_iter.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/tree_view.rb +93 -70
- data/lib/gtk_paradise/gtk_classes/tree_view_column.rb +2 -1
- data/lib/gtk_paradise/gtk_classes/vbox.rb +71 -10
- data/lib/gtk_paradise/gtk_classes/vscale.rb +2 -2
- data/lib/gtk_paradise/gtk_classes/widget.rb +1057 -590
- data/lib/gtk_paradise/gtk_classes/window.rb +37 -2
- data/lib/gtk_paradise/hello_world/README.md +1 -1
- data/lib/gtk_paradise/hello_world/hello_world_gtk4.rb +20 -0
- data/lib/gtk_paradise/images/icons/close_image.png +0 -0
- data/lib/gtk_paradise/images/icons/closed.png +0 -0
- data/lib/gtk_paradise/images/icons/directory.png +0 -0
- data/lib/gtk_paradise/images/icons/icon_cool.gif +0 -0
- data/lib/gtk_paradise/images/icons/icon_lol.gif +0 -0
- data/lib/gtk_paradise/images/icons/icon_smile.gif +0 -0
- data/lib/gtk_paradise/images/icons/opened.png +0 -0
- data/lib/gtk_paradise/images/internal/gtk_label_example.png +0 -0
- data/lib/gtk_paradise/images/misc/wiki_logo.png +0 -0
- data/lib/gtk_paradise/images/small/GREEN_CIRCLE.png +0 -0
- data/lib/gtk_paradise/images/small/README.md +2 -0
- data/lib/gtk_paradise/images/small/RED_CIRCLE.png +0 -0
- data/lib/gtk_paradise/pango/{pango_fonts.rb → fonts.rb} +2 -2
- data/lib/gtk_paradise/pango/{pango.rb → layout.rb} +1 -1
- data/lib/gtk_paradise/pango/pango_renderer.rb +9 -2
- data/lib/gtk_paradise/project/project.rb +4 -3
- data/lib/gtk_paradise/prototypes/README.md +8 -0
- data/lib/gtk_paradise/prototypes/gtk3_standalone.rb +8 -21
- data/lib/gtk_paradise/prototypes/gtk4_standalone.rb +135 -0
- data/lib/gtk_paradise/prototypes/shared_code.rb +5 -15
- data/lib/gtk_paradise/prototypes/unified_gtk_prototype.rb +179 -0
- data/lib/gtk_paradise/require_gtk4.rb +7 -0
- data/lib/gtk_paradise/requires/require_base_module.rb +7 -0
- data/lib/gtk_paradise/requires/require_files_irrespective_of_the_gtk_version_at_hand.rb +25 -16
- data/lib/gtk_paradise/requires/require_gtk2.rb +6 -4
- data/lib/gtk_paradise/requires/{require_gtk2_or_gtk3.rb → require_gtk2_or_gtk3_or_gtk4.rb} +33 -12
- data/lib/gtk_paradise/requires/require_gtk3.rb +5 -20
- data/lib/gtk_paradise/requires/require_gtk4.rb +13 -0
- data/lib/gtk_paradise/requires/require_gtk_runner.rb +1 -0
- data/lib/gtk_paradise/requires/require_the_base_module_and_gtk_run.rb +1 -1
- data/lib/gtk_paradise/requires/require_the_base_module_the_app_module_and_the_toplevel_methods.rb +9 -0
- data/lib/gtk_paradise/requires/require_the_classes_files_for_gtk4.rb +11 -0
- data/lib/gtk_paradise/requires/require_the_colours_gem.rb +9 -0
- data/lib/gtk_paradise/requires/require_the_default_gtk_version.rb +4 -2
- data/lib/gtk_paradise/requires/require_the_toplevel_methods.rb +1 -1
- data/lib/gtk_paradise/run.rb +1 -0
- data/lib/gtk_paradise/run_this_widget/run_this_widget.rb +7 -3
- data/lib/gtk_paradise/threads/threads.rb +15 -10
- data/lib/gtk_paradise/toplevel_methods/css.rb +183 -35
- data/lib/gtk_paradise/toplevel_methods/cursor.rb +17 -3
- data/lib/gtk_paradise/toplevel_methods/determine_which_gtk_version_is_in_use.rb +90 -8
- data/lib/gtk_paradise/toplevel_methods/events.rb +6 -0
- data/lib/gtk_paradise/toplevel_methods/keys.rb +1 -1
- data/lib/gtk_paradise/toplevel_methods/screen_resolution.rb +32 -5
- data/lib/gtk_paradise/toplevel_methods/text_buffer_tags.rb +13 -4
- data/lib/gtk_paradise/toplevel_methods/tokenizer.rb +18 -3
- data/lib/gtk_paradise/toplevel_methods/{misc.rb → toplevel_methods.rb} +728 -181
- data/lib/gtk_paradise/utility_scripts/commandline_to_automatic_gui.rb +244 -0
- data/lib/gtk_paradise/version/version.rb +2 -2
- data/lib/gtk_paradise/widgets/gtk2/cat_merge.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/cell_renderer_progress_example.rb +0 -5
- data/lib/gtk_paradise/widgets/gtk2/foto_lister.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/gidnight_commander/gidnight_commander.rb +3 -3
- data/lib/gtk_paradise/widgets/gtk2/hbox_example.rb +1 -5
- data/lib/gtk_paradise/widgets/gtk2/multiple_select_in_a_tree_view_widget.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/paned_example.rb +1 -1
- data/lib/gtk_paradise/widgets/gtk2/slider_changing_button.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/status_icon_example.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/table2.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/toolbar_example.rb +2 -6
- data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/audio_button}/audio_button.rb +15 -26
- data/lib/gtk_paradise/widgets/gtk3/burn_this_iso_file/burn_this_iso_file.rb +2 -6
- data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/button_open_remote_webpage}/button_open_remote_webpage.rb +105 -50
- data/lib/gtk_paradise/widgets/gtk3/button_with_border/button_with_border.rb +155 -0
- data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/button_xorg_buffer}/button_xorg_buffer.rb +76 -18
- data/lib/gtk_paradise/widgets/gtk3/calculator/calculator.rb +183 -76
- data/lib/gtk_paradise/widgets/gtk3/checkbox_image/checkbox_image.rb +3 -7
- data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/coloured_button}/coloured_button.rb +94 -24
- data/lib/gtk_paradise/widgets/gtk3/coloured_square/coloured_square.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/coloured_unit/coloured_unit.rb +151 -0
- data/lib/gtk_paradise/widgets/gtk3/cpu_widget/cpu_widget.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/directory_content_widget/directory_content_widget.rb +937 -7
- data/lib/gtk_paradise/widgets/gtk3/editor/connect_skeleton.rb +33 -38
- data/lib/gtk_paradise/widgets/gtk3/editor/create.rb +66 -41
- data/lib/gtk_paradise/widgets/gtk3/editor/editor.rb +256 -270
- data/lib/gtk_paradise/widgets/gtk3/editor/internal_widgets/goto_line_widget.rb +52 -65
- data/lib/gtk_paradise/widgets/gtk3/editor/misc.rb +358 -111
- data/lib/gtk_paradise/widgets/gtk3/files_in_directory/files_in_directory.rb +2 -7
- data/lib/gtk_paradise/widgets/gtk3/flexible_vte/flexible_vte.rb +3 -7
- data/lib/gtk_paradise/widgets/gtk3/font_size_widget/action_button.rb +1 -5
- data/lib/gtk_paradise/widgets/gtk3/font_size_widget/font_size_widget.rb +2 -6
- data/lib/gtk_paradise/widgets/{gtk2 → gtk3}/gidnight_commander/gidnight_commander.config +1 -2
- data/lib/gtk_paradise/widgets/gtk3/gidnight_commander/gidnight_commander.rb +165 -125
- data/lib/gtk_paradise/widgets/gtk3/image_close_on_click_action/image_close_on_click_action.rb +34 -2
- data/lib/gtk_paradise/widgets/gtk3/image_viewer/image_viewer.rb +23 -26
- data/lib/gtk_paradise/widgets/gtk3/information_about_the_harddisc/harddisc_information.rb +161 -0
- data/lib/gtk_paradise/widgets/gtk3/insert_character/insert_character.rb +24 -29
- data/lib/gtk_paradise/widgets/gtk3/linux_users/linux_users.rb +32 -32
- data/lib/gtk_paradise/widgets/gtk3/my_calendar/my_calendar.rb +330 -7
- data/lib/gtk_paradise/widgets/gtk3/my_image_menu_item/my_image_menu_item.rb +179 -0
- data/lib/gtk_paradise/widgets/gtk3/non_numbers_only/non_numbers_only.rb +136 -0
- data/lib/gtk_paradise/widgets/gtk3/note_window/note_window.rb +199 -0
- data/lib/gtk_paradise/widgets/gtk3/notebook_controller/notebook_controller.rb +311 -7
- data/lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb +402 -7
- data/lib/gtk_paradise/widgets/gtk3/numbered_lines/numbered_lines.rb +128 -82
- data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/numbers_only}/numbers_only.rb +15 -3
- data/lib/gtk_paradise/widgets/gtk3/ping_widget/ping_widget.rb +491 -8
- data/lib/gtk_paradise/widgets/gtk3/regex_matcher/regex_matcher.rb +362 -43
- data/lib/gtk_paradise/widgets/gtk3/rename_widget/rename_widget.rb +8 -25
- data/lib/gtk_paradise/widgets/gtk3/show_which_key_was_pressed/show_which_key_was_pressed.rb +190 -0
- data/lib/gtk_paradise/widgets/gtk3/stopwatch/stopwatch.rb +318 -7
- data/lib/gtk_paradise/widgets/gtk3/sys_message/sys_message.rb +219 -7
- data/lib/gtk_paradise/widgets/gtk3/system_information/system_information.rb +58 -34
- data/lib/gtk_paradise/widgets/gtk3/tabble/admin_panel.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/tabble/image_and_button.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/tabble/tabble.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/view_webpage/view_webpage.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/wiki/README.md +4 -0
- data/lib/gtk_paradise/widgets/gtk3/wiki/wiki.rb +388 -0
- data/lib/gtk_paradise/widgets/gtk4/ping_widget/ping_widget.rb +4 -0
- data/lib/gtk_paradise/widgets/gtk4/show_icon_theme/show_icon_theme.rb +134 -0
- data/lib/gtk_paradise/widgets/gtk4/sys_message/sys_message.rb +269 -0
- data/lib/gtk_paradise/widgets/{gtk2/stopwatch/stopwatch.rb → gtk4/xpm_loader/xpm_loader.rb} +13 -11
- data/lib/gtk_paradise/widgets/shared_code/browser/browser_module.rb +4 -16
- data/lib/gtk_paradise/widgets/shared_code/cdripper/cdripper_module.rb +1 -1
- data/lib/gtk_paradise/widgets/shared_code/colour_filled_widget/colour_filled_widget_module.rb +25 -28
- data/lib/gtk_paradise/widgets/shared_code/colour_palette/colour_palette_module.rb +2 -2
- data/lib/gtk_paradise/widgets/shared_code/contacts/contacts_module.rb +62 -64
- data/lib/gtk_paradise/widgets/shared_code/flip_state_widget/flip_state_widget_module.rb +3 -19
- data/lib/gtk_paradise/widgets/shared_code/information_about_the_harddisc/harddisc_information.rb +0 -155
- data/lib/gtk_paradise/widgets/shared_code/information_about_the_harddisc/information_about_the_harddisc_module.rb +0 -444
- data/lib/gtk_paradise/widgets/shared_code/lsmod/lsmod_module.rb +22 -26
- data/lib/gtk_paradise/widgets/shared_code/lspci/lspci_module.rb +24 -36
- data/lib/gtk_paradise/widgets/shared_code/mini_clock/mini_clock_module.rb +74 -58
- data/lib/gtk_paradise/widgets/shared_code/my_calendar/my_calendar_module.rb +0 -327
- data/lib/gtk_paradise/widgets/shared_code/pid_displayer/pid_displayer_module.rb +53 -41
- data/lib/gtk_paradise/widgets/shared_code/random_image/random_image_module.rb +46 -29
- data/lib/gtk_paradise/widgets/shared_code/select_file/select_file_module.rb +1 -1
- data/lib/gtk_paradise/widgets/shared_code/show_icon_theme/show_icon_theme_module.rb +56 -44
- data/lib/gtk_paradise/widgets/shared_code/simple_clock/simple_clock_module.rb +1 -12
- data/lib/gtk_paradise/widgets/shared_code/stopwatch/stopwatch_module.rb +0 -341
- data/lib/gtk_paradise/widgets/shared_code/sys_message/sys_message_module.rb +0 -211
- data/lib/gtk_paradise/widgets/shared_code/tabby/tabby_module.rb +3 -15
- data/lib/gtk_paradise/widgets/shared_code/xpm_loader/xpm_loader_module.rb +15 -23
- data/lib/gtk_paradise/www/index.cgi +2 -2
- data/lib/gtk_paradise/yaml/browser_URLs.yml +3 -4
- data/lib/gtk_paradise/yaml/configuration_options_for_class_gtk_runner.yml +6 -6
- data/lib/gtk_paradise/yaml/experimental/README.md +3 -0
- data/lib/gtk_paradise/yaml/experimental/all_widgets.yml +37 -0
- data/lib/gtk_paradise/yaml/menu.yml +6 -3
- data/lib/gtk_paradise/yaml/notebook_controller.yml +62 -29
- data/lib/gtk_paradise.rb +0 -5
- data/test/gtk2/testing_combo_box.rb +1 -0
- data/test/gtk2/testing_display.rb +23 -0
- data/test/gtk2/testing_gtk_image.rb +4 -3
- data/test/gtk2/testing_hbox_and_vbox.rb +37 -0
- data/test/gtk2/testing_label_with_ampersand.rb +5 -2
- data/test/gtk2/testing_notebook.rb +11 -5
- data/test/gtk3/test_widget.rb +2 -1
- data/test/gtk3/testing_app.rb +0 -1
- data/test/gtk3/testing_base_module.rb +2 -1
- data/test/gtk3/testing_numbered_lines.rb +20 -0
- data/test/gtk3/testing_project_base_directory.rb +6 -1
- data/test/gtk3/testing_the_html_pseudo_tags.rb +2 -2
- data/test/gtk4/testing_gtk_entry.rb +24 -0
- data/test/misc/testing_a_gtk_frame.rb +14 -0
- data/test/misc/testing_gtk4_simplifications.rb +105 -0
- data/test/misc/testing_gtk_paradise_runner.rb +19 -4
- data/test/misc/testing_the_gtk_classes.rb +83 -0
- metadata +246 -199
- data/lib/gtk_paradise/base_module/change_directory.rb +0 -22
- data/lib/gtk_paradise/base_module/combo_box_and_combo_box_entry.rb +0 -113
- data/lib/gtk_paradise/base_module/commandline_arguments.rb +0 -36
- data/lib/gtk_paradise/base_module/configuration.rb +0 -50
- data/lib/gtk_paradise/base_module/constants.rb +0 -23
- data/lib/gtk_paradise/base_module/debug.rb +0 -127
- data/lib/gtk_paradise/base_module/draggable.rb +0 -95
- data/lib/gtk_paradise/base_module/emoji.rb +0 -107
- data/lib/gtk_paradise/base_module/esystem.rb +0 -22
- data/lib/gtk_paradise/base_module/events.rb +0 -111
- data/lib/gtk_paradise/base_module/fonts.rb +0 -119
- data/lib/gtk_paradise/base_module/graphics_display.rb +0 -47
- data/lib/gtk_paradise/base_module/gtk3.rb +0 -43
- data/lib/gtk_paradise/base_module/gtk_buttons.rb +0 -562
- data/lib/gtk_paradise/base_module/gtk_entry.rb +0 -126
- data/lib/gtk_paradise/base_module/gtk_fixed.rb +0 -18
- data/lib/gtk_paradise/base_module/gtk_grid.rb +0 -61
- data/lib/gtk_paradise/base_module/gtk_image.rb +0 -501
- data/lib/gtk_paradise/base_module/gtk_label.rb +0 -211
- data/lib/gtk_paradise/base_module/gtk_notebook.rb +0 -88
- data/lib/gtk_paradise/base_module/gtk_scrolled_window.rb +0 -155
- data/lib/gtk_paradise/base_module/misc.rb +0 -2949
- data/lib/gtk_paradise/base_module/pango.rb +0 -24
- data/lib/gtk_paradise/base_module/popover.rb +0 -241
- data/lib/gtk_paradise/base_module/register_sigint.rb +0 -20
- data/lib/gtk_paradise/base_module/reset.rb +0 -128
- data/lib/gtk_paradise/base_module/return_corresponding_gtk_stock_item.rb +0 -92
- data/lib/gtk_paradise/base_module/roebe.rb +0 -19
- data/lib/gtk_paradise/base_module/table.rb +0 -438
- data/lib/gtk_paradise/base_module/time.rb +0 -35
- data/lib/gtk_paradise/constants/available_cursors.rb +0 -52
- data/lib/gtk_paradise/constants/fonts.rb +0 -38
- data/lib/gtk_paradise/constants/misc.rb +0 -56
- data/lib/gtk_paradise/constants/newline.rb +0 -14
- data/lib/gtk_paradise/constants/xbm_icons.rb +0 -121
- data/lib/gtk_paradise/examples/gtk3/003_sorted_tree.rb +0 -141
- data/lib/gtk_paradise/examples/gtk3/034_combo_box_example.rb +0 -49
- data/lib/gtk_paradise/examples/gtk3/068_text_view_example.rb +0 -34
- data/lib/gtk_paradise/examples/gtk3/071_search_bar_example.rb +0 -59
- data/lib/gtk_paradise/gtk_classes/colours/colours.rb +0 -158
- data/lib/gtk_paradise/requires/require_the_minesweeper_files.rb +0 -11
- data/lib/gtk_paradise/toplevel_methods/allow_only_numbers.rb +0 -59
- data/lib/gtk_paradise/toplevel_methods/csv.rb +0 -102
- data/lib/gtk_paradise/toplevel_methods/e.rb +0 -18
- data/lib/gtk_paradise/toplevel_methods/enable_and_disable_warnings.rb +0 -58
- data/lib/gtk_paradise/toplevel_methods/keyboard.rb +0 -25
- data/lib/gtk_paradise/toplevel_methods/main_file.rb +0 -31
- data/lib/gtk_paradise/toplevel_methods/register_sigint.rb +0 -17
- data/lib/gtk_paradise/toplevel_methods/roebe.rb +0 -22
- data/lib/gtk_paradise/toplevel_methods/select_file.rb +0 -168
- data/lib/gtk_paradise/toplevel_methods/spacer.rb +0 -55
- data/lib/gtk_paradise/toplevel_methods/tooltips.rb +0 -71
- data/lib/gtk_paradise/toplevel_methods/we_use_this_gtk_version.rb +0 -65
- data/lib/gtk_paradise/widgets/gtk2/directory_content_widget/directory_content_widget.rb +0 -30
- data/lib/gtk_paradise/widgets/gtk2/my_calendar/my_calendar.config +0 -6
- data/lib/gtk_paradise/widgets/gtk2/my_calendar/my_calendar.rb +0 -34
- data/lib/gtk_paradise/widgets/gtk2/notebook_tab_with_icon/notebook_tab_with_icon.rb +0 -30
- data/lib/gtk_paradise/widgets/gtk2/ping_widget/ping_widget.rb +0 -30
- data/lib/gtk_paradise/widgets/gtk2/sys_message/sys_message.config +0 -6
- data/lib/gtk_paradise/widgets/gtk2/sys_message/sys_message.rb +0 -29
- data/lib/gtk_paradise/widgets/shared_code/directory_content_widget/constants.rb +0 -53
- data/lib/gtk_paradise/widgets/shared_code/directory_content_widget/directory_content_widget_module.rb +0 -777
- data/lib/gtk_paradise/widgets/shared_code/directory_content_widget/handle_this_file_or_symlink.rb +0 -83
- data/lib/gtk_paradise/widgets/shared_code/notebook_controller/notebook_controller_module.rb +0 -339
- data/lib/gtk_paradise/widgets/shared_code/notebook_tab_with_icon/notebook_tab_with_icon_module.rb +0 -297
- data/lib/gtk_paradise/widgets/shared_code/ping_widget/ping_widget_module.rb +0 -326
- data/lib/gtk_paradise/widgets/version_agnostic/button_with_border.rb +0 -63
- data/lib/gtk_paradise/widgets/version_agnostic/coloured_unit.rb +0 -54
- data/lib/gtk_paradise/widgets/version_agnostic/my_image_menu_item.rb +0 -103
- data/lib/gtk_paradise/widgets/version_agnostic/my_menu_item_separator.rb +0 -31
- data/lib/gtk_paradise/widgets/version_agnostic/non_numbers_only.rb +0 -66
- data/lib/gtk_paradise/widgets/version_agnostic/note_window.rb +0 -107
- /data/lib/gtk_paradise/examples/gtk3/{084_undecorated_window_example.rb → 014_undecorated_window_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{077_status_icon_example.rb → 019_status_icon_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{076_stack_example.rb → 020_stack_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{006_password_example.rb → 025_password_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{015_list_box_example.rb → 033_list_box_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{020_radio_button_window.rb → 038_radio_button_window.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{021_scale_button_demo.rb → 039_scale_button_demo.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{024_installation_assistant.rb → 042_installation_assistant.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{035_notebook_css_example.rb → 052_notebook_css_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{040_font_chooser_dialog_example.rb → 056_font_chooser_dialog_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{041_flowbox.rb → 057_flowbox.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{045_fixed_example.rb → 061_fixed_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{054_svg_viewer.rb → 070_svg_viewer.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{065_tooltips_example.rb → 079_tooltips_example.rb} +0 -0
@@ -3,28 +3,958 @@
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
# =========================================================================== #
|
5
5
|
# === Gtk::DirectoryContentWidget
|
6
|
+
#
|
7
|
+
# This widget will show the content of a given directory, that is
|
8
|
+
# whether there are directories, files and what not.
|
9
|
+
#
|
10
|
+
# The idea is to enhance this widget so that we can simply re-use
|
11
|
+
# it in many different projects as-is.
|
6
12
|
# =========================================================================== #
|
7
13
|
# require 'gtk_paradise/widgets/gtk3/directory_content_widget/directory_content_widget.rb'
|
8
|
-
# Gtk::DirectoryContentWidget.
|
14
|
+
# Gtk::DirectoryContentWidget.run
|
9
15
|
# =========================================================================== #
|
10
16
|
require 'gtk_paradise/require_gtk3'
|
11
17
|
|
12
18
|
module Gtk
|
13
19
|
|
14
|
-
class DirectoryContentWidget < ::Gtk::Box
|
20
|
+
class DirectoryContentWidget < ::Gtk::Box # === Gtk::DirectoryContentWidget
|
15
21
|
|
16
|
-
|
17
|
-
|
22
|
+
include ::Gtk::BaseModule
|
23
|
+
|
24
|
+
# ========================================================================= #
|
25
|
+
# === TITLE
|
26
|
+
# ========================================================================= #
|
27
|
+
TITLE = 'Directory Content'
|
28
|
+
|
29
|
+
# ========================================================================= #
|
30
|
+
# === WIDTH
|
31
|
+
# ========================================================================= #
|
32
|
+
WIDTH = '60% or minimum 1480px'
|
33
|
+
|
34
|
+
# ========================================================================= #
|
35
|
+
# === HEIGHT
|
36
|
+
# ========================================================================= #
|
37
|
+
HEIGHT = '50% or minimum 480px'
|
38
|
+
|
39
|
+
# ========================================================================= #
|
40
|
+
# === USE_THIS_FONT
|
41
|
+
# ========================================================================= #
|
42
|
+
USE_THIS_FONT = 'Noto Mono 16' # :hack_17 # :dejavu_condensed_17
|
43
|
+
|
44
|
+
# ========================================================================= #
|
45
|
+
# === USE_THIS_FONT_FOR_THE_SCROLLED_WINDOW
|
46
|
+
# ========================================================================= #
|
47
|
+
USE_THIS_FONT_FOR_THE_SCROLLED_WINDOW = 'Noto Mono 14'
|
48
|
+
|
49
|
+
# ========================================================================= #
|
50
|
+
# === HASH_DESIGNATED_KEY_COMBINATIONS
|
51
|
+
# ========================================================================= #
|
52
|
+
HASH_DESIGNATED_KEY_COMBINATIONS = {
|
53
|
+
'alt + ←' => 'down_by_one',
|
54
|
+
'alt + w' => 'down_by_one',
|
55
|
+
'alt + 1' => 'activate_list_at_position(0)',
|
56
|
+
'alt + 2' => 'activate_list_at_position(1)',
|
57
|
+
'alt + 3' => 'activate_list_at_position(2)',
|
58
|
+
'alt + 4' => 'activate_list_at_position(3)',
|
59
|
+
'alt + 5' => 'activate_list_at_position(4)',
|
60
|
+
'alt + 6' => 'activate_list_at_position(5)',
|
61
|
+
'alt + 7' => 'activate_list_at_position(6)',
|
62
|
+
'alt + 8' => 'activate_list_at_position(7)',
|
63
|
+
'alt + 9' => 'activate_list_at_position(8)'
|
64
|
+
}
|
65
|
+
|
66
|
+
# ========================================================================= #
|
67
|
+
# === initialize
|
68
|
+
# ========================================================================= #
|
69
|
+
def initialize(
|
70
|
+
optional_use_this_as_the_start_directory = :return_pwd,
|
71
|
+
run_already = true,
|
72
|
+
&block
|
73
|
+
)
|
74
|
+
super(:vertical)
|
75
|
+
reset
|
76
|
+
set_use_this_directory(
|
77
|
+
optional_use_this_as_the_start_directory
|
78
|
+
)
|
79
|
+
set_start_directory(use_this_directory?.dup) # Copy it on startup of this widget.
|
80
|
+
raw_cd(@user_configuration[:start_directory])
|
81
|
+
# ======================================================================= #
|
82
|
+
# === Handle blocks given next
|
83
|
+
# ======================================================================= #
|
84
|
+
if block_given?
|
85
|
+
yielded = yield
|
86
|
+
case yielded
|
87
|
+
# ===================================================================== #
|
88
|
+
# === :do_not_use_widget_allowing_the_user_to_change_the_local_directory
|
89
|
+
#
|
90
|
+
# This Symbol will omit the bottom-widget that is normally a part
|
91
|
+
# of this class.
|
92
|
+
# ===================================================================== #
|
93
|
+
when :do_not_use_widget_allowing_the_user_to_change_the_local_directory,
|
94
|
+
:omit_the_bottom_widget
|
95
|
+
@show_widget_allowing_the_user_to_change_the_local_directory = false
|
96
|
+
# ===================================================================== #
|
97
|
+
# === :fancy_CSS
|
98
|
+
# ===================================================================== #
|
99
|
+
when :fancy_CSS,
|
100
|
+
:do_customize_the_CSS_rules
|
101
|
+
do_customize_the_CSS_rules
|
102
|
+
end
|
103
|
+
end
|
104
|
+
run if run_already
|
105
|
+
end
|
106
|
+
|
107
|
+
# ========================================================================= #
|
108
|
+
# === reset (reset tag)
|
109
|
+
# ========================================================================= #
|
110
|
+
def reset
|
111
|
+
infer_the_namespace
|
112
|
+
reset_the_internal_variables
|
113
|
+
# ======================================================================= #
|
114
|
+
# === @configuration
|
115
|
+
# ======================================================================= #
|
116
|
+
@configuration = [true, __dir__, namespace?]
|
117
|
+
# ====================================================================== #
|
118
|
+
# === @context_menu
|
119
|
+
#
|
120
|
+
# Define the context-menu that we want to enable for this widget.
|
121
|
+
# ====================================================================== #
|
122
|
+
@context_menu = create_context_menu(self) {{
|
123
|
+
# n_entries: 12,
|
124
|
+
actions: {
|
125
|
+
'Quit': :exit_the_application,
|
126
|
+
'Create a directory': :interactively_create_directory
|
127
|
+
}
|
128
|
+
}}
|
129
|
+
@context_menu.css_class(
|
130
|
+
'bblack3_and_padding'
|
131
|
+
)
|
132
|
+
# ======================================================================= #
|
133
|
+
# === @show_widget_allowing_the_user_to_change_the_local_directory
|
134
|
+
#
|
135
|
+
# If this variable is set to true then a bottom-widget will be used
|
136
|
+
# that allows the user to quickly change the directory.
|
137
|
+
# ======================================================================= #
|
138
|
+
@show_widget_allowing_the_user_to_change_the_local_directory = true
|
139
|
+
infer_the_size_automatically
|
140
|
+
# ======================================================================= #
|
141
|
+
# === @user_configuration
|
142
|
+
#
|
143
|
+
# This is deliberately different from @internal_hash because it might
|
144
|
+
# otherwise conflict with the same named variable that is part of
|
145
|
+
# Gtk::BaseModule.
|
146
|
+
# ======================================================================= #
|
147
|
+
@user_configuration = {}
|
148
|
+
# ======================================================================= #
|
149
|
+
# === :use_this_browser
|
150
|
+
# ======================================================================= #
|
151
|
+
@user_configuration[:use_this_browser] = :palemoon
|
152
|
+
# ======================================================================= #
|
153
|
+
# === :start_directory
|
154
|
+
# ======================================================================= #
|
155
|
+
@user_configuration[:start_directory] = nil
|
156
|
+
# ======================================================================= #
|
157
|
+
# === :use_this_editor
|
158
|
+
# ======================================================================= #
|
159
|
+
@user_configuration[:use_this_editor] = :bluefish
|
160
|
+
# ======================================================================= #
|
161
|
+
# === :use_this_multimedia_player
|
162
|
+
# ======================================================================= #
|
163
|
+
@user_configuration[:use_this_multimedia_player] = :mpv
|
164
|
+
# ======================================================================= #
|
165
|
+
# === :use_this_pdf_viewer
|
166
|
+
# ======================================================================= #
|
167
|
+
@user_configuration[:use_this_pdf_viewer] = :evince
|
168
|
+
# ======================================================================= #
|
169
|
+
# === :use_this_directory
|
170
|
+
#
|
171
|
+
# This variable denotes the start-directory. It will either be the
|
172
|
+
# current working directory, or the first argument in use.
|
173
|
+
# ======================================================================= #
|
174
|
+
@user_configuration[:use_this_directory] = return_pwd
|
175
|
+
# ======================================================================= #
|
176
|
+
# === :last_selection
|
177
|
+
# ======================================================================= #
|
178
|
+
@user_configuration[:last_selection] = nil
|
179
|
+
# ======================================================================= #
|
180
|
+
# === :customize_the_CSS_rules
|
181
|
+
#
|
182
|
+
# This variable keeps track as to whether we will modify the CSS rules
|
183
|
+
# for the tree-view (by default) or not.
|
184
|
+
# ======================================================================= #
|
185
|
+
@user_configuration[:customize_the_CSS_rules] = false
|
186
|
+
handle_CSS
|
187
|
+
end
|
188
|
+
|
189
|
+
# ========================================================================= #
|
190
|
+
# === use_which_pdf_viewer?
|
191
|
+
# ========================================================================= #
|
192
|
+
def use_which_pdf_viewer?
|
193
|
+
@user_configuration[:use_this_pdf_viewer]
|
194
|
+
end
|
195
|
+
|
196
|
+
# ========================================================================= #
|
197
|
+
# === use_which_multimedia_player?
|
198
|
+
# ========================================================================= #
|
199
|
+
def use_which_multimedia_player?
|
200
|
+
@user_configuration[:use_this_multimedia_player]
|
201
|
+
end
|
202
|
+
|
203
|
+
# ========================================================================= #
|
204
|
+
# === use_which_editor?
|
205
|
+
# ========================================================================= #
|
206
|
+
def use_which_editor?
|
207
|
+
@user_configuration[:use_this_editor]
|
208
|
+
end
|
209
|
+
|
210
|
+
# ========================================================================= #
|
211
|
+
# === use_which_browser?
|
212
|
+
# ========================================================================= #
|
213
|
+
def use_which_browser?
|
214
|
+
@user_configuration[:use_this_browser]
|
215
|
+
end
|
216
|
+
|
217
|
+
# ========================================================================= #
|
218
|
+
# === padding?
|
219
|
+
# ========================================================================= #
|
220
|
+
def padding?
|
221
|
+
0
|
222
|
+
end
|
223
|
+
|
224
|
+
# ========================================================================= #
|
225
|
+
# === border_size?
|
226
|
+
# ========================================================================= #
|
227
|
+
def border_size?
|
228
|
+
0
|
229
|
+
end
|
230
|
+
|
231
|
+
# ========================================================================= #
|
232
|
+
# === handle_this_file_or_symlink
|
233
|
+
#
|
234
|
+
# This method can be used to do specific actions, such as playing
|
235
|
+
# a .mp3 song and so forth.
|
236
|
+
# ========================================================================= #
|
237
|
+
def handle_this_file_or_symlink(
|
238
|
+
i = last_selection?
|
239
|
+
)
|
240
|
+
case i
|
241
|
+
# ======================================================================= #
|
242
|
+
# === Images
|
243
|
+
# ======================================================================= #
|
244
|
+
when /\.png$/i,
|
245
|
+
/\.jpg$/i
|
246
|
+
Thread.new {
|
247
|
+
esystem "#{use_which_browser?} #{i}"
|
248
|
+
}
|
249
|
+
# ======================================================================= #
|
250
|
+
# === .md
|
251
|
+
#
|
252
|
+
# The following file-types will be opened via the bluefish editor.
|
253
|
+
#
|
254
|
+
# At some later point I will make this more flexible.
|
255
|
+
# ======================================================================= #
|
256
|
+
when /\.md$/i,
|
257
|
+
/\.yml$/i,
|
258
|
+
/\.rb$/i,
|
259
|
+
/\.py$/i,
|
260
|
+
/\.txt$/i,
|
261
|
+
/\.pdb$/i,
|
262
|
+
/\.fa$/i,
|
263
|
+
/\.fasta$/i
|
264
|
+
Thread.new {
|
265
|
+
esystem "#{use_which_editor?} #{i}"
|
266
|
+
}
|
267
|
+
if i.end_with? '.fasta' # Handle .fasta files slightly differently.
|
268
|
+
e 'Displaying the content of the file.'
|
269
|
+
Gtk.display_this_file_and_then_run_it(i)
|
270
|
+
end
|
271
|
+
# ======================================================================= #
|
272
|
+
# === .mp3
|
273
|
+
#
|
274
|
+
# Here we will put multimedia-files down.
|
275
|
+
# ======================================================================= #
|
276
|
+
when /\.mp3$/i,
|
277
|
+
/\.mp4$/i,
|
278
|
+
/\.avi$/i,
|
279
|
+
/\.webm$/i,
|
280
|
+
/\.mkv$/i
|
281
|
+
Thread.new {
|
282
|
+
esystem "#{use_which_multimedia_player?} \"#{i}\""
|
283
|
+
}
|
284
|
+
# ======================================================================= #
|
285
|
+
# === .pdf
|
286
|
+
# ======================================================================= #
|
287
|
+
when /\.pdf$/i
|
288
|
+
Thread.new {
|
289
|
+
esystem "#{use_which_pdf_viewer?} \"#{i}\""
|
290
|
+
}
|
291
|
+
# ======================================================================= #
|
292
|
+
# === Handle archives next
|
293
|
+
# ======================================================================= #
|
294
|
+
when /\.xz$/i,
|
295
|
+
/\.zip$/i,
|
296
|
+
/\.tar.bz2$/i
|
297
|
+
Thread.new {
|
298
|
+
extract_this_archive(i)
|
299
|
+
}
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
# ========================================================================= #
|
304
|
+
# === set_directory_content
|
305
|
+
# ========================================================================= #
|
306
|
+
def set_directory_content(i)
|
307
|
+
@directory_content = i
|
308
|
+
end
|
309
|
+
|
310
|
+
# ========================================================================= #
|
311
|
+
# === use_this_directory?
|
312
|
+
# ========================================================================= #
|
313
|
+
def use_this_directory?
|
314
|
+
@user_configuration[:use_this_directory]
|
315
|
+
end; alias current_dir? use_this_directory? # === current_dir?
|
316
|
+
alias pwd? use_this_directory? # === pwd?
|
317
|
+
|
318
|
+
# ========================================================================= #
|
319
|
+
# === context_menu?
|
320
|
+
# ========================================================================= #
|
321
|
+
def context_menu?
|
322
|
+
@context_menu
|
323
|
+
end
|
324
|
+
|
325
|
+
# ========================================================================= #
|
326
|
+
# === interactively_create_directory
|
327
|
+
# ========================================================================= #
|
328
|
+
def interactively_create_directory
|
329
|
+
e 'Input the name of the directory that is to be created:'
|
330
|
+
end
|
331
|
+
|
332
|
+
# ========================================================================= #
|
333
|
+
# === set_start_directory
|
334
|
+
# ========================================================================= #
|
335
|
+
def set_start_directory(i)
|
336
|
+
@user_configuration[:start_directory] = i.to_s.dup
|
337
|
+
end; alias set_start_dir set_start_directory # === set_start_dir
|
338
|
+
|
339
|
+
# ========================================================================= #
|
340
|
+
# === set_use_this_directory
|
341
|
+
#
|
342
|
+
# Usage example:
|
343
|
+
#
|
344
|
+
# set_use_this_directory(:return_pwd)
|
345
|
+
#
|
346
|
+
# ========================================================================= #
|
347
|
+
def set_use_this_directory(
|
348
|
+
i = return_pwd
|
349
|
+
)
|
350
|
+
if i.is_a? Array
|
351
|
+
i = i.join(' ').strip
|
352
|
+
end
|
353
|
+
case i
|
354
|
+
# ======================================================================= #
|
355
|
+
# === :return_pwd
|
356
|
+
# ======================================================================= #
|
357
|
+
when :return_pwd,
|
358
|
+
:pwd,
|
359
|
+
''
|
360
|
+
i = return_pwd
|
361
|
+
end
|
362
|
+
if i
|
363
|
+
@user_configuration[:use_this_directory] = i
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# ========================================================================= #
|
368
|
+
# === clear
|
369
|
+
# ========================================================================= #
|
370
|
+
def clear
|
371
|
+
@list_store.clear
|
372
|
+
end
|
373
|
+
|
374
|
+
# ========================================================================= #
|
375
|
+
# === feed_this_data
|
376
|
+
#
|
377
|
+
# Currently this method can only work on Arrays.
|
378
|
+
# ========================================================================= #
|
379
|
+
def feed_this_data(i)
|
380
|
+
if i.is_a? Array
|
381
|
+
fill_up_the_main_iter_with(i)
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
# ========================================================================= #
|
386
|
+
# === set_pwd
|
387
|
+
# ========================================================================= #
|
388
|
+
def set_pwd(
|
389
|
+
i = :return_pwd
|
390
|
+
)
|
391
|
+
set_use_this_directory(:return_pwd)
|
392
|
+
update
|
393
|
+
end
|
394
|
+
|
395
|
+
# ========================================================================= #
|
396
|
+
# === cd_then_update
|
397
|
+
# ========================================================================= #
|
398
|
+
def cd_then_update(
|
399
|
+
i = last_selection?
|
400
|
+
)
|
401
|
+
cd i
|
402
|
+
update
|
403
|
+
end
|
404
|
+
|
405
|
+
# ========================================================================= #
|
406
|
+
# === activate_list_at_position
|
407
|
+
#
|
408
|
+
# This is currently (May 2021) incomplete.
|
409
|
+
# ========================================================================= #
|
410
|
+
def activate_list_at_position(i = 0)
|
411
|
+
treeview = treeview?
|
412
|
+
i = i.to_i # We need a number.
|
413
|
+
path = Gtk::TreePath.new(i.to_s)
|
414
|
+
column = treeview.columns?[0]
|
415
|
+
edit = false
|
416
|
+
treeview.set_cursor(path, column, edit)
|
417
|
+
treeview.grab_focus
|
418
|
+
end
|
419
|
+
|
420
|
+
# ========================================================================= #
|
421
|
+
# === extract_this_archive
|
422
|
+
# ========================================================================= #
|
423
|
+
def extract_this_archive(i)
|
424
|
+
if File.exist? i
|
425
|
+
begin
|
426
|
+
require 'extracter'
|
427
|
+
Extracter.new(i)
|
428
|
+
rescue LoadError; end
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
# ========================================================================= #
|
433
|
+
# === obtain_directory_content
|
434
|
+
# ========================================================================= #
|
435
|
+
def obtain_directory_content(
|
436
|
+
from_this_directory = use_this_directory?
|
437
|
+
)
|
438
|
+
@directory_content = Dir[
|
439
|
+
("#{from_this_directory}/*").squeeze('/')
|
440
|
+
].sort.map {|entry| File.absolute_path(entry) }
|
441
|
+
end
|
442
|
+
|
443
|
+
# ========================================================================= #
|
444
|
+
# === down_by_one
|
445
|
+
# ========================================================================= #
|
446
|
+
def down_by_one
|
447
|
+
cd_one_directory_downwards
|
448
|
+
update
|
449
|
+
end; alias down down_by_one # === down
|
450
|
+
|
451
|
+
# ========================================================================= #
|
452
|
+
# === customize_the_CSS_rules?
|
453
|
+
# ========================================================================= #
|
454
|
+
def customize_the_CSS_rules?
|
455
|
+
@user_configuration[:customize_the_CSS_rules]
|
456
|
+
end
|
457
|
+
|
458
|
+
# ========================================================================= #
|
459
|
+
# === do_customize_the_CSS_rules
|
460
|
+
# ========================================================================= #
|
461
|
+
def do_customize_the_CSS_rules
|
462
|
+
@user_configuration[:customize_the_CSS_rules] = true
|
463
|
+
end
|
464
|
+
|
465
|
+
# ========================================================================= #
|
466
|
+
# === handle_CSS
|
467
|
+
# ========================================================================= #
|
468
|
+
def handle_CSS
|
469
|
+
use_gtk_paradise_project_css_file
|
470
|
+
# ======================================================================= #
|
471
|
+
# We can style the treeview via CSS, but this is not always wanted,
|
472
|
+
# so it has to be customizable.
|
473
|
+
# ======================================================================= #
|
474
|
+
if customize_the_CSS_rules?
|
475
|
+
more_css '
|
476
|
+
treeview.view header button {
|
477
|
+
color: steelblue;
|
478
|
+
}
|
479
|
+
|
480
|
+
treeview.view {
|
481
|
+
color: lightgreen;
|
482
|
+
background-color: black;
|
483
|
+
}
|
484
|
+
|
485
|
+
'
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
# ========================================================================= #
|
490
|
+
# === create_the_labels (labels tag)
|
491
|
+
#
|
492
|
+
# This method will create the 'Directory:' label.
|
493
|
+
# ========================================================================= #
|
494
|
+
def create_the_labels
|
495
|
+
# ======================================================================= #
|
496
|
+
# === @label_directory
|
497
|
+
# ======================================================================= #
|
498
|
+
@label_directory = gtk_label('<b>Directory</b>: ')
|
499
|
+
@label_directory.css_class('midnightblue')
|
500
|
+
@label_directory.hint = 'To the right of this text '\
|
501
|
+
'you can specify the target directory on the local filesystem.'
|
502
|
+
end
|
503
|
+
|
504
|
+
# ========================================================================= #
|
505
|
+
# === do_select_everything_in_the_main_entry
|
506
|
+
# ========================================================================= #
|
507
|
+
def do_select_everything_in_the_main_entry
|
508
|
+
@entry_use_this_directory.select_everything
|
509
|
+
end
|
510
|
+
|
511
|
+
# ========================================================================= #
|
512
|
+
# === create_liststore
|
513
|
+
# ========================================================================= #
|
514
|
+
def create_liststore
|
515
|
+
@list_store = Gtk::ListStore.new(
|
516
|
+
String, # Name of the file or directory.
|
517
|
+
GdkPixbuf::Pixbuf, # This can be an icon for a file or for a directory.
|
518
|
+
String,
|
519
|
+
String,
|
520
|
+
String
|
521
|
+
)
|
522
|
+
# ======================================================================= #
|
523
|
+
# Sort the file-size entry a bit differently.
|
524
|
+
# ======================================================================= #
|
525
|
+
@list_store.set_sort_func(3) { |_model, iter1, iter2|
|
526
|
+
iter2[3].to_s.sub(/ kb/,'').to_f <=> iter1[3].to_s.sub(/ kb/,'').to_f
|
527
|
+
}
|
528
|
+
# ======================================================================= #
|
529
|
+
# Next sort the "Last Modified" entry properly.
|
530
|
+
# ======================================================================= #
|
531
|
+
@list_store.set_sort_func(4) { |_model, iter1, iter2|
|
532
|
+
Time.parse(iter2[4]) <=> Time.parse(iter1[4])
|
533
|
+
}
|
534
|
+
update
|
535
|
+
end
|
536
|
+
|
537
|
+
# ========================================================================= #
|
538
|
+
# === last_selection?
|
539
|
+
#
|
540
|
+
# This method will return which entry is the last one that has been
|
541
|
+
# selected by the user.
|
542
|
+
# ========================================================================= #
|
543
|
+
def last_selection?
|
544
|
+
@user_configuration[:last_selection]
|
545
|
+
end; alias selected? last_selection? # === selected?
|
546
|
+
alias selection? last_selection? # === selection?
|
547
|
+
|
548
|
+
# ========================================================================= #
|
549
|
+
# === create_entries (entries tag, entry tag)
|
550
|
+
# ========================================================================= #
|
551
|
+
def create_entries
|
552
|
+
# ======================================================================= #
|
553
|
+
# This is the entry that appears on the very bottom area of this widget.
|
554
|
+
# ======================================================================= #
|
555
|
+
@entry_use_this_directory = entry
|
556
|
+
@entry_use_this_directory.yellow_background
|
557
|
+
# @entry_use_this_directory.on_click_select_everything
|
558
|
+
@entry_use_this_directory.on_enter {
|
559
|
+
target = @entry_use_this_directory.text.to_s
|
560
|
+
unless target.end_with? '/'
|
561
|
+
target = target.dup if target.frozen?
|
562
|
+
target << '/'
|
563
|
+
@entry_use_this_directory.set_text(target)
|
564
|
+
@entry_use_this_directory.cursor_is_right
|
565
|
+
end
|
566
|
+
if File.directory? target
|
567
|
+
cd(target)
|
568
|
+
set_use_this_directory(target)
|
569
|
+
sync
|
570
|
+
end
|
571
|
+
}
|
572
|
+
end
|
573
|
+
|
574
|
+
# ========================================================================= #
|
575
|
+
# === create_the_buttons (buttons tag, button tag)
|
576
|
+
# ========================================================================= #
|
577
|
+
def create_the_buttons
|
578
|
+
# ======================================================================= #
|
579
|
+
# === @button_update
|
580
|
+
# ======================================================================= #
|
581
|
+
@button_update = bold_button('_Update')
|
582
|
+
@button_update.hint =
|
583
|
+
'Click this button to update the content listing shown above.'
|
584
|
+
@button_update.set_name('button1')
|
585
|
+
@button_update.on_clicked {
|
586
|
+
update
|
587
|
+
}
|
588
|
+
@button_cd_one_level_down = button('..')
|
589
|
+
@button_cd_one_level_down.set_name('button1')
|
590
|
+
@button_cd_one_level_down.on_clicked {
|
591
|
+
cd_one_directory_downwards
|
592
|
+
set_use_this_directory(:return_pwd)
|
593
|
+
update
|
594
|
+
}
|
595
|
+
end
|
596
|
+
|
597
|
+
# ========================================================================= #
|
598
|
+
# === sync_directory_content_onto_the_main_liststore
|
599
|
+
# ========================================================================= #
|
600
|
+
def sync_directory_content_onto_the_main_liststore(
|
601
|
+
i = @directory_content
|
602
|
+
)
|
603
|
+
array = []
|
604
|
+
i.each {|entry|
|
605
|
+
entry = entry.dup if entry.frozen?
|
606
|
+
filesize = File.size(entry).to_s
|
607
|
+
# ===================================================================== #
|
608
|
+
# Determine the file type next, such as "file" or "directory".
|
609
|
+
# ===================================================================== #
|
610
|
+
type = File.ftype(entry)
|
611
|
+
last_modified = File.mtime(entry)
|
612
|
+
last_modified_as_string = last_modified.day.to_s.rjust(2,'0')+'.'+
|
613
|
+
last_modified.month.to_s.rjust(2,'0')+'.'+
|
614
|
+
last_modified.year.to_s
|
615
|
+
shorter_filename = File.basename(entry)
|
616
|
+
case type
|
617
|
+
when 'directory' # A directory, such as "/tmp", should have a trailing "/".
|
618
|
+
shorter_filename << '/'
|
619
|
+
end
|
620
|
+
# ===================================================================== #
|
621
|
+
# Next build up our array that is then used to populate the liststore
|
622
|
+
# at hand.
|
623
|
+
# ===================================================================== #
|
624
|
+
array << [
|
625
|
+
shorter_filename,
|
626
|
+
type,
|
627
|
+
type,
|
628
|
+
filesize,
|
629
|
+
last_modified_as_string
|
630
|
+
]
|
631
|
+
}
|
632
|
+
fill_up_the_main_iter_with(array)
|
633
|
+
end
|
634
|
+
|
635
|
+
# ========================================================================= #
|
636
|
+
# === fill_up_the_main_iter_with
|
637
|
+
# ========================================================================= #
|
638
|
+
def fill_up_the_main_iter_with(array)
|
639
|
+
array.each {|shorter_filename, pixbuf_representation, type, filesize, last_modified_as_string|
|
640
|
+
iter = @list_store.append
|
641
|
+
|
642
|
+
case pixbuf_representation
|
643
|
+
when 'file'
|
644
|
+
pixbuf_representation = icon_theme_default(:document_open, 16)
|
645
|
+
when 'directory'
|
646
|
+
pixbuf_representation = icon_theme_default(:inode_directory, 16)
|
647
|
+
when 'link'
|
648
|
+
pixbuf_representation = icon_theme_default(:document_open, 16)
|
649
|
+
else
|
650
|
+
e 'Unhandled in the method: fill_up_the_main_iter_with() '+
|
651
|
+
pixbuf_representation
|
652
|
+
end
|
653
|
+
|
654
|
+
iter.set_value(0, shorter_filename)
|
655
|
+
iter.set_value(1, pixbuf_representation)
|
656
|
+
iter.set_value(2, type)
|
657
|
+
filesize = (filesize.to_f / 1024).round(1).to_s
|
658
|
+
filesize = '%.2f' % filesize.to_f # Format the filesize next.
|
659
|
+
filesize = filesize.rjust(9, ' ')
|
660
|
+
iter.set_value(3, "#{filesize} kb")
|
661
|
+
iter.set_value(4, last_modified_as_string)
|
662
|
+
}
|
663
|
+
end
|
664
|
+
|
665
|
+
# ========================================================================= #
|
666
|
+
# === main_entry?
|
667
|
+
# ========================================================================= #
|
668
|
+
def main_entry?
|
669
|
+
@entry_use_this_directory
|
670
|
+
end
|
671
|
+
|
672
|
+
# ========================================================================= #
|
673
|
+
# === create_skeleton (create tag, skeleton tag)
|
674
|
+
# ========================================================================= #
|
675
|
+
def create_skeleton
|
676
|
+
create_the_labels
|
677
|
+
create_the_buttons
|
678
|
+
create_entries
|
679
|
+
create_liststore
|
680
|
+
create_treeview
|
681
|
+
create_scrolled_window
|
682
|
+
end
|
683
|
+
|
684
|
+
# ========================================================================= #
|
685
|
+
# === determine_the_minimum_size_of_the_scrolled_window
|
686
|
+
# ========================================================================= #
|
687
|
+
def determine_the_minimum_size_of_the_scrolled_window
|
688
|
+
@scrolled_window.set_size_request(450, 260)
|
689
|
+
end
|
690
|
+
|
691
|
+
# ========================================================================= #
|
692
|
+
# === show_what_was_selected
|
693
|
+
# ========================================================================= #
|
694
|
+
def show_what_was_selected(i = last_selection?)
|
695
|
+
unless i.empty?
|
696
|
+
e "Selected: #{sfancy(i)}"
|
697
|
+
end
|
698
|
+
end
|
699
|
+
|
700
|
+
# ========================================================================= #
|
701
|
+
# === deselect_the_treeview
|
702
|
+
# ========================================================================= #
|
703
|
+
def deselect_the_treeview
|
704
|
+
@tree_view.deselect
|
705
|
+
end
|
706
|
+
|
707
|
+
# ========================================================================= #
|
708
|
+
# === create_treeview
|
709
|
+
#
|
710
|
+
# This method will create the main tree-view of this widget, and
|
711
|
+
# make it useful.
|
712
|
+
# ========================================================================= #
|
713
|
+
def create_treeview
|
714
|
+
# ======================================================================= #
|
715
|
+
# === @tree_view
|
716
|
+
# ======================================================================= #
|
717
|
+
@tree_view = gtk_tree_view(@list_store) { :clickable_headers }
|
718
|
+
@tree_view.enable_selection_single
|
719
|
+
@tree_view.do_use_clickable_headers
|
720
|
+
@tree_view.enable_drag_and_drop
|
721
|
+
@tree_view.reorderable = true
|
722
|
+
@tree_view.rules_hint = true
|
723
|
+
@tree_view.enable_search = true
|
724
|
+
@tree_view.unselect_all # By default we don't want anything selected.
|
725
|
+
# ======================================================================= #
|
726
|
+
# We add the headers next: name, type, size and last_modified.
|
727
|
+
#
|
728
|
+
# Name is the local filename or name of the directory or symlink.
|
729
|
+
# Type is whether it is a directory, a file and so forth.
|
730
|
+
# Last_modified keeps track when this file or directory was last
|
731
|
+
# modified.
|
732
|
+
# ======================================================================= #
|
733
|
+
name_column = gtk_tree_view_column('Name', gtk_cell_renderer, text: 0)
|
734
|
+
image_representation_column = gtk_tree_view_column('', gtk_cell_renderer_pixbuf, pixbuf: 1)
|
735
|
+
type_column = gtk_tree_view_column('Type', gtk_cell_renderer_centered_text, text: 2)
|
736
|
+
type_column.center
|
737
|
+
size_column = gtk_tree_view_column('Size (in kb)', gtk_cell_renderer_right_aligned, text: 3)
|
738
|
+
last_modified_column = gtk_tree_view_column('Last Modified', gtk_cell_renderer, text: 4)
|
739
|
+
@tree_view.append_columns(
|
740
|
+
name_column,
|
741
|
+
image_representation_column,
|
742
|
+
type_column,
|
743
|
+
size_column,
|
744
|
+
last_modified_column
|
745
|
+
)
|
746
|
+
@tree_view.allow_resizing # This must come after the columns were added.
|
747
|
+
columns = @tree_view.columns?
|
748
|
+
# ======================================================================= #
|
749
|
+
# Enable sorting for some of the entries next.
|
750
|
+
# ======================================================================= #
|
751
|
+
columns[0].set_sort_column_id(0) # This here sorts by name.
|
752
|
+
columns[2].set_sort_column_id(2) # This here sorts by type, e. g. "directory" or "file".
|
753
|
+
columns[3].set_sort_column_id(3) # This here sorts by size.
|
754
|
+
columns[4].set_sort_column_id(4) # This here sorts by "Last Modified".
|
755
|
+
# columns[1].cell_renderers?[0].center
|
756
|
+
# ======================================================================= #
|
757
|
+
# Next act on single mouse-button-click events.
|
758
|
+
# ======================================================================= #
|
759
|
+
@tree_view.on_button_release_event { |widget, event|
|
760
|
+
selection = widget.selected?.to_s
|
761
|
+
@user_configuration[:last_selection] = selection
|
762
|
+
show_what_was_selected
|
763
|
+
}
|
764
|
+
@tree_view.on_enter { |widget, event|
|
765
|
+
set_last_selection(File.absolute_path(@tree_view.selected?.to_s))
|
766
|
+
e "Selection: #{@user_configuration[:last_selection]}"
|
767
|
+
if last_selection?
|
768
|
+
if File.directory? @user_configuration[:last_selection]
|
769
|
+
cd_then_update(@user_configuration[:last_selection])
|
770
|
+
else
|
771
|
+
handle_this_file_or_symlink(@user_configuration[:last_selection])
|
772
|
+
end
|
773
|
+
end
|
774
|
+
}
|
775
|
+
@tree_view.on_button_press_event { |widget, event|
|
776
|
+
case event.button
|
777
|
+
when 1 # left-mouse button click event.
|
778
|
+
if event.event_type == Gdk::EventType::BUTTON2_PRESS
|
779
|
+
# ================================================================= #
|
780
|
+
# === :last_selection
|
781
|
+
#
|
782
|
+
# This here is the case for a double-click event. We will keep
|
783
|
+
# track of the last selection via an instance variable.
|
784
|
+
# ================================================================= #
|
785
|
+
# e 'Even a double-click event!'
|
786
|
+
@user_configuration[:last_selection] = File.absolute_path(
|
787
|
+
@tree_view.return_the_selection.to_s
|
788
|
+
)
|
789
|
+
show_what_was_selected
|
790
|
+
if File.directory? @user_configuration[:last_selection]
|
791
|
+
e 'Changing into the directory '+
|
792
|
+
sdir(@user_configuration[:last_selection])+
|
793
|
+
' next.'
|
794
|
+
cd_then_update(@user_configuration[:last_selection])
|
795
|
+
else
|
796
|
+
handle_this_file_or_symlink(@user_configuration[:last_selection])
|
797
|
+
end
|
798
|
+
else # else this is a simple left-mouse button click.
|
799
|
+
# @user_configuration[:last_selection] = @tree_view.return_the_selection.to_s
|
800
|
+
end
|
801
|
+
when 2
|
802
|
+
# e 'middle mouse-button was clicked.'
|
803
|
+
when 3
|
804
|
+
# =================================================================== #
|
805
|
+
# Right-mouse button was clicked.
|
806
|
+
# =================================================================== #
|
807
|
+
deselect_the_treeview
|
808
|
+
end
|
809
|
+
}
|
810
|
+
end
|
811
|
+
|
812
|
+
# ========================================================================= #
|
813
|
+
# === cd_one_directory_downwards
|
814
|
+
# ========================================================================= #
|
815
|
+
def cd_one_directory_downwards
|
816
|
+
cd File.absolute_path(File.dirname(return_pwd))
|
817
|
+
end
|
818
|
+
|
819
|
+
# ========================================================================= #
|
820
|
+
# === update (update tag)
|
821
|
+
# ========================================================================= #
|
822
|
+
def update
|
823
|
+
clear
|
824
|
+
obtain_directory_content
|
825
|
+
sync_directory_content_onto_the_main_liststore
|
826
|
+
@entry_use_this_directory.set_text(use_this_directory?.to_s)
|
827
|
+
end; alias sync update # === sync
|
828
|
+
|
829
|
+
# ========================================================================= #
|
830
|
+
# === change_directory (cd tag)
|
831
|
+
#
|
832
|
+
# This class needs its own implementation of cd-functionality.
|
833
|
+
# ========================================================================= #
|
834
|
+
def change_directory(i)
|
835
|
+
if File.directory? i
|
836
|
+
raw_cd(i)
|
837
|
+
set_use_this_directory(File.absolute_path(i))
|
838
|
+
end
|
839
|
+
end; alias cd change_directory # === cd
|
840
|
+
|
841
|
+
# ========================================================================= #
|
842
|
+
# === set_last_selection
|
843
|
+
# ========================================================================= #
|
844
|
+
def set_last_selection(i)
|
845
|
+
@user_configuration[:last_selection] = i
|
846
|
+
end; alias last_selection= set_last_selection # === last_selection=
|
847
|
+
|
848
|
+
# ========================================================================= #
|
849
|
+
# === connect_skeleton (connect tag)
|
850
|
+
# ========================================================================= #
|
851
|
+
def connect_skeleton
|
852
|
+
abort_on_exception
|
853
|
+
top_box = gtk_hbox
|
854
|
+
top_box.maximal(@scrolled_window)
|
855
|
+
lower_box = gtk_hbox
|
856
|
+
if @show_widget_allowing_the_user_to_change_the_local_directory
|
857
|
+
mini_hbox = gtk_hbox
|
858
|
+
small_icon_on_the_left_side = image_directory # gtk_label(:directory)
|
859
|
+
@event_box_for_the_small_icon_on_the_left_side = gtk_event_box(
|
860
|
+
small_icon_on_the_left_side
|
861
|
+
)
|
862
|
+
mini_hbox.minimal(@event_box_for_the_small_icon_on_the_left_side, 4)
|
863
|
+
@event_box_for_the_small_icon_on_the_left_side.on_clicked {
|
864
|
+
do_select_everything_in_the_main_entry
|
865
|
+
}
|
866
|
+
mini_hbox.minimal(@label_directory)
|
867
|
+
mini_hbox.maximal(@entry_use_this_directory)
|
868
|
+
mini_hbox.minimal(@button_cd_one_level_down, 2)
|
869
|
+
lower_box.maximal(mini_hbox)
|
870
|
+
# ===================================================================== #
|
871
|
+
# Since as of August 2022, the update-button is also omitted.
|
872
|
+
# ===================================================================== #
|
873
|
+
lower_box.minimal(@button_update)
|
874
|
+
draggable_pane = gtk_drag_left_to_right(
|
875
|
+
top_box,
|
876
|
+
lower_box
|
877
|
+
)
|
878
|
+
draggable_pane.position = 900 # The higher the number, the lower the bottom pane will be.
|
879
|
+
maximal(draggable_pane)
|
880
|
+
else
|
881
|
+
maximal(top_box)
|
882
|
+
end
|
883
|
+
end
|
884
|
+
|
885
|
+
# ========================================================================= #
|
886
|
+
# === run (run tag)
|
887
|
+
# ========================================================================= #
|
888
|
+
def run
|
889
|
+
super()
|
890
|
+
Thread.new {
|
891
|
+
sleep 0.01
|
892
|
+
main_entry?.deselect
|
893
|
+
}
|
894
|
+
end
|
895
|
+
|
896
|
+
# ========================================================================= #
|
897
|
+
# === create_scrolled_window (scrolled tag)
|
898
|
+
# ========================================================================= #
|
899
|
+
def create_scrolled_window
|
900
|
+
# ======================================================================= #
|
901
|
+
# === @scrolled_window
|
902
|
+
# ======================================================================= #
|
903
|
+
@scrolled_window = gtk_scrolled_window(treeview?) { :always }
|
904
|
+
@scrolled_window.pad8px
|
905
|
+
@scrolled_window.bblack1
|
906
|
+
@scrolled_window.use_this_font = USE_THIS_FONT_FOR_THE_SCROLLED_WINDOW
|
907
|
+
determine_the_minimum_size_of_the_scrolled_window
|
908
|
+
end
|
909
|
+
|
910
|
+
# ========================================================================= #
|
911
|
+
# === treeview?
|
912
|
+
# ========================================================================= #
|
913
|
+
def treeview?
|
914
|
+
@tree_view
|
915
|
+
end
|
916
|
+
|
917
|
+
# ========================================================================= #
|
918
|
+
# === use_this_font=
|
919
|
+
# ========================================================================= #
|
920
|
+
def use_this_font=(i)
|
921
|
+
# Sync it towards other widgets, including the entries.
|
922
|
+
@tree_view.use_this_font = i
|
923
|
+
@entry_use_this_directory.use_this_font = i
|
924
|
+
self.set_font(i)
|
925
|
+
end
|
18
926
|
|
19
927
|
# ========================================================================= #
|
20
928
|
# === Gtk::DirectoryContentWidget.run
|
21
929
|
# ========================================================================= #
|
22
|
-
def self.run(
|
23
|
-
|
930
|
+
def self.run(
|
931
|
+
i = ARGV
|
932
|
+
)
|
933
|
+
require 'gtk_paradise/app/app.rb'
|
934
|
+
_ = ::Gtk::DirectoryContentWidget.new(i)
|
935
|
+
r = ::Gtk.run
|
936
|
+
r << _
|
937
|
+
r.automatic_size_then_automatic_title
|
938
|
+
r.add_accel_group(@accel_group = ::Gtk::AccelGroup.new)
|
939
|
+
r.enable_context_menu
|
940
|
+
_.set_parent_widget(r)
|
941
|
+
r.enable_quick_exit
|
942
|
+
r.signal_connect(:button_press_event) { |widget, event|
|
943
|
+
if ::Gtk.right_mouse_click?(event) # right mouse click event.
|
944
|
+
_.context_menu?.popup_based_on_this_event(event)
|
945
|
+
end
|
946
|
+
}
|
947
|
+
# ====================================================================== #
|
948
|
+
# Enable additional key-combinations next:
|
949
|
+
# ====================================================================== #
|
950
|
+
_.enable_these_key_combinations(
|
951
|
+
::Gtk::DirectoryContentWidgetModule::HASH_DESIGNATED_KEY_COMBINATIONS
|
952
|
+
)
|
953
|
+
r.top_left_then_run
|
24
954
|
end
|
25
955
|
|
26
956
|
end; end
|
27
957
|
|
28
958
|
if __FILE__ == $PROGRAM_NAME
|
29
|
-
Gtk::DirectoryContentWidget.run
|
959
|
+
Gtk::DirectoryContentWidget.run
|
30
960
|
end
|