mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-30 09:10:19 +00:00
Compare commits
4 Commits
mutli-line
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
069652a5f1 | ||
|
|
ab1e25bfb1 | ||
|
|
862aa0ede5 | ||
| bb36651548 |
@@ -41,7 +41,7 @@ static zoitechat_plugin *ph;
|
||||
static char name[] = "Sysinfo";
|
||||
static char desc[] = "Display info about your hardware and OS";
|
||||
static char version[] = "1.0";
|
||||
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [-e|-o] [CLIENT|UI|OS|CPU|RAM|DISK|GPU|CHIPSET|SOUND|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO SET <variable>\n";
|
||||
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [-e|-o] [CLIENT|UI|OS|CPU|RAM|STORAGE|GPU|CHIPSET|SOUND|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO SET <variable>\n";
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -68,7 +68,7 @@ static hwinfo hwinfos[] = {
|
||||
{"os", "OS", sysinfo_backend_get_os},
|
||||
{"cpu", "CPU", sysinfo_backend_get_cpu},
|
||||
{"memory", "Memory", sysinfo_backend_get_memory},
|
||||
{"storage", "Storage", sysinfo_backend_get_disk},
|
||||
{"storage", "Storage", sysinfo_backend_get_disk, TRUE},
|
||||
{"gpu", "GPU", sysinfo_backend_get_gpu},
|
||||
{"chipset", "CHIPSET", sysinfo_backend_get_chipset, TRUE},
|
||||
{"sound", "Sound", sysinfo_backend_get_sound, TRUE},
|
||||
|
||||
@@ -2968,41 +2968,10 @@ mg_create_dialogbuttons (GtkWidget *box)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mg_configure_topic_scroller (GtkWidget *scroller, GtkWidget *topic)
|
||||
{
|
||||
PangoContext *context;
|
||||
PangoFontMetrics *metrics;
|
||||
int line_height;
|
||||
int min_height;
|
||||
int max_height;
|
||||
|
||||
context = gtk_widget_get_pango_context (topic);
|
||||
metrics = pango_context_get_metrics (context,
|
||||
pango_context_get_font_description (context),
|
||||
pango_context_get_language (context));
|
||||
line_height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
|
||||
pango_font_metrics_get_descent (metrics));
|
||||
pango_font_metrics_unref (metrics);
|
||||
|
||||
if (line_height <= 0)
|
||||
line_height = 16;
|
||||
|
||||
min_height = line_height + 8;
|
||||
max_height = line_height * 4 + 8;
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller),
|
||||
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroller), GTK_SHADOW_NONE);
|
||||
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (scroller), TRUE);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scroller), min_height);
|
||||
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (scroller), max_height);
|
||||
}
|
||||
|
||||
static void
|
||||
mg_create_topicbar (session *sess, GtkWidget *box)
|
||||
{
|
||||
GtkWidget *vbox, *hbox, *mode_hbox, *topic, *bbox, *topic_scroller;
|
||||
GtkWidget *vbox, *hbox, *mode_hbox, *topic, *bbox;
|
||||
session_gui *gui = sess->gui;
|
||||
|
||||
gui->topic_bar = vbox = mg_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||
@@ -3015,14 +2984,12 @@ mg_create_topicbar (session *sess, GtkWidget *box)
|
||||
sess->res->tab = NULL;
|
||||
|
||||
gui->topic_entry = topic = gtk_text_view_new ();
|
||||
gtk_widget_set_name (topic, "zoitechat-topicbox");
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (topic), GTK_WRAP_WORD);
|
||||
gtk_widget_set_name (topic, "zoitechat-inputbox");
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (topic), GTK_WRAP_WORD_CHAR);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (topic), 4);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (topic), 4);
|
||||
topic_scroller = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (topic_scroller), topic);
|
||||
mg_configure_topic_scroller (topic_scroller, topic);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), topic_scroller, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), topic, TRUE, TRUE, 0);
|
||||
mg_apply_emoji_fallback_widget (topic);
|
||||
gtk_widget_add_events (topic, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
|
||||
g_signal_connect (G_OBJECT (topic), "key-press-event",
|
||||
|
||||
@@ -415,6 +415,24 @@ theme_manager_is_kde_wayland (void)
|
||||
return is_kde;
|
||||
}
|
||||
|
||||
static gint
|
||||
theme_manager_get_system_headerbar_height (void)
|
||||
{
|
||||
GtkWidget *probe;
|
||||
gint minimum;
|
||||
gint natural;
|
||||
|
||||
probe = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (probe), TRUE);
|
||||
gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR (probe), "menu:minimize,maximize,close");
|
||||
gtk_widget_show (probe);
|
||||
gtk_widget_get_preferred_height (probe, &minimum, &natural);
|
||||
gtk_widget_destroy (probe);
|
||||
if (natural > 0)
|
||||
return natural;
|
||||
return minimum;
|
||||
}
|
||||
|
||||
static void
|
||||
theme_manager_apply_wayland_kde_csd (GtkWidget *window)
|
||||
{
|
||||
@@ -442,10 +460,16 @@ theme_manager_apply_wayland_kde_csd (GtkWidget *window)
|
||||
headerbar = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (headerbar), TRUE);
|
||||
gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR (headerbar), "menu:minimize,maximize,close");
|
||||
icon_pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/icons/zoitechat.svg", 32, 32, TRUE, NULL);
|
||||
g_object_set (G_OBJECT (headerbar), "spacing", 0, NULL);
|
||||
gtk_widget_set_size_request (headerbar, -1, theme_manager_get_system_headerbar_height ());
|
||||
icon_pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/icons/zoitechat.svg", 24, 24, TRUE, NULL);
|
||||
if (!icon_pixbuf)
|
||||
icon_pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/icons/zoitechat.png", 32, 32, TRUE, NULL);
|
||||
icon_pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/icons/zoitechat.png", 24, 24, TRUE, NULL);
|
||||
icon_image = icon_pixbuf ? gtk_image_new_from_pixbuf (icon_pixbuf) : gtk_image_new_from_resource ("/icons/zoitechat.png");
|
||||
gtk_widget_set_margin_start (icon_image, 0);
|
||||
gtk_widget_set_margin_end (icon_image, 0);
|
||||
gtk_widget_set_margin_top (icon_image, 0);
|
||||
gtk_widget_set_margin_bottom (icon_image, 0);
|
||||
if (icon_pixbuf)
|
||||
g_object_unref (icon_pixbuf);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (headerbar), icon_image);
|
||||
|
||||
Reference in New Issue
Block a user