6 Commits

Author SHA1 Message Date
99f02cd8e1 Relax freedesktop notification DBus timeouts 2026-05-27 11:01:52 -06:00
deepend-tildeclub
d93c9aa780 Merge pull request #255 from ZoiteChat/kde-dialog-native-controls
Use native file chooser dialogs everywhere
2026-05-26 13:14:24 -06:00
ea56504aee Use native file chooser dialogs everywhere 2026-05-26 02:24:06 -06:00
46b91edfdf Bundle Perl paths into AppImage runtime 2026-05-25 23:08:41 -06:00
deepend-tildeclub
d2dfde519d Merge pull request #253 from ZoiteChat/timedate-tooltop
Add timestamp/date hover tooltips
2026-05-25 15:58:40 -06:00
1eac56f22c Add timestamp/date hover tooltips 2026-05-25 14:49:30 -06:00
5 changed files with 83 additions and 144 deletions

View File

@@ -86,11 +86,21 @@ jobs:
cp -a /usr/lib/x86_64-linux-gnu/python3/dist-packages AppDir/usr/lib/x86_64-linux-gnu/python3/
fi
if [ -d "/usr/lib/x86_64-linux-gnu/perl-base" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/perl-base AppDir/usr/lib/x86_64-linux-gnu/
fi
if [ -d "/usr/lib/x86_64-linux-gnu/perl" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/perl AppDir/usr/lib/x86_64-linux-gnu/
fi
if [ -d "/usr/lib/x86_64-linux-gnu/perl5" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/perl5 AppDir/usr/lib/x86_64-linux-gnu/
fi
if [ -d "/usr/share/perl" ]; then
install -d AppDir/usr/share
cp -a /usr/share/perl AppDir/usr/share/
@@ -100,6 +110,10 @@ jobs:
install -d AppDir/usr/share
cp -a /usr/share/perl5 AppDir/usr/share/
fi
perl -MFile::Spec -e 'print "Build host File::Spec: $INC{\"File/Spec.pm\"}\n"'
find AppDir/usr -path '*/File/Spec.pm' -print -quit | grep -q .
if compgen -G '/usr/lib/x86_64-linux-gnu/libpython3*.so*' > /dev/null; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/libpython3*.so* AppDir/usr/lib/x86_64-linux-gnu/
@@ -162,7 +176,7 @@ jobs:
APPDIR="${APPDIR:-$(dirname "$(readlink -f "$0")")}"
export PATH="${PATH:-/usr/bin:/bin}:$APPDIR/usr/bin"
export PATH="$APPDIR/usr/bin:${PATH:-/usr/bin:/bin}"
export LD_LIBRARY_PATH="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:-}"
export XDG_DATA_DIRS="$APPDIR/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
export GTK_EXE_PREFIX="$APPDIR/usr"
@@ -211,6 +225,23 @@ jobs:
unset GTK_MODULES
perl5lib_entries=""
for dir in \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl-base" \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl"/* \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl5"/* \
"$APPDIR/usr/share/perl"/* \
"$APPDIR/usr/share/perl5"
do
if [ -d "$dir" ]; then
perl5lib_entries="${perl5lib_entries:+$perl5lib_entries:}$dir"
fi
done
if [ -n "$perl5lib_entries" ]; then
export PERL5LIB="$perl5lib_entries${PERL5LIB:+:$PERL5LIB}"
fi
export PYTHONHOME="$APPDIR/usr"
python_stdlib_dir="$(find "$APPDIR/usr/lib" -maxdepth 1 -type d -name 'python3.*' | head -n 1 || true)"
pythonpath_entries=""
@@ -256,7 +287,6 @@ jobs:
EOF
chmod +x AppRun
VERSION="$(git describe --tags --always)"
./linuxdeploy-x86_64.AppImage \

View File

@@ -272,13 +272,6 @@ gtkutil_apply_palette (GtkWidget *widget, const GdkRGBA *bg, const GdkRGBA *fg,
theme_manager_apply_palette_widget (widget, bg, fg, font_desc);
}
static void
gtkutil_file_req_destroy (GtkWidget * wid, struct file_req *freq)
{
freq->callback (freq->userdata, NULL);
g_free (freq);
}
static void
gtkutil_check_file (char *filename, struct file_req *freq)
{
@@ -390,26 +383,6 @@ gtkutil_file_req_done_chooser (GtkFileChooser *fs, struct file_req *freq)
}
static void
gtkutil_file_req_done (GtkWidget * wid, struct file_req *freq)
{
gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (freq->dialog), freq);
gtk_widget_destroy (freq->dialog);
}
static void
gtkutil_file_req_response (GtkWidget *dialog, gint res, struct file_req *freq)
{
if (res == GTK_RESPONSE_ACCEPT)
{
gtkutil_file_req_done (dialog, freq);
return;
}
gtk_widget_destroy (dialog);
}
#ifdef WIN32
static gboolean
gtkutil_native_dialog_unref_idle (gpointer native)
{
@@ -423,27 +396,16 @@ gtkutil_native_file_req_response (GtkNativeDialog *dialog, gint res, struct file
if (res == GTK_RESPONSE_ACCEPT)
gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (dialog), freq);
/* Match gtk dialog flow by always sending NULL to indicate completion. */
freq->callback (freq->userdata, NULL);
g_free (freq);
/*
* Defer unref until idle to avoid disposing the native chooser while
* still in the button-release signal stack on Windows.
*/
g_idle_add (gtkutil_native_dialog_unref_idle, dialog);
}
#endif
void
gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *userdata, char *filter, char *extensions,
int flags)
{
struct file_req *freq;
GtkWidget *dialog;
GtkFileFilter *filefilter;
char *token;
char *tokenbuffer;
const char *xdir;
GtkWindow *effective_parent = parent;
@@ -453,7 +415,6 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
xdir = get_xdir ();
#ifdef WIN32
{
GtkFileChooserNative *native = gtk_file_chooser_native_new (
title,
@@ -529,107 +490,7 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
return;
}
#endif
if (flags & FRF_WRITE)
{
dialog = gtk_file_chooser_dialog_new (title, NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Save"), GTK_RESPONSE_ACCEPT,
NULL);
if (!(flags & FRF_NOASKOVERWRITE))
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
}
else
dialog = gtk_file_chooser_dialog_new (title, NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Open"), GTK_RESPONSE_ACCEPT,
NULL);
theme_manager_attach_window (dialog);
if (filter && filter[0] && (flags & FRF_FILTERISINITIAL))
{
if (flags & FRF_WRITE)
{
char temp[1024];
path_part (filter, temp, sizeof (temp));
if (temp[0] && g_file_test (temp, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), temp);
else if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file_part (filter));
}
else
{
if (g_file_test (filter, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), filter);
else if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
}
}
else if (!(flags & FRF_RECENTLYUSED))
{
if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
}
if (flags & FRF_MULTIPLE)
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
if (flags & FRF_CHOOSEFOLDER)
gtk_file_chooser_set_action (GTK_FILE_CHOOSER (dialog), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
if ((flags & FRF_EXTENSIONS || flags & FRF_MIMETYPES) && extensions != NULL)
{
filefilter = gtk_file_filter_new ();
tokenbuffer = g_strdup (extensions);
token = strtok (tokenbuffer, ";");
while (token != NULL)
{
if (flags & FRF_EXTENSIONS)
gtk_file_filter_add_pattern (filefilter, token);
else
gtk_file_filter_add_mime_type (filefilter, token);
token = strtok (NULL, ";");
}
g_free (tokenbuffer);
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filefilter);
}
if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
{
GError *shortcut_error = NULL;
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog), xdir, &shortcut_error);
if (shortcut_error)
g_error_free (shortcut_error);
}
freq = g_new (struct file_req, 1);
freq->dialog = dialog;
freq->flags = flags;
freq->callback = callback;
freq->userdata = userdata;
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (gtkutil_file_req_response), freq);
g_signal_connect (G_OBJECT (dialog), "destroy",
G_CALLBACK (gtkutil_file_req_destroy), (gpointer) freq);
if (effective_parent)
gtk_window_set_transient_for (GTK_WINDOW (dialog), effective_parent);
if (flags & FRF_MODAL)
{
g_assert (effective_parent);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
}
gtk_widget_show (dialog);
}
static gboolean

View File

@@ -75,7 +75,7 @@ notification_backend_show (const char *title, const char *text)
"Notify",
g_variant_builder_end (&params),
G_DBUS_CALL_FLAGS_NONE,
1000,
-1,
NULL,
(GAsyncReadyCallback)on_notify_ready,
NULL);
@@ -108,7 +108,7 @@ notification_backend_init (const char **error)
"GetCapabilities",
NULL,
G_DBUS_CALL_FLAGS_NONE,
30,
1000,
NULL,
&err);

View File

@@ -2300,6 +2300,12 @@ gtk_xtext_leave_notify (GtkWidget * widget, GdkEventCrossing * event)
xtext->hilight_ent = NULL;
}
if (xtext->tooltip_stamp_set)
{
gtk_widget_set_tooltip_text (widget, NULL);
xtext->tooltip_stamp_set = FALSE;
}
return FALSE;
}
@@ -2466,7 +2472,7 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event)
}
if (xtext->urlcheck_function == NULL)
return FALSE;
goto tooltip_check;
word_type = gtk_xtext_get_word_adjust (xtext, x, y, &word_ent, &offset, &len);
if (word_type > 0)
@@ -2504,6 +2510,46 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event)
return FALSE;
}
tooltip_check:
if (xtext->buffer->time_stamp && xtext->buffer->indent > 0 && x >= 0 && x < xtext->stamp_width)
{
textentry *ent = gtk_xtext_find_char (xtext, x, y, NULL, NULL);
if (ent && (!xtext->tooltip_stamp_set || xtext->tooltip_stamp != ent->stamp))
{
char tooltip[96];
strftime_utf8 (tooltip, sizeof (tooltip), "%Y-%m-%d", ent->stamp);
gtk_widget_set_tooltip_text (widget, tooltip);
xtext->tooltip_stamp = ent->stamp;
xtext->tooltip_stamp_set = TRUE;
}
if (ent)
return FALSE;
}
else if (!xtext->buffer->time_stamp && x >= xtext->buffer->indent)
{
textentry *ent = gtk_xtext_find_char (xtext, x, y, NULL, NULL);
if (ent && ent->stamp && (!xtext->tooltip_stamp_set || xtext->tooltip_stamp != ent->stamp))
{
char tooltip[128];
char date[64];
char *stamp_text;
strftime_utf8 (date, sizeof (date), "%Y-%m-%d", ent->stamp);
xtext_get_stamp_str (ent->stamp, &stamp_text);
g_snprintf (tooltip, sizeof (tooltip), "%s %s", date, stamp_text);
gtk_widget_set_tooltip_text (widget, tooltip);
g_free (stamp_text);
xtext->tooltip_stamp = ent->stamp;
xtext->tooltip_stamp_set = TRUE;
}
if (ent)
return FALSE;
}
else if (xtext->tooltip_stamp_set)
{
gtk_widget_set_tooltip_text (widget, NULL);
xtext->tooltip_stamp_set = FALSE;
}
gtk_xtext_leave_notify (widget, NULL);
return FALSE;

View File

@@ -190,6 +190,8 @@ struct _GtkXText
textentry *hilight_ent;
int hilight_start;
int hilight_end;
time_t tooltip_stamp;
unsigned int tooltip_stamp_set:1;
guint16 fontwidth[128]; /* each char's width, only the ASCII ones */