mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-04-01 02:00:19 +00:00
Compare commits
9 Commits
166542f1e3
...
c43915d609
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c43915d609 | ||
| 989ecc5a23 | |||
| a225af6d71 | |||
| d2407c39c7 | |||
| 4754cf3927 | |||
|
|
b23c1a73ca | ||
| 4cebe2ac8b | |||
| 44431d2c10 | |||
| 14a1ac0dfb |
@@ -17,11 +17,9 @@
|
||||
"--filesystem=~/.icons:ro",
|
||||
"--filesystem=xdg-run/tray-icon:create",
|
||||
"--env=GTK_CSD=1",
|
||||
|
||||
"--talk-name=org.freedesktop.Notifications",
|
||||
"--talk-name=org.kde.StatusNotifierWatcher",
|
||||
"--talk-name=com.canonical.AppMenu.Registrar",
|
||||
|
||||
"--talk-name=org.mpris.MediaPlayer2.*"
|
||||
],
|
||||
"add-extensions": {
|
||||
@@ -41,6 +39,7 @@
|
||||
"shared-modules/libcanberra/libcanberra.json",
|
||||
"shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json",
|
||||
"python3-cffi.json",
|
||||
"perl.json",
|
||||
{
|
||||
"name": "lgi",
|
||||
"buildsystem": "meson",
|
||||
@@ -57,8 +56,8 @@
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [
|
||||
"-Ddbus-service-use-appid=true",
|
||||
"-Dwith-perl=false",
|
||||
"-Dwith-python=false",
|
||||
"-Dwith-perl=perl",
|
||||
"-Dwith-python=python3",
|
||||
"-Dwith-lua=lua"
|
||||
],
|
||||
"build-options": {
|
||||
|
||||
20
flatpak/perl.json
Normal file
20
flatpak/perl.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "perl",
|
||||
"buildsystem": "simple",
|
||||
"build-commands": [
|
||||
"./Configure -des -Dprefix=/app -Dvendorprefix=/app -Duseshrplib -Dman1dir=none -Dman3dir=none",
|
||||
"make -j${FLATPAK_BUILDER_N_JOBS}",
|
||||
"make install"
|
||||
],
|
||||
"cleanup": [
|
||||
"/share/man",
|
||||
"/lib/perl5/*/*/CORE/*.a"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://www.cpan.org/src/5.0/perl-5.40.1.tar.xz",
|
||||
"sha256": "dfa20c2eef2b4af133525610bbb65dd13777ecf998c9c5b1ccf0d308e732ee3f"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7,13 +7,13 @@
|
||||
"sources": [
|
||||
{
|
||||
"type": "file",
|
||||
"url": "https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz",
|
||||
"sha256": "2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"
|
||||
"url": "https://files.pythonhosted.org/packages/1d/b2/31537cf4b1ca988837256c910a668b553fceb8f069bedc4b1c826024b52c/pycparser-2.22.tar.gz",
|
||||
"sha256": "491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"url": "https://files.pythonhosted.org/packages/a8/20/025f59f929bbcaa579704f443a438135918484fffaacfaddba776b374563/cffi-1.14.5.tar.gz",
|
||||
"sha256": "fd78e5fee591709f32ef6edb9a015b4aa1a5022598e36227500c8f4e02328d9c"
|
||||
"url": "https://files.pythonhosted.org/packages/fc/97/c783634659c2920c3fc70419e3af40972dbaf758daa229a7d6ea6135c90d/cffi-1.17.1.tar.gz",
|
||||
"sha256": "1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <stdbool.h>
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@@ -122,6 +122,9 @@ static void tray_init (void);
|
||||
static void tray_set_icon_state (TrayIcon icon, TrayIconState state);
|
||||
static void tray_menu_restore_cb (GtkWidget *item, gpointer userdata);
|
||||
static void tray_menu_notify_cb (GObject *tray, GParamSpec *pspec, gpointer user_data);
|
||||
static void tray_update_toggle_item_label (void);
|
||||
static gboolean tray_window_state_cb (GtkWidget *widget, GdkEventWindowState *event, gpointer userdata);
|
||||
static void tray_window_visibility_cb (GtkWidget *widget, gpointer userdata);
|
||||
#if HAVE_APPINDICATOR_BACKEND
|
||||
static void tray_menu_show_cb (GtkWidget *menu, gpointer userdata) G_GNUC_UNUSED;
|
||||
#endif
|
||||
@@ -165,6 +168,7 @@ static int tray_pub_count = 0;
|
||||
static int tray_hilight_count = 0;
|
||||
static int tray_file_count = 0;
|
||||
static int tray_restore_timer = 0;
|
||||
static GtkWidget *tray_toggle_item = NULL;
|
||||
|
||||
#if HAVE_APPINDICATOR_BACKEND
|
||||
static TrayCustomIcon
|
||||
@@ -890,6 +894,8 @@ tray_toggle_visibility (gboolean force_hide)
|
||||
gtk_window_present (win);
|
||||
}
|
||||
|
||||
tray_update_toggle_item_label ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1083,10 +1089,8 @@ tray_menu_populate (GtkWidget *menu)
|
||||
/* ph may have an invalid context now */
|
||||
zoitechat_set_context (ph, zoitechat_find_context (ph, NULL, NULL));
|
||||
|
||||
if (tray_get_window_status () == WS_HIDDEN)
|
||||
tray_make_item (menu, _("_Restore Window"), tray_menu_restore_cb, NULL);
|
||||
else
|
||||
tray_make_item (menu, _("_Hide Window"), tray_menu_restore_cb, NULL);
|
||||
tray_toggle_item = tray_make_item (menu, _("_Hide Window"), tray_menu_restore_cb, NULL);
|
||||
tray_update_toggle_item_label ();
|
||||
tray_make_item (menu, NULL, tray_menu_quit_cb, NULL);
|
||||
|
||||
#ifndef WIN32 /* submenus are buggy on win32 */
|
||||
@@ -1128,8 +1132,28 @@ tray_menu_clear (GtkWidget *menu)
|
||||
for (iter = children; iter; iter = iter->next)
|
||||
gtk_widget_destroy (GTK_WIDGET (iter->data));
|
||||
g_list_free (children);
|
||||
tray_toggle_item = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
tray_update_toggle_item_label (void)
|
||||
{
|
||||
const char *label;
|
||||
|
||||
if (!tray_toggle_item)
|
||||
return;
|
||||
|
||||
if (tray_get_window_status () == WS_HIDDEN)
|
||||
label = _("_Restore Window");
|
||||
else
|
||||
label = _("_Hide Window");
|
||||
|
||||
gtk_menu_item_set_label (GTK_MENU_ITEM (tray_toggle_item), label);
|
||||
gtk_menu_item_set_use_underline (GTK_MENU_ITEM (tray_toggle_item), TRUE);
|
||||
}
|
||||
|
||||
#if !defined(WIN32)
|
||||
static void G_GNUC_UNUSED
|
||||
tray_menu_show_cb (GtkWidget *menu, gpointer userdata)
|
||||
{
|
||||
@@ -1140,6 +1164,27 @@ tray_menu_show_cb (GtkWidget *menu, gpointer userdata)
|
||||
}
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
tray_window_state_cb (GtkWidget *widget, GdkEventWindowState *event, gpointer userdata)
|
||||
{
|
||||
(void)widget;
|
||||
(void)event;
|
||||
(void)userdata;
|
||||
|
||||
tray_update_toggle_item_label ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
tray_window_visibility_cb (GtkWidget *widget, gpointer userdata)
|
||||
{
|
||||
(void)widget;
|
||||
(void)userdata;
|
||||
|
||||
tray_update_toggle_item_label ();
|
||||
}
|
||||
|
||||
#if !HAVE_APPINDICATOR_BACKEND
|
||||
static void
|
||||
tray_menu_cb (GtkWidget *widget, guint button, guint time, gpointer userdata)
|
||||
@@ -1381,6 +1426,19 @@ tray_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name,
|
||||
zoitechat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL);
|
||||
|
||||
GtkWindow *window = GTK_WINDOW(zoitechat_get_info (ph, "gtkwin_ptr"));
|
||||
GtkWidget *window_widget;
|
||||
|
||||
if (window)
|
||||
{
|
||||
window_widget = GTK_WIDGET (window);
|
||||
g_signal_connect (G_OBJECT (window_widget), "window-state-event",
|
||||
G_CALLBACK (tray_window_state_cb), NULL);
|
||||
g_signal_connect (G_OBJECT (window_widget), "show",
|
||||
G_CALLBACK (tray_window_visibility_cb), NULL);
|
||||
g_signal_connect (G_OBJECT (window_widget), "hide",
|
||||
G_CALLBACK (tray_window_visibility_cb), NULL);
|
||||
}
|
||||
|
||||
if (prefs.hex_gui_tray && gtkutil_tray_icon_supported (window))
|
||||
tray_init ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user