Skip to content

Commit

Permalink
Merge branch 'geany:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 committed Apr 17, 2024
2 parents 73c7bd3 + 32bbe10 commit c98ba87
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 13 deletions.
2 changes: 1 addition & 1 deletion data/geany.glade
Original file line number Diff line number Diff line change
Expand Up @@ -8808,7 +8808,7 @@
<object class="GtkEntry" id="entry_project_dialog_file_patterns">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Space separated list of file patterns used for the find in files dialog (e.g. *.c *.h)</property>
<property name="tooltip-text" translatable="yes">Space separated list of file patterns used for the Find in Files dialog (e.g. *.c *.h)</property>
<property name="invisible-char">•</property>
<property name="primary-icon-activatable">False</property>
</object>
Expand Down
4 changes: 4 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,10 @@ gen_src = custom_target('gen-signallist',

win_src = []
win_deps = []
win_resc = []
if (host_machine.system() == 'windows')
windows = import('windows')
win_resc = windows.compile_resources('geany_private.rc')
win_src += [ 'src/win32.c', 'src/win32.h' ]
foreach lib : ['ole32', 'wsock32', 'comdlg32']
win_deps += cc.find_library(lib)
Expand Down Expand Up @@ -881,6 +884,7 @@ dep_libgeany = declare_dependency(
)

executable('geany',
win_resc,
'src/main.c',
link_with: libgeany,
c_args: geany_cflags + [ '-DG_LOG_DOMAIN="Geany"' ],
Expand Down
2 changes: 1 addition & 1 deletion scripts/gtk-bundle-from-msys2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ freetype
fribidi
gcc-libs
gdk-pixbuf2
gettext
gettext-runtime
glib2
graphite2
grep
Expand Down
2 changes: 2 additions & 0 deletions src/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,8 @@ static void build_spawn_cmd(GeanyDocument *doc, const gchar *cmd, const gchar *d
working_dir = utils_get_locale_from_utf8(utf8_working_dir);

gtk_list_store_clear(msgwindow.store_compiler);
// reset width after any long error messages
gtk_tree_view_columns_autosize(GTK_TREE_VIEW(msgwindow.tree_compiler));
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER);
msgwin_compiler_add(COLOR_BLUE, _("%s (in directory: %s)"), cmd, utf8_working_dir);
g_free(utf8_working_dir);
Expand Down
37 changes: 26 additions & 11 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,8 @@ void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir)
g_free(cur_dir);
}

ui_set_search_entry_background(fif_dlg.search_combo, TRUE);
ui_set_search_entry_background(fif_dlg.dir_combo, TRUE);
update_fif_file_mode_combo();
update_file_patterns(fif_dlg.files_mode_combo, fif_dlg.files_combo);

Expand Down Expand Up @@ -1562,6 +1564,15 @@ on_replace_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
}


static void reset_msgwin(void)
{
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_MESSAGE);
gtk_list_store_clear(msgwindow.store_msg);
// reset width after any long messages
gtk_tree_view_columns_autosize(GTK_TREE_VIEW(msgwindow.tree_msg));
}


static GString *get_grep_options(void)
{
GString *gstr = g_string_new("-nHI"); /* line numbers, filenames, ignore binaries */
Expand Down Expand Up @@ -1623,12 +1634,21 @@ on_find_in_files_dialog_response(GtkDialog *dialog, gint response,
GtkWidget *dir_combo = fif_dlg.dir_combo;
const gchar *utf8_dir =
gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(dir_combo))));
gchar *locale_dir = utils_get_locale_from_utf8(utf8_dir);
GeanyEncodingIndex enc_idx =
ui_encodings_combo_box_get_active_encoding(GTK_COMBO_BOX(fif_dlg.encoding_combo));

if (G_UNLIKELY(EMPTY(utf8_dir)))
ui_set_statusbar(FALSE, _("Invalid directory for find in files."));
else if (!EMPTY(search_text))
if (!g_file_test(locale_dir, G_FILE_TEST_IS_DIR))
{
ui_set_statusbar(FALSE, _("Invalid directory for Find in Files."));
ui_set_search_entry_background(dir_combo, FALSE);
}
else if (EMPTY(search_text))
{
ui_set_statusbar(FALSE, _("No text to find."));
ui_set_search_entry_background(search_combo, FALSE);
}
else
{
GString *opts = get_grep_options();
const gchar *enc = (enc_idx == GEANY_ENCODING_UTF_8) ? NULL :
Expand All @@ -1643,8 +1663,7 @@ on_find_in_files_dialog_response(GtkDialog *dialog, gint response,
}
g_string_free(opts, TRUE);
}
else
ui_set_statusbar(FALSE, _("No text to find."));
g_free(locale_dir);
}
else
gtk_widget_hide(fif_dlg.dialog);
Expand Down Expand Up @@ -1708,9 +1727,7 @@ search_find_in_files(const gchar *utf8_search_text, const gchar *utf8_dir, const
return FALSE;
}
}

gtk_list_store_clear(msgwindow.store_msg);
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_MESSAGE);
reset_msgwin();

/* we can pass 'enc' without strdup'ing it here because it's a global const string and
* always exits longer than the lifetime of this function */
Expand Down Expand Up @@ -2214,9 +2231,7 @@ void search_find_usage(const gchar *search_text, const gchar *original_search_te
utils_beep();
return;
}

gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_MESSAGE);
gtk_list_store_clear(msgwindow.store_msg);
reset_msgwin();

if (! in_session)
{ /* use current document */
Expand Down
5 changes: 5 additions & 0 deletions src/ui_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,8 +1101,13 @@ void ui_document_show_hide(GeanyDocument *doc)
}


/* success = FALSE indicates an error for widget */
void ui_set_search_entry_background(GtkWidget *widget, gboolean success)
{
// set the entry, not just the button
if (GTK_IS_COMBO_BOX(widget))
widget = gtk_bin_get_child(GTK_BIN(widget));

gtk_widget_set_name(widget, success ? NULL : "geany-search-entry-no-match");
}

Expand Down

0 comments on commit c98ba87

Please sign in to comment.