geany
1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
![]() ![]() |
#include "dialogs.h"
#include "app.h"
#include "build.h"
#include "document.h"
#include "encodings.h"
#include "encodingsprivate.h"
#include "filetypes.h"
#include "main.h"
#include "support.h"
#include "utils.h"
#include "ui_utils.h"
#include "win32.h"
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <string.h>
#include <time.h>
#include <glib/gstdio.h>
Go to the source code of this file.
Classes | |
struct | FileSelState |
struct | InputDialogData |
Macros | |
#define | S_IRUSR 0 |
#define | S_IWUSR 0 |
#define | S_IXUSR 0 |
#define | S_IRGRP 0 |
#define | S_IWGRP 0 |
#define | S_IXGRP 0 |
#define | S_IROTH 0 |
#define | S_IWOTH 0 |
#define | S_IXOTH 0 |
Enumerations | |
enum | { GEANY_RESPONSE_RENAME , GEANY_RESPONSE_VIEW } |
Functions | |
static gint | filetype_combo_box_get_active_filetype (GtkComboBox *combo) |
static guint | file_chooser_get_filter_idx (GtkFileChooser *chooser) |
static void | file_chooser_set_filter_idx (GtkFileChooser *chooser, guint idx) |
static gboolean | open_file_dialog_handle_response (GtkWidget *dialog, gint response) |
static void | on_file_open_show_hidden_notify (GObject *filechooser, GParamSpec *pspec, gpointer data) |
static void | on_file_open_check_hidden_toggled (GtkToggleButton *togglebutton, GtkWidget *dialog) |
static void | filetype_combo_cell_data_func (GtkCellLayout *cell_layout, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) |
static GtkWidget * | create_filetype_combo_box (void) |
static gboolean | filetype_combo_box_set_active_filetype (GtkComboBox *combo, const gint id) |
static GtkWidget * | add_file_open_extra_widget (GtkWidget *dialog) |
static GtkWidget * | create_open_file_dialog (void) |
static void | open_file_dialog_apply_settings (GtkWidget *dialog) |
void | dialogs_show_open_file (void) |
static gboolean | handle_save_as (const gchar *utf8_filename, gboolean rename_file) |
static gboolean | save_as_dialog_handle_response (GtkWidget *dialog, gint response) |
static GtkWidget * | create_save_file_dialog (GeanyDocument *doc) |
static gboolean | show_save_as_gtk (GeanyDocument *doc) |
gboolean | dialogs_show_save_as (void) |
Shows the Save As dialog for the current notebook page. More... | |
static void | show_msgbox_dialog (GtkWidget *dialog, GtkMessageType type, GtkWindow *parent) |
void | dialogs_show_msgbox (GtkMessageType type, const gchar *text,...) |
Shows a message box of the type type with text. More... | |
void | dialogs_show_msgbox_with_secondary (GtkMessageType type, const gchar *text, const gchar *secondary) |
static gint | run_unsaved_dialog (const gchar *msg, const gchar *msg2) |
gboolean | dialogs_show_unsaved_file (GeanyDocument *doc) |
static void | on_font_dialog_response (GtkDialog *dialog, gint response, gpointer user_data) |
void | dialogs_show_open_font (void) |
static void | on_input_dialog_show (GtkDialog *dialog, GtkWidget *entry) |
static void | on_input_entry_activate (GtkEntry *entry, GtkDialog *dialog) |
static void | on_input_numeric_activate (GtkEntry *entry, GtkDialog *dialog) |
static void | on_input_dialog_response (GtkDialog *dialog, gint response, InputDialogData *data) |
static GtkWidget * | dialogs_show_input_full (const gchar *title, GtkWindow *parent, const gchar *label_text, const gchar *default_text, gboolean persistent, GeanyInputCallback input_cb, gpointer input_cb_data, GCallback insert_text_cb, gpointer insert_text_cb_data) |
GtkWidget * | dialogs_show_input_persistent (const gchar *title, GtkWindow *parent, const gchar *label_text, const gchar *default_text, GeanyInputCallback input_cb, gpointer input_cb_data) |
static void | on_dialog_input (const gchar *str, gpointer data) |
gchar * | dialogs_show_input (const gchar *title, GtkWindow *parent, const gchar *label_text, const gchar *default_text) |
Asks the user for text input. More... | |
gchar * | dialogs_show_input_goto_line (const gchar *title, GtkWindow *parent, const gchar *label_text, const gchar *default_text) |
gboolean | dialogs_show_input_numeric (const gchar *title, const gchar *label_text, gdouble *value, gdouble min, gdouble max, gdouble step) |
Shows an input box to enter a numerical value using a GtkSpinButton. More... | |
void | dialogs_show_file_properties (GeanyDocument *doc) |
static gint | show_prompt (GtkWidget *parent, const gchar *btn_1, GtkResponseType response_1, const gchar *btn_2, GtkResponseType response_2, const gchar *btn_3, GtkResponseType response_3, const gchar *question_text, const gchar *extra_text) |
gboolean | dialogs_show_question (const gchar *text,...) |
Shows a question message box with text and Yes/No buttons. More... | |
gboolean | dialogs_show_question_full (GtkWidget *parent, const gchar *yes_btn, const gchar *no_btn, const gchar *extra_text, const gchar *main_text,...) |
gint | dialogs_show_prompt (GtkWidget *parent, const gchar *btn_1, GtkResponseType response_1, const gchar *btn_2, GtkResponseType response_2, const gchar *btn_3, GtkResponseType response_3, const gchar *extra_text, const gchar *main_text,...) |
Variables | |
static struct FileSelState | filesel_state |
#define S_IRGRP 0 |
#define S_IROTH 0 |
#define S_IRUSR 0 |
#define S_IWGRP 0 |
#define S_IWOTH 0 |
#define S_IWUSR 0 |
#define S_IXGRP 0 |
#define S_IXOTH 0 |
#define S_IXUSR 0 |
anonymous enum |
|
static |
Definition at line 300 of file dialogs.c.
References _, check_hidden(), create_filetype_combo_box(), dialog, encoding_combo, GEANY_ENCODINGS_MAX, gtk_container_add(), gtk_widget_show_all(), on_file_open_check_hidden_toggled(), ui_create_encodings_combo_box(), and ui_hookup_widget().
Referenced by create_open_file_dialog().
|
static |
Definition at line 209 of file dialogs.c.
References _, filetype_combo_cell_data_func(), filetypes_by_title, foreach_slist, GEANY_FILETYPE_GROUP_COMPILED, GEANY_FILETYPE_GROUP_MARKUP, GEANY_FILETYPE_GROUP_MISC, GEANY_FILETYPE_GROUP_NONE, GEANY_FILETYPE_GROUP_SCRIPT, GeanyFiletype::group, GeanyFiletype::id, NULL, and GeanyFiletype::title.
Referenced by add_file_open_extra_widget().
|
static |
Definition at line 369 of file dialogs.c.
References _, add_file_open_extra_widget(), C_, dialog, filetypes, filetypes_by_title, filetypes_create_file_filter(), filetypes_create_file_filter_all_source(), foreach_slist, GEANY_FILETYPES_NONE, GEANY_RESPONSE_VIEW, GeanyFiletype::id, main_widgets, NULL, on_file_open_show_hidden_notify(), and GeanyMainWidgets::window.
Referenced by dialogs_show_open_file().
|
static |
Definition at line 559 of file dialogs.c.
References _, dialog, GEANY_RESPONSE_RENAME, main_widgets, NULL, GeanyDocument::real_path, utils_get_default_dir_utf8(), utils_get_locale_from_utf8(), and GeanyMainWidgets::window.
Referenced by show_save_as_gtk().
void dialogs_show_file_properties | ( | GeanyDocument * | doc | ) |
Definition at line 1149 of file dialogs.c.
References _, dialog, dialogs_show_msgbox(), GeanyDocument::encoding, encodings_is_unicode_charset(), GeanyDocument::file_name, GeanyDocument::file_type, GeanyDocument::has_bom, GeanyFiletype::icon, GeanyDocument::is_valid, label, NULL, GeanyDocument::readonly, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR, GeanyFiletype::title, ui_builder_get_object(), ui_lookup_widget(), utils_get_locale_from_utf8(), utils_make_human_readable_str(), and utils_str_middle_truncate().
Referenced by on_file_properties_activate().
gchar * dialogs_show_input | ( | const gchar * | title, |
GtkWindow * | parent, | ||
const gchar * | label_text, | ||
const gchar * | default_text | ||
) |
Asks the user for text input.
title | Dialog title. |
parent | The currently focused window, usually geany->main_widgets->window . NULL can be used but is discouraged due to window manager effects. |
label_text | Label text, or NULL . |
default_text | Text to display in the input field, or NULL . |
NULL
if cancelled. Definition at line 1067 of file dialogs.c.
References dialogs_show_input_full(), NULL, and on_dialog_input().
Referenced by insert_date(), on_label_button_clicked(), and utils_open_browser().
|
static |
Definition at line 971 of file dialogs.c.
References InputDialogData::callback, InputDialogData::combo, InputDialogData::data, dialog, InputDialogData::entry, gtk_container_add(), gtk_widget_show_all(), label, NULL, on_input_dialog_response(), on_input_dialog_show(), on_input_entry_activate(), ui_dialog_vbox_new(), and ui_entry_add_clear_icon().
Referenced by dialogs_show_input(), dialogs_show_input_goto_line(), and dialogs_show_input_persistent().
gchar * dialogs_show_input_goto_line | ( | const gchar * | title, |
GtkWindow * | parent, | ||
const gchar * | label_text, | ||
const gchar * | default_text | ||
) |
Definition at line 1079 of file dialogs.c.
References dialogs_show_input_full(), NULL, on_dialog_input(), and ui_editable_insert_text_callback().
Referenced by on_go_to_line_activate().
gboolean dialogs_show_input_numeric | ( | const gchar * | title, |
const gchar * | label_text, | ||
gdouble * | value, | ||
gdouble | min, | ||
gdouble | max, | ||
gdouble | step | ||
) |
Shows an input box to enter a numerical value using a GtkSpinButton.
If the dialog is aborted, value remains untouched.
title | The dialog title. |
label_text | The shown dialog label. |
value | The default value for the spin button and the return location of the entered value. Must be non-NULL. |
min | Minimum allowable value (see documentation for gtk_spin_button_new_with_range() ). |
max | Maximum allowable value (see documentation for gtk_spin_button_new_with_range() ). |
step | Increment added or subtracted by spinning the widget (see documentation for gtk_spin_button_new_with_range() ). |
TRUE
if a value was entered and the dialog closed with 'OK'. FALSE
otherwise.Definition at line 1108 of file dialogs.c.
References dialog, gtk_container_add(), gtk_widget_show_all(), label, main_widgets, max, NULL, on_input_numeric_activate(), ui_dialog_vbox_new(), ui_entry_add_clear_icon(), and GeanyMainWidgets::window.
Referenced by editor_replace_spaces().
GtkWidget * dialogs_show_input_persistent | ( | const gchar * | title, |
GtkWindow * | parent, | ||
const gchar * | label_text, | ||
const gchar * | default_text, | ||
GeanyInputCallback | input_cb, | ||
gpointer | input_cb_data | ||
) |
Definition at line 1043 of file dialogs.c.
References dialogs_show_input_full(), and NULL.
Referenced by on_build_menu_item().
void dialogs_show_msgbox | ( | GtkMessageType | type, |
const gchar * | text, | ||
... | |||
) |
Shows a message box of the type type with text.
On Unix-like systems a GTK message dialog box is shown, on Win32 systems a native Windows message dialog box is shown.
type | A GtkMessageType , e.g. GTK_MESSAGE_INFO , GTK_MESSAGE_WARNING , GTK_MESSAGE_QUESTION , GTK_MESSAGE_ERROR . |
text | Printf()-style format string. |
... | Arguments for the text format string. |
Definition at line 729 of file dialogs.c.
References dialog, main_status, main_widgets, NULL, show_msgbox_dialog(), text, and GeanyMainWidgets::window.
Referenced by configure_response_cb(), create_config_dir(), dialogs_show_file_properties(), load_text_file(), open_file_dialog_handle_response(), print_external(), printing_print_gtk(), save_settings(), and set_status().
void dialogs_show_msgbox_with_secondary | ( | GtkMessageType | type, |
const gchar * | text, | ||
const gchar * | secondary | ||
) |
Definition at line 753 of file dialogs.c.
References dialog, main_status, main_widgets, NULL, show_msgbox_dialog(), text, and GeanyMainWidgets::window.
Referenced by document_rename_file(), document_save_file(), highlighting_show_color_scheme_dialog(), save_convert_to_encoding(), and ui_init_builder().
void dialogs_show_open_file | ( | void | ) |
TODO should it only be used when initially open the dialog and not on every show?
Definition at line 449 of file dialogs.c.
References _, app, GeanyProject::base_path, create_open_file_dialog(), dialog, EMPTY, interface_prefs, main_widgets, NULL, open_file_dialog_apply_settings(), open_file_dialog_handle_response(), GeanyApp::project, SETPTR, GeanyInterfacePrefs::use_native_windows_dialogs, utils_get_current_file_dir_utf8(), utils_get_default_dir_utf8(), utils_get_locale_from_utf8(), and GeanyMainWidgets::window.
Referenced by on_open1_activate().
void dialogs_show_open_font | ( | void | ) |
Definition at line 876 of file dialogs.c.
References _, GeanyInterfacePrefs::editor_font, interface_prefs, main_widgets, NULL, on_font_dialog_response(), ui_widgets, GeanyInterfacePrefs::use_native_windows_dialogs, and GeanyMainWidgets::window.
Referenced by on_change_font1_activate().
gint dialogs_show_prompt | ( | GtkWidget * | parent, |
const gchar * | btn_1, | ||
GtkResponseType | response_1, | ||
const gchar * | btn_2, | ||
GtkResponseType | response_2, | ||
const gchar * | btn_3, | ||
GtkResponseType | response_3, | ||
const gchar * | extra_text, | ||
const gchar * | main_text, | ||
... | |||
) |
Definition at line 1417 of file dialogs.c.
References show_prompt().
Referenced by kb_find_duplicate().
gboolean dialogs_show_question | ( | const gchar * | text, |
... | |||
) |
Shows a question message box with text and Yes/No buttons.
On Unix-like systems a GTK message dialog box is shown, on Win32 systems a native Windows message dialog box is shown.
text | Printf()-style format string. |
... | Arguments for the text format string. |
TRUE
if the user answered with Yes, otherwise FALSE
. Definition at line 1370 of file dialogs.c.
References main_status, main_widgets, NULL, show_prompt(), text, and GeanyMainWidgets::window.
Referenced by handle_current_session(), on_file_save_dialog_response(), print_external(), and setup_config_dir().
gboolean dialogs_show_question_full | ( | GtkWidget * | parent, |
const gchar * | yes_btn, | ||
const gchar * | no_btn, | ||
const gchar * | extra_text, | ||
const gchar * | main_text, | ||
... | |||
) |
Definition at line 1393 of file dialogs.c.
References NULL, and show_prompt().
Referenced by create_config_dir(), document_find_text(), document_reload_prompt(), main_quit(), on_reload_all(), project_ask_close(), save_as_dialog_handle_response(), save_file_handle_infobars(), and update_config().
gboolean dialogs_show_save_as | ( | void | ) |
Shows the Save As dialog for the current notebook page.
TRUE
if the file was saved, otherwise FALSE
. Definition at line 667 of file dialogs.c.
References _, document_get_current(), handle_save_as(), interface_prefs, main_widgets, NULL, show_save_as_gtk(), GeanyInterfacePrefs::use_native_windows_dialogs, and GeanyMainWidgets::window.
Referenced by document_save_file(), on_monitor_resave_missing_file_response(), and on_save_as1_activate().
gboolean dialogs_show_unsaved_file | ( | GeanyDocument * | doc | ) |
Definition at line 797 of file dialogs.c.
References _, document_get_basename_for_display(), document_save_file(), document_show_tab(), main_status, NULL, and run_unsaved_dialog().
Referenced by document_account_for_unsaved(), and remove_page().
|
static |
Definition at line 93 of file dialogs.c.
References foreach_slist.
Referenced by open_file_dialog_apply_settings(), and open_file_dialog_handle_response().
|
static |
Definition at line 113 of file dialogs.c.
Referenced by open_file_dialog_apply_settings().
|
static |
Definition at line 263 of file dialogs.c.
Referenced by open_file_dialog_handle_response().
|
static |
Definition at line 277 of file dialogs.c.
References ui_tree_model_iter_any_next().
Referenced by open_file_dialog_apply_settings().
|
static |
Definition at line 197 of file dialogs.c.
Referenced by create_filetype_combo_box().
|
static |
Definition at line 488 of file dialogs.c.
References build_menu_update(), document_get_current(), document_rename_file(), document_save_file_as(), EMPTY, GeanyDocument::file_name, NULL, GeanyDocument::tm_file, tm_source_file_free(), and tm_workspace_remove_source_file().
Referenced by dialogs_show_save_as(), and save_as_dialog_handle_response().
|
static |
Definition at line 1051 of file dialogs.c.
Referenced by dialogs_show_input(), and dialogs_show_input_goto_line().
|
static |
Definition at line 190 of file dialogs.c.
References dialog, filesel_state, FileSelState::open, and FileSelState::show_hidden.
Referenced by add_file_open_extra_widget().
|
static |
Definition at line 177 of file dialogs.c.
References ui_lookup_widget().
Referenced by create_open_file_dialog().
|
static |
Definition at line 849 of file dialogs.c.
References close, ui_set_editor_font(), and ui_widgets.
Referenced by dialogs_show_open_font().
|
static |
Definition at line 950 of file dialogs.c.
References InputDialogData::callback, InputDialogData::combo, InputDialogData::data, dialog, InputDialogData::entry, NULL, and ui_combo_box_add_to_history().
Referenced by dialogs_show_input_full().
|
static |
Definition at line 918 of file dialogs.c.
References entry.
Referenced by dialogs_show_input_full().
|
static |
Definition at line 925 of file dialogs.c.
References dialog.
Referenced by dialogs_show_input_full().
|
static |
Definition at line 932 of file dialogs.c.
References dialog.
Referenced by dialogs_show_input_numeric().
|
static |
Definition at line 422 of file dialogs.c.
References check_hidden(), dialog, encoding_combo, FileSelState::encoding_idx, file_chooser_get_filter_idx(), file_chooser_set_filter_idx(), filesel_state, filetype_combo_box_set_active_filetype(), FileSelState::filetype_idx, FileSelState::filter_idx, FileSelState::more_options_visible, FileSelState::open, FileSelState::show_hidden, ui_encodings_combo_box_set_active_encoding(), and ui_lookup_widget().
Referenced by dialogs_show_open_file().
|
static |
Definition at line 125 of file dialogs.c.
References _, app, GeanyProject::base_path, GeanyEncoding::charset, dialog, dialogs_show_msgbox(), document_open_files(), EMPTY, encoding_combo, FileSelState::encoding_idx, encodings, file_chooser_get_filter_idx(), filesel_state, filetype_combo_box_get_active_filetype(), FileSelState::filetype_idx, filetypes_index(), FileSelState::filter_idx, GEANY_ENCODINGS_MAX, GEANY_RESPONSE_VIEW, FileSelState::more_options_visible, NULL, FileSelState::open, GeanyApp::project, ui_encodings_combo_box_get_active_encoding(), and ui_lookup_widget().
Referenced by dialogs_show_open_file().
|
static |
Definition at line 771 of file dialogs.c.
References _, dialog, main_widgets, ui_button_new_with_image(), and GeanyMainWidgets::window.
Referenced by dialogs_show_unsaved_file().
|
static |
Definition at line 517 of file dialogs.c.
References _, dialog, dialogs_show_question_full(), EMPTY, GEANY_RESPONSE_RENAME, handle_save_as(), NULL, utils_beep(), and utils_get_utf8_from_locale().
Referenced by show_save_as_gtk().
|
static |
Definition at line 690 of file dialogs.c.
Referenced by dialogs_show_msgbox(), and dialogs_show_msgbox_with_secondary().
|
static |
Definition at line 1294 of file dialogs.c.
References _, dialog, main_status, main_widgets, NULL, utils_str_equal(), and GeanyMainWidgets::window.
Referenced by dialogs_show_prompt(), dialogs_show_question(), and dialogs_show_question_full().
|
static |
Definition at line 598 of file dialogs.c.
References app, GeanyProject::base_path, create_save_file_dialog(), dialog, DOC_VALID, EMPTY, GeanyFiletype::extension, GeanyDocument::file_name, GeanyDocument::file_type, GEANY_STRING_UNTITLED, NULL, GeanyApp::project, save_as_dialog_handle_response(), and utils_get_locale_from_utf8().
Referenced by dialogs_show_save_as().
|
static |
Referenced by on_file_open_check_hidden_toggled(), open_file_dialog_apply_settings(), and open_file_dialog_handle_response().