mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-12 00:30:19 +00:00
fix: quiet GTK/GLib warn spam; fix include order; normalize imported CSS
This commit is contained in:
@@ -59,7 +59,9 @@ struct DCC
|
||||
int resume_error;
|
||||
int resume_errno;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
GTimeVal lastcpstv, firstcpstv;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
goffset lastcpspos;
|
||||
gint64 maxcps;
|
||||
|
||||
|
||||
@@ -739,6 +739,51 @@ select_theme_root (GPtrArray *roots, const char *input_root)
|
||||
return selected;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
copy_css_file (const char *src, const char *dest, GError **error)
|
||||
{
|
||||
char *contents = NULL;
|
||||
char *normalized;
|
||||
gsize len = 0;
|
||||
GRegex *regex;
|
||||
|
||||
if (!g_file_get_contents (src, &contents, &len, error))
|
||||
return FALSE;
|
||||
|
||||
if (!g_strstr_len (contents, len, ":insensitive"))
|
||||
{
|
||||
gboolean ok = g_file_set_contents (dest, contents, len, error);
|
||||
g_free (contents);
|
||||
return ok;
|
||||
}
|
||||
|
||||
regex = g_regex_new (":insensitive", 0, 0, error);
|
||||
if (!regex)
|
||||
{
|
||||
g_free (contents);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
normalized = g_regex_replace_literal (regex, contents, -1, 0, ":disabled", 0, error);
|
||||
g_regex_unref (regex);
|
||||
if (!normalized)
|
||||
{
|
||||
g_free (contents);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!g_file_set_contents (dest, normalized, -1, error))
|
||||
{
|
||||
g_free (normalized);
|
||||
g_free (contents);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_free (normalized);
|
||||
g_free (contents);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
copy_tree (const char *src, const char *dest, GError **error)
|
||||
{
|
||||
@@ -768,19 +813,32 @@ copy_tree (const char *src, const char *dest, GError **error)
|
||||
}
|
||||
else
|
||||
{
|
||||
GFile *sf = g_file_new_for_path (s);
|
||||
GFile *df = g_file_new_for_path (d);
|
||||
if (!g_file_copy (sf, df, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, error))
|
||||
if (g_str_has_suffix (name, ".css"))
|
||||
{
|
||||
if (!copy_css_file (s, d, error))
|
||||
{
|
||||
g_free (s);
|
||||
g_free (d);
|
||||
g_dir_close (dir);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GFile *sf = g_file_new_for_path (s);
|
||||
GFile *df = g_file_new_for_path (d);
|
||||
if (!g_file_copy (sf, df, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, error))
|
||||
{
|
||||
g_object_unref (sf);
|
||||
g_object_unref (df);
|
||||
g_free (s);
|
||||
g_free (d);
|
||||
g_dir_close (dir);
|
||||
return FALSE;
|
||||
}
|
||||
g_object_unref (sf);
|
||||
g_object_unref (df);
|
||||
g_free (s);
|
||||
g_free (d);
|
||||
g_dir_close (dir);
|
||||
return FALSE;
|
||||
}
|
||||
g_object_unref (sf);
|
||||
g_object_unref (df);
|
||||
}
|
||||
g_free (s);
|
||||
g_free (d);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef ZOITECHAT_GTK3_THEME_SERVICE_H
|
||||
#define ZOITECHAT_GTK3_THEME_SERVICE_H
|
||||
|
||||
#include <glib.h>
|
||||
#include "zoitechat.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include "zoitechat.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
@@ -26,7 +27,6 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "zoitechat.h"
|
||||
#include "cfgfiles.h"
|
||||
#include "util.h"
|
||||
#include "text.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "../zoitechat.h"
|
||||
#include "../gtk3-theme-service.h"
|
||||
#include "../cfgfiles.h"
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
char *xdir = NULL;
|
||||
|
||||
char *
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "zoitechat.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "cfgfiles.h"
|
||||
#include "zoitechat.h"
|
||||
#include "theme-service.h"
|
||||
|
||||
static zoitechat_theme_post_apply_callback zoitechat_theme_post_apply_cb;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef ZOITECHAT_THEME_SERVICE_H
|
||||
#define ZOITECHAT_THEME_SERVICE_H
|
||||
|
||||
#include <glib.h>
|
||||
#include "zoitechat.h"
|
||||
|
||||
char *zoitechat_theme_service_get_themes_dir (void);
|
||||
GStrv zoitechat_theme_service_discover_themes (void);
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "fe-gtk.h"
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gdk/gdkcairo.h>
|
||||
@@ -40,7 +42,6 @@
|
||||
#include "../common/chanopt.h"
|
||||
#include "../common/cfgfiles.h"
|
||||
|
||||
#include "fe-gtk.h"
|
||||
#include "theme/theme-manager.h"
|
||||
#include "theme/theme-css.h"
|
||||
#include "banlist.h"
|
||||
|
||||
@@ -1860,16 +1860,6 @@ menu_about (GtkWidget *wid, gpointer sess)
|
||||
GtkAboutDialog *dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
|
||||
theme_manager_attach_window (GTK_WIDGET (dialog));
|
||||
char comment[512];
|
||||
char *license = "This program is free software; you can redistribute it and/or modify\n" \
|
||||
"it under the terms of the GNU General Public License as published by\n" \
|
||||
"the Free Software Foundation; version 2.\n\n" \
|
||||
"This program is distributed in the hope that it will be useful,\n" \
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" \
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" \
|
||||
"GNU General Public License for more details.\n\n" \
|
||||
"You should have received a copy of the GNU General Public License\n" \
|
||||
"along with this program. If not, see <http://www.gnu.org/licenses/>";
|
||||
|
||||
g_snprintf (comment, sizeof(comment), ""
|
||||
#ifdef WIN32
|
||||
"Portable Mode: %s\n"
|
||||
|
||||
@@ -414,8 +414,10 @@ tray_app_indicator_init (void)
|
||||
{
|
||||
GObjectClass *klass;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
tray_indicator = app_indicator_new ("zoitechat", ICON_NORMAL_NAME,
|
||||
APP_INDICATOR_CATEGORY_COMMUNICATIONS);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
if (!tray_indicator)
|
||||
return FALSE;
|
||||
|
||||
@@ -578,8 +580,13 @@ tray_backend_cleanup (void)
|
||||
static WinStatus
|
||||
tray_get_window_status (void)
|
||||
{
|
||||
GtkWindow *win;
|
||||
const char *st;
|
||||
|
||||
win = GTK_WINDOW (zoitechat_get_info (ph, "gtkwin_ptr"));
|
||||
if (win && !gtk_widget_get_visible (GTK_WIDGET (win)))
|
||||
return WS_HIDDEN;
|
||||
|
||||
st = zoitechat_get_info (ph, "win_status");
|
||||
|
||||
if (!st)
|
||||
@@ -998,6 +1005,7 @@ blink_item (unsigned int *setting, GtkWidget *menu, char *label)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_APPINDICATOR_BACKEND
|
||||
static void
|
||||
tray_menu_destroy (GtkWidget *menu, gpointer userdata)
|
||||
{
|
||||
@@ -1009,6 +1017,7 @@ tray_menu_destroy (GtkWidget *menu, gpointer userdata)
|
||||
g_source_remove (tray_menu_timer);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
static gboolean
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "../common/zoitechat.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "../common/zoitechat.h"
|
||||
#include "../common/cfgfiles.h"
|
||||
#include "../common/fe.h"
|
||||
#include "../common/text.h"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "../../fe-gtk.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../theme-access.h"
|
||||
#include "../theme-manager.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "../../fe-gtk.h"
|
||||
|
||||
#include "../theme-application.h"
|
||||
#include "../../maingui.h"
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include "../../../common/zoitechat.h"
|
||||
#include "../../../common/zoitechatc.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../theme-gtk3.h"
|
||||
#include "../../../common/gtk3-theme-service.h"
|
||||
#include "../../../common/zoitechat.h"
|
||||
#include "../../../common/zoitechatc.h"
|
||||
|
||||
struct session *current_sess;
|
||||
struct session *current_tab;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "../../fe-gtk.h"
|
||||
|
||||
#include "../theme-manager.h"
|
||||
#include "../theme-gtk3.h"
|
||||
#include "../../fe-gtk.h"
|
||||
#include "../../../common/zoitechat.h"
|
||||
#include "../../../common/zoitechatc.h"
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "../../fe-gtk.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "../theme-manager.h"
|
||||
#include "../../fe-gtk.h"
|
||||
#include "../../../common/zoitechat.h"
|
||||
#include "../../../common/zoitechatc.h"
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "../../fe-gtk.h"
|
||||
|
||||
#include "../theme-palette.h"
|
||||
#include "../theme-manager.h"
|
||||
#include "../../fe-gtk.h"
|
||||
#include "../../../common/zoitechat.h"
|
||||
#include "../../../common/zoitechatc.h"
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "../../fe-gtk.h"
|
||||
|
||||
#include "../../../common/zoitechat.h"
|
||||
#include "../../../common/zoitechatc.h"
|
||||
#include "../../../common/gtk3-theme-service.h"
|
||||
#include "../../fe-gtk.h"
|
||||
#include "../theme-gtk3.h"
|
||||
#include "../theme-manager.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#include "../../../common/zoitechat.h"
|
||||
#include "../../../common/zoitechatc.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <fcntl.h>
|
||||
@@ -8,8 +11,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../theme-runtime.h"
|
||||
#include "../../../common/zoitechat.h"
|
||||
#include "../../../common/zoitechatc.h"
|
||||
|
||||
struct session *current_sess;
|
||||
struct session *current_tab;
|
||||
|
||||
@@ -40,9 +40,11 @@ theme_access_get_gtk_palette_map (GtkWidget *widget, ThemeGtkPaletteMap *out_map
|
||||
return FALSE;
|
||||
|
||||
gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &out_map->text_foreground);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &out_map->text_background);
|
||||
gtk_style_context_get_color (context, GTK_STATE_FLAG_SELECTED, &out_map->selection_foreground);
|
||||
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &out_map->selection_background);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_get_color (context, GTK_STATE_FLAG_LINK, &accent);
|
||||
if (accent.alpha <= 0.0)
|
||||
accent = out_map->selection_background;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef ZOITECHAT_THEME_APPLICATION_H
|
||||
#define ZOITECHAT_THEME_APPLICATION_H
|
||||
|
||||
#include <glib.h>
|
||||
#include "../fe-gtk.h"
|
||||
|
||||
gboolean theme_application_apply_mode (unsigned int mode, gboolean *palette_changed);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "theme-gtk3.h"
|
||||
|
||||
#include "../../common/zoitechat.h"
|
||||
#include "../../common/zoitechatc.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <gio/gio.h>
|
||||
@@ -7,8 +10,6 @@
|
||||
|
||||
#include "theme-policy.h"
|
||||
#include "../../common/gtk3-theme-service.h"
|
||||
#include "../../common/zoitechat.h"
|
||||
#include "../../common/zoitechatc.h"
|
||||
|
||||
static GPtrArray *theme_gtk3_providers_base;
|
||||
static GPtrArray *theme_gtk3_providers_variant;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "theme-policy.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../fe-gtk.h"
|
||||
#include "../../common/zoitechat.h"
|
||||
#include "../../common/zoitechatc.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef ZOITECHAT_THEME_POLICY_H
|
||||
#define ZOITECHAT_THEME_POLICY_H
|
||||
|
||||
#include <glib.h>
|
||||
#include "../fe-gtk.h"
|
||||
|
||||
gboolean theme_policy_system_prefers_dark (void);
|
||||
gboolean theme_policy_is_dark_mode_active (unsigned int mode);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../common/zoitechat.h"
|
||||
#include "../../common/zoitechatc.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
@@ -8,9 +11,7 @@
|
||||
#include "../../common/fe.h"
|
||||
#include "../../common/util.h"
|
||||
#include "../../common/cfgfiles.h"
|
||||
#include "../../common/zoitechat.h"
|
||||
#include "../../common/gtk3-theme-service.h"
|
||||
#include "../../common/zoitechatc.h"
|
||||
#include "theme-gtk3.h"
|
||||
#include "theme-manager.h"
|
||||
#include "theme-preferences.h"
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#ifndef ZOITECHAT_THEME_PREFERENCES_H
|
||||
#define ZOITECHAT_THEME_PREFERENCES_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "theme-access.h"
|
||||
#include "../fe-gtk.h"
|
||||
#include "../../common/zoitechat.h"
|
||||
|
||||
#include "theme-access.h"
|
||||
|
||||
GtkWidget *theme_preferences_create_page (GtkWindow *parent,
|
||||
struct zoitechatprefs *setup_prefs,
|
||||
gboolean *color_change_flag);
|
||||
|
||||
@@ -318,12 +318,18 @@ xtext_surface_from_window (GdkWindow *window)
|
||||
static cairo_t *
|
||||
xtext_create_context (GtkXText *xtext)
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
if (xtext->draw_surface)
|
||||
return cairo_create (xtext->draw_surface);
|
||||
if (xtext->draw_cr)
|
||||
return cairo_reference (xtext->draw_cr);
|
||||
|
||||
return gdk_cairo_create (xtext->draw_window);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
cr = gdk_cairo_create (xtext->draw_window);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
return cr;
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -357,7 +363,7 @@ xtext_draw_line (GtkXText *xtext, cairo_t *cr, const XTextColor *color, int x1,
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static inline void
|
||||
static void
|
||||
xtext_draw_bg_offset (GtkXText *xtext, int x, int y, int width, int height, int tile_x, int tile_y)
|
||||
{
|
||||
cairo_t *cr = xtext_create_context (xtext);
|
||||
@@ -1065,8 +1071,10 @@ static inline void
|
||||
gtk_xtext_clear_background (GtkWidget *widget)
|
||||
{
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (window)
|
||||
gdk_window_set_background_pattern (window, NULL);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user