mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Merge pull request #75 from ZoiteChat/nogtk2
GTK2 Build Compatibility Removal
This commit is contained in:
1
.github/workflows/appimage-build.yml
vendored
1
.github/workflows/appimage-build.yml
vendored
@@ -43,7 +43,6 @@ jobs:
|
||||
rm -rf build
|
||||
meson setup build \
|
||||
--prefix=/usr \
|
||||
-Dgtk3=true \
|
||||
-Dtext-frontend=true \
|
||||
-Dwith-perl=perl \
|
||||
-Dwith-python=python3 \
|
||||
|
||||
1
debian/rules
vendored
1
debian/rules
vendored
@@ -7,7 +7,6 @@ export DH_VERBOSE=1
|
||||
|
||||
override_dh_auto_configure:
|
||||
dh_auto_configure -- \
|
||||
-Dgtk3=true \
|
||||
-Dinstall-plugin-metainfo=false \
|
||||
-Dwith-lua=lua53
|
||||
|
||||
|
||||
@@ -56,14 +56,13 @@
|
||||
"name": "zoitechat",
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [
|
||||
"-Dgtk3=true",
|
||||
"-Ddbus-service-use-appid=true",
|
||||
"-Dwith-perl=false",
|
||||
"-Dwith-python=false",
|
||||
"-Dwith-lua=lua"
|
||||
],
|
||||
"build-options": {
|
||||
"cflags": "-Dgtk3=true -Wno-error=missing-include-dirs"
|
||||
"cflags": "-Wno-error=missing-include-dirs"
|
||||
},
|
||||
"cleanup": [
|
||||
"/share/man"
|
||||
|
||||
@@ -42,6 +42,7 @@ config_h.set('USE_OPENSSL', libssl_dep.found())
|
||||
config_h.set('USE_LIBCANBERRA', libcanberra_dep.found())
|
||||
config_h.set('USE_DBUS', dbus_glib_dep.found())
|
||||
config_h.set('USE_PLUGIN', get_option('plugin'))
|
||||
config_h.set('USE_GTK_FRONTEND', get_option('gtk-frontend'))
|
||||
|
||||
config_h.set('G_DISABLE_SINGLE_INCLUDES', true)
|
||||
config_h.set('GTK_DISABLE_DEPRECATED', true)
|
||||
@@ -177,6 +178,7 @@ if meson.version().version_compare('>= 0.55.0')
|
||||
}, section: 'Directories')
|
||||
|
||||
summary({
|
||||
'GTK Frontend': get_option('gtk-frontend') ? 'enabled (GTK+ 3.22+)' : 'disabled',
|
||||
'TLS (openssl)': libssl_dep.found(),
|
||||
'Plugin Support': get_option('plugin'),
|
||||
'DBus Support': dbus_glib_dep.found(),
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
option('gtk-frontend', type: 'boolean',
|
||||
description: 'Main graphical interface'
|
||||
)
|
||||
option('gtk3', type: 'boolean', value: false,
|
||||
description: 'Build GTK frontend against GTK 3'
|
||||
)
|
||||
option('text-frontend', type: 'boolean', value: false,
|
||||
description: 'Text interface (not generally useful)'
|
||||
)
|
||||
@@ -23,7 +20,7 @@ option('libcanberra', type: 'feature', value: 'auto',
|
||||
description: 'Support for sound alerts, Unix only'
|
||||
)
|
||||
option('appindicator', type: 'feature', value: 'auto',
|
||||
description: 'Use Ayatana/AppIndicator-based tray backend when GTK3 is enabled'
|
||||
description: 'Use Ayatana/AppIndicator-based tray backend for GTK frontend (non-Windows only)'
|
||||
)
|
||||
|
||||
# Install options
|
||||
|
||||
@@ -30,9 +30,10 @@ export GTK_DATA_PREFIX="$bundle_res"
|
||||
export GTK_EXE_PREFIX="$bundle_res"
|
||||
export GTK_PATH="$bundle_res"
|
||||
|
||||
export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
|
||||
export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
|
||||
export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
|
||||
export GTK_THEME="Mac"
|
||||
export GTK_KEY_THEME="Mac"
|
||||
export GTK_IM_MODULE_FILE="$bundle_etc/gtk-3.0/gtk.immodules"
|
||||
export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-3.0/gdk-pixbuf.loaders"
|
||||
export PANGO_LIBDIR="$bundle_lib"
|
||||
export PANGO_SYSCONFDIR="$bundle_etc"
|
||||
|
||||
|
||||
5
osx/settings.ini
Normal file
5
osx/settings.ini
Normal file
@@ -0,0 +1,5 @@
|
||||
[Settings]
|
||||
gtk-theme-name=Mac
|
||||
gtk-key-theme-name=Mac
|
||||
gtk-menu-images=0
|
||||
gtk-button-images=0
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<run-install-name-tool/>
|
||||
<launcher-script>${project}/launcher.sh</launcher-script >
|
||||
<gtk>gtk+-2.0</gtk>
|
||||
<gtk>gtk+-3.0</gtk>
|
||||
</meta>
|
||||
|
||||
<plist>${project}/Info.plist</plist>
|
||||
@@ -47,18 +47,18 @@
|
||||
${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/
|
||||
</binary>
|
||||
<data>
|
||||
${prefix}/share/themes/Mac/gtk-2.0-key/gtkrc
|
||||
${prefix}/share/themes/Mac/gtk-3.0/gtk-keys.css
|
||||
</data>
|
||||
|
||||
<translations name="gtk20">
|
||||
<translations name="gtk30">
|
||||
${prefix}/share/locale
|
||||
</translations>
|
||||
<translations name="zoitechat">
|
||||
${prefix}/share/locale
|
||||
</translations>
|
||||
|
||||
<data dest="${bundle}/Contents/Resources/etc/${gtkdir}/gtkrc">
|
||||
${project}/gtkrc
|
||||
<data dest="${bundle}/Contents/Resources/etc/${gtkdir}/settings.ini">
|
||||
${project}/settings.ini
|
||||
</data>
|
||||
|
||||
<data dest="${bundle}/Contents/Resources">
|
||||
|
||||
@@ -26,7 +26,6 @@ builddeps :
|
||||
setup : |
|
||||
%meson_configure \
|
||||
-Dgtk-frontend=true \
|
||||
-Dgtk3=true \
|
||||
-Dinstall-appdata=true
|
||||
build : |
|
||||
%ninja_build
|
||||
|
||||
@@ -10,7 +10,7 @@ sysinfo_deps = [
|
||||
]
|
||||
|
||||
sysinfo_includes = []
|
||||
sysinfo_cargs = []
|
||||
sysinfo_cargs = ['-DHAVE_CONFIG_H']
|
||||
|
||||
system = host_machine.system()
|
||||
if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system == 'darwin' or system == 'freebsd'
|
||||
@@ -19,6 +19,10 @@ if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system =
|
||||
'shared/df.c'
|
||||
]
|
||||
|
||||
if get_option('gtk-frontend')
|
||||
sysinfo_cargs += '-DUSE_GTK_FRONTEND'
|
||||
endif
|
||||
|
||||
if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system == 'freebsd'
|
||||
libpci = dependency('libpci', required: false, method: 'pkg-config')
|
||||
if libpci.found()
|
||||
@@ -30,6 +34,10 @@ if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system =
|
||||
pciids = join_paths(picidsdir, 'pci.ids')
|
||||
sysinfo_cargs += '-DPCIIDS_FILE="@0@"'.format(pciids)
|
||||
endif
|
||||
if get_option('gtk-frontend')
|
||||
sysinfo_deps += dependency('gtk+-3.0', version: '>= 3.22')
|
||||
endif
|
||||
|
||||
sysinfo_includes += 'unix'
|
||||
sysinfo_sources += [
|
||||
'unix/backend.c',
|
||||
@@ -52,7 +60,7 @@ endif
|
||||
|
||||
shared_module('sysinfo', sysinfo_sources,
|
||||
dependencies: sysinfo_deps,
|
||||
include_directories: include_directories(sysinfo_includes),
|
||||
include_directories: [config_h_include, include_directories(sysinfo_includes)],
|
||||
c_args: sysinfo_cargs,
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "format.h"
|
||||
#include "df.h"
|
||||
|
||||
@@ -276,12 +280,8 @@ sysinfo_backend_get_network(void)
|
||||
|
||||
static const char *sysinfo_detect_toolkit(void)
|
||||
{
|
||||
#if defined(HAVE_GTK3)
|
||||
#if defined(USE_GTK_FRONTEND)
|
||||
return "GTK3";
|
||||
#elif defined(HAVE_GTK2)
|
||||
return "GTK2";
|
||||
#elif defined(HAVE_GTK)
|
||||
return "GTK";
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,7 @@ char *sysinfo_backend_get_network(void);
|
||||
|
||||
/*
|
||||
* Short description of the UI/toolkit + display backend.
|
||||
* Examples: "GTK3 / Wayland", "GTK2 / X11", "Windows / GTK3".
|
||||
* Examples: "GTK3 / Wayland", "Windows / GTK3".
|
||||
*/
|
||||
char *sysinfo_backend_get_ui(void);
|
||||
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#if defined(HAVE_GTK3) || defined(HAVE_GTK2) || defined(HAVE_GTK)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_GTK_FRONTEND)
|
||||
#include <gdk/gdk.h>
|
||||
#endif
|
||||
#include "parse.h"
|
||||
@@ -175,12 +179,8 @@ char *sysinfo_backend_get_network(void)
|
||||
|
||||
static const char *sysinfo_detect_toolkit(void)
|
||||
{
|
||||
#if defined(HAVE_GTK3)
|
||||
#if defined(USE_GTK_FRONTEND)
|
||||
return "GTK3";
|
||||
#elif defined(HAVE_GTK2)
|
||||
return "GTK2";
|
||||
#elif defined(HAVE_GTK)
|
||||
return "GTK";
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
@@ -194,7 +194,7 @@ static const char *sysinfo_detect_display_backend(void)
|
||||
const gboolean session_wayland = session && g_ascii_strcasecmp(session, "wayland") == 0;
|
||||
|
||||
/* Best-effort: ask GDK what it actually opened, if available. */
|
||||
#if defined(HAVE_GTK3) || defined(HAVE_GTK2) || defined(HAVE_GTK)
|
||||
#if defined(USE_GTK_FRONTEND)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default();
|
||||
if (display)
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../../../src/common/sysinfo/sysinfo.h"
|
||||
|
||||
#include "../format.h"
|
||||
@@ -106,12 +110,8 @@ static char *get_memory_info (void)
|
||||
|
||||
static const char *sysinfo_detect_toolkit(void)
|
||||
{
|
||||
#if defined(HAVE_GTK3)
|
||||
#if defined(USE_GTK_FRONTEND)
|
||||
return "GTK3";
|
||||
#elif defined(HAVE_GTK2)
|
||||
return "GTK2";
|
||||
#elif defined(HAVE_GTK)
|
||||
return "GTK";
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
@@ -137,11 +137,7 @@ ascii_open (void)
|
||||
if (table_pos[0] == '\n' || i == 0)
|
||||
{
|
||||
table_pos++;
|
||||
#if HAVE_GTK3
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
#elif !HAVE_GTK3
|
||||
hbox = gtk_hbox_new (0, 0);
|
||||
#endif
|
||||
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
i++;
|
||||
|
||||
@@ -37,16 +37,9 @@
|
||||
#include "maingui.h"
|
||||
#include "banlist.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_BANLIST_REMOVE "list-remove"
|
||||
#define ICON_BANLIST_CLEAR "edit-clear"
|
||||
#define ICON_BANLIST_REFRESH "view-refresh"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_BANLIST_REMOVE GTK_STOCK_REMOVE
|
||||
#define ICON_BANLIST_CLEAR GTK_STOCK_CLEAR
|
||||
#define ICON_BANLIST_REFRESH GTK_STOCK_REFRESH
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These supports_* routines set capable, readable, writable bits */
|
||||
@@ -788,11 +781,7 @@ banlist_table_new (void)
|
||||
{
|
||||
GtkWidget *table = gtkutil_grid_new (1, MODE_CT, FALSE);
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table), 16);
|
||||
#else
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 16);
|
||||
#endif
|
||||
return table;
|
||||
}
|
||||
|
||||
@@ -857,13 +846,8 @@ banlist_opengui (struct session *sess)
|
||||
GTKUTIL_ATTACH_FILL, GTKUTIL_ATTACH_FILL, 0, 0);
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), bbox, 0, 0, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
@@ -77,15 +77,10 @@ chanlistrow;
|
||||
static void
|
||||
chanlist_set_label_alignment (GtkWidget *widget)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
static void
|
||||
chanlist_grid_attach (GtkWidget *grid, GtkWidget *child,
|
||||
gint column, gint row,
|
||||
@@ -99,19 +94,14 @@ chanlist_grid_attach (GtkWidget *grid, GtkWidget *child,
|
||||
gtk_widget_set_valign (child, valign);
|
||||
gtk_grid_attach (GTK_GRID (grid), child, column, row, width, height);
|
||||
}
|
||||
#endif
|
||||
|
||||
static GtkWidget *
|
||||
chanlist_box_new (void)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
|
||||
return box;
|
||||
#elif !HAVE_GTK3
|
||||
return gtk_hbox_new (FALSE, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
@@ -136,7 +126,6 @@ chanlist_icon_menu_item (const char *label, const char *icon_name,
|
||||
GCallback callback, gpointer userdata)
|
||||
{
|
||||
GtkWidget *item;
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *box;
|
||||
GtkWidget *image = NULL;
|
||||
GtkWidget *label_widget;
|
||||
@@ -149,13 +138,6 @@ chanlist_icon_menu_item (const char *label, const char *icon_name,
|
||||
gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), label_widget, FALSE, FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (item), box);
|
||||
#else
|
||||
GtkWidget *image;
|
||||
|
||||
item = gtk_image_menu_item_new_with_mnemonic (label);
|
||||
image = gtkutil_image_new_from_stock (icon_name, GTK_ICON_SIZE_MENU);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
|
||||
#endif
|
||||
g_signal_connect (G_OBJECT (item), "activate", callback, userdata);
|
||||
gtk_widget_show_all (item);
|
||||
|
||||
@@ -735,7 +717,6 @@ chanlist_button_cb (GtkTreeView *tree, GdkEventButton *event, server *serv)
|
||||
menu_addfavoritemenu (serv, menu, chan, FALSE);
|
||||
g_free (chan);
|
||||
|
||||
#if HAVE_GTK3
|
||||
if (event)
|
||||
{
|
||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *)event);
|
||||
@@ -747,10 +728,6 @@ chanlist_button_cb (GtkTreeView *tree, GdkEventButton *event, server *serv)
|
||||
GDK_GRAVITY_NORTH_WEST,
|
||||
NULL);
|
||||
}
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, event ? event->time : 0);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -902,108 +879,48 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
|
||||
/* ============================================================= */
|
||||
|
||||
#if HAVE_GTK3
|
||||
table = gtk_grid_new ();
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table), 12);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table), 3);
|
||||
#else
|
||||
table = gtk_table_new (4, 4, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, 0, 1, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
#if HAVE_GTK3
|
||||
wid = chanlist_icon_button (_("_Search"), ICON_CHANLIST_FIND,
|
||||
G_CALLBACK (chanlist_search_pressed), serv);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
wid = gtkutil_button (NULL, ICON_CHANLIST_FIND, 0, chanlist_search_pressed, serv,
|
||||
_("_Search"));
|
||||
#endif
|
||||
serv->gui->chanlist_search = wid;
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 3, 3, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_FILL, GTK_ALIGN_FILL);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 3, 4,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
wid = chanlist_icon_button (_("_Download List"), ICON_CHANLIST_REFRESH,
|
||||
G_CALLBACK (chanlist_refresh), serv);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
wid = gtkutil_button (NULL, ICON_CHANLIST_REFRESH, 0, chanlist_refresh, serv,
|
||||
_("_Download List"));
|
||||
#endif
|
||||
serv->gui->chanlist_refresh = wid;
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 3, 2, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_FILL, GTK_ALIGN_FILL);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 2, 3,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
wid = chanlist_icon_button (_("Save _List..."), ICON_CHANLIST_SAVE,
|
||||
G_CALLBACK (chanlist_save), serv);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
wid = gtkutil_button (NULL, ICON_CHANLIST_SAVE, 0, chanlist_save, serv,
|
||||
_("Save _List..."));
|
||||
#endif
|
||||
serv->gui->chanlist_savelist = wid;
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 3, 1, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_FILL, GTK_ALIGN_FILL);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
wid = chanlist_icon_button (_("_Join Channel"), ICON_CHANLIST_JOIN,
|
||||
G_CALLBACK (chanlist_join), serv);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
wid = gtkutil_button (NULL, ICON_CHANLIST_JOIN, 0, chanlist_join, serv,
|
||||
_("_Join Channel"));
|
||||
#endif
|
||||
serv->gui->chanlist_join = wid;
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 3, 0, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_FILL, GTK_ALIGN_FILL);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
|
||||
/* ============================================================= */
|
||||
|
||||
wid = gtk_label_new (_("Show only:"));
|
||||
chanlist_set_label_alignment (wid);
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 0, 3, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_START, GTK_ALIGN_CENTER);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 3, 4,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
gtk_widget_show (wid);
|
||||
|
||||
hbox = chanlist_box_new ();
|
||||
gtk_box_set_spacing (GTK_BOX (hbox), 9);
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, hbox, 1, 3, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_FILL, GTK_ALIGN_FILL);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 3, 4,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
wid = gtk_label_new (_("channels with"));
|
||||
@@ -1039,24 +956,14 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
|
||||
wid = gtk_label_new (_("Look in:"));
|
||||
chanlist_set_label_alignment (wid);
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 0, 2, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_START, GTK_ALIGN_CENTER);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 2, 3,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
gtk_widget_show (wid);
|
||||
|
||||
hbox = chanlist_box_new ();
|
||||
gtk_box_set_spacing (GTK_BOX (hbox), 12);
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, hbox, 1, 2, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_FILL, GTK_ALIGN_FILL);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 2, 3,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
wid = gtk_check_button_new_with_label (_("Channel name"));
|
||||
@@ -1081,13 +988,8 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
|
||||
wid = gtk_label_new (_("Search type:"));
|
||||
chanlist_set_label_alignment (wid);
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 0, 1, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_START, GTK_ALIGN_CENTER);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
gtk_widget_show (wid);
|
||||
|
||||
wid = gtk_combo_box_text_new ();
|
||||
@@ -1095,13 +997,8 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (wid), _("Pattern Match (Wildcards)"));
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (wid), _("Regular Expression"));
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (wid), serv->gui->chanlist_search_type);
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 1, 1, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_FILL, GTK_ALIGN_CENTER);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 1, 2, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
g_signal_connect (G_OBJECT (wid), "changed",
|
||||
G_CALLBACK (chanlist_combo_cb), serv);
|
||||
gtk_widget_show (wid);
|
||||
@@ -1110,13 +1007,8 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
|
||||
wid = gtk_label_new (_("Find:"));
|
||||
chanlist_set_label_alignment (wid);
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 0, 0, 1, 1, FALSE, FALSE,
|
||||
GTK_ALIGN_START, GTK_ALIGN_CENTER);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
gtk_widget_show (wid);
|
||||
|
||||
wid = gtk_entry_new ();
|
||||
@@ -1126,13 +1018,8 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
g_signal_connect (G_OBJECT (wid), "activate",
|
||||
G_CALLBACK (chanlist_search_pressed),
|
||||
(gpointer) serv);
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 1, 0, 1, 1, TRUE, FALSE,
|
||||
GTK_ALIGN_FILL, GTK_ALIGN_CENTER);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 1, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
||||
#endif
|
||||
gtk_widget_show (wid);
|
||||
serv->gui->chanlist_wild = wid;
|
||||
|
||||
@@ -1140,18 +1027,9 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
|
||||
/* ============================================================= */
|
||||
|
||||
#if HAVE_GTK3
|
||||
wid = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||
#else
|
||||
wid = gtk_vseparator_new ();
|
||||
#endif
|
||||
#if HAVE_GTK3
|
||||
chanlist_grid_attach (table, wid, 2, 0, 1, 5, FALSE, FALSE,
|
||||
GTK_ALIGN_FILL, GTK_ALIGN_FILL);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), wid, 2, 3, 0, 5,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
gtk_widget_show (wid);
|
||||
|
||||
g_signal_connect (G_OBJECT (serv->gui->chanlist_window), "destroy",
|
||||
|
||||
@@ -27,12 +27,7 @@ typedef struct
|
||||
GtkWidget *b2; /* button2 */
|
||||
} tabview;
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_CHANVIEW_CLOSE "window-close"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_CHANVIEW_CLOSE GTK_STOCK_CLOSE
|
||||
#endif
|
||||
|
||||
static void chanview_populate (chanview *cv);
|
||||
|
||||
@@ -57,17 +52,10 @@ cv_tabs_get_viewport_size (GdkWindow *parent_win, gboolean vertical)
|
||||
{
|
||||
gint viewport_size = 0;
|
||||
|
||||
#if HAVE_GTK3
|
||||
if (vertical)
|
||||
viewport_size = gdk_window_get_height (parent_win);
|
||||
else
|
||||
viewport_size = gdk_window_get_width (parent_win);
|
||||
#else
|
||||
if (vertical)
|
||||
gdk_window_get_geometry (parent_win, 0, 0, 0, &viewport_size, 0);
|
||||
else
|
||||
gdk_window_get_geometry (parent_win, 0, 0, &viewport_size, 0, 0);
|
||||
#endif
|
||||
|
||||
return viewport_size;
|
||||
}
|
||||
@@ -293,12 +281,9 @@ static GtkWidget *
|
||||
make_sbutton (GtkArrowType type, void *click_cb, void *userdata)
|
||||
{
|
||||
GtkWidget *button, *arrow;
|
||||
#if HAVE_GTK3
|
||||
const char *icon_name = "pan-end-symbolic";
|
||||
#endif
|
||||
|
||||
button = gtk_button_new ();
|
||||
#if HAVE_GTK3
|
||||
switch (type)
|
||||
{
|
||||
case GTK_ARROW_UP:
|
||||
@@ -317,9 +302,6 @@ make_sbutton (GtkArrowType type, void *click_cb, void *userdata)
|
||||
}
|
||||
|
||||
arrow = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
|
||||
#elif !HAVE_GTK3
|
||||
arrow = gtk_arrow_new (type, GTK_SHADOW_NONE);
|
||||
#endif
|
||||
gtk_container_add (GTK_CONTAINER (button), arrow);
|
||||
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
@@ -546,20 +528,12 @@ tab_add_real (chanview *cv, GtkWidget *tab, chan *ch)
|
||||
{
|
||||
/* vertical */
|
||||
box = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||
#if HAVE_GTK3
|
||||
sep = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
#elif !HAVE_GTK3
|
||||
sep = gtk_hseparator_new ();
|
||||
#endif
|
||||
} else
|
||||
{
|
||||
/* horiz */
|
||||
box = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
#if HAVE_GTK3
|
||||
sep = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||
#elif !HAVE_GTK3
|
||||
sep = gtk_vseparator_new ();
|
||||
#endif
|
||||
}
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (box), sep, 0, 0, 4);
|
||||
|
||||
@@ -137,21 +137,11 @@ cv_tree_init (chanview *cv)
|
||||
gtk_widget_set_vexpand (view, TRUE);
|
||||
gtk_widget_set_name (view, "zoitechat-tree");
|
||||
if (
|
||||
#if HAVE_GTK3
|
||||
cv->font_desc
|
||||
#else
|
||||
cv->style
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtkutil_apply_palette (view, &colors[COL_BG], &colors[COL_FG],
|
||||
cv->font_desc);
|
||||
#else
|
||||
gtkutil_apply_palette (view, &cv->style->base[GTK_STATE_NORMAL],
|
||||
&cv->style->text[GTK_STATE_NORMAL],
|
||||
cv->style->font_desc);
|
||||
#endif
|
||||
}
|
||||
/*gtk_widget_modify_base (view, GTK_STATE_NORMAL, &colors[COL_BG]);*/
|
||||
gtk_widget_set_can_focus (view, FALSE);
|
||||
|
||||
@@ -46,11 +46,7 @@ struct _chanview
|
||||
int size; /* number of channels in view */
|
||||
|
||||
GtkWidget *box; /* the box we destroy when changing implementations */
|
||||
#if HAVE_GTK3
|
||||
PangoFontDescription *font_desc; /* font used for tree */
|
||||
#else
|
||||
InputStyle *style; /* style used for tree */
|
||||
#endif
|
||||
chan *focused; /* currently focused channel */
|
||||
int trunc_len;
|
||||
|
||||
@@ -301,11 +297,7 @@ chanview_box_destroy_cb (GtkWidget *box, chanview *cv)
|
||||
|
||||
chanview *
|
||||
chanview_new (int type, int trunc_len, gboolean sort, gboolean use_icons,
|
||||
#if HAVE_GTK3
|
||||
PangoFontDescription *font_desc
|
||||
#else
|
||||
InputStyle *style
|
||||
#endif
|
||||
)
|
||||
{
|
||||
chanview *cv;
|
||||
@@ -313,16 +305,8 @@ chanview_new (int type, int trunc_len, gboolean sort, gboolean use_icons,
|
||||
cv = g_new0 (chanview, 1);
|
||||
cv->store = gtk_tree_store_new (5, G_TYPE_STRING, G_TYPE_POINTER,
|
||||
PANGO_TYPE_ATTR_LIST, GDK_TYPE_PIXBUF, G_TYPE_INT);
|
||||
#if HAVE_GTK3
|
||||
cv->font_desc = font_desc;
|
||||
#else
|
||||
cv->style = style;
|
||||
#endif
|
||||
#if HAVE_GTK3
|
||||
cv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
#elif !HAVE_GTK3
|
||||
cv->box = gtk_hbox_new (0, 0);
|
||||
#endif
|
||||
cv->trunc_len = trunc_len;
|
||||
cv->sorted = sort;
|
||||
cv->use_icons = use_icons;
|
||||
|
||||
@@ -26,11 +26,7 @@ typedef struct _chanview chanview;
|
||||
typedef struct _chan chan;
|
||||
|
||||
chanview *chanview_new (int type, int trunc_len, gboolean sort, gboolean use_icons,
|
||||
#if HAVE_GTK3
|
||||
PangoFontDescription *font_desc
|
||||
#else
|
||||
InputStyle *style
|
||||
#endif
|
||||
);
|
||||
void chanview_set_callbacks (chanview *cv,
|
||||
void (*cb_focus) (chanview *, chan *, int tag, void *userdata),
|
||||
|
||||
@@ -73,11 +73,7 @@ chanlistrow;
|
||||
* structure. */
|
||||
struct _CustomList
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GObject parent_instance;
|
||||
#else
|
||||
GObject parent;
|
||||
#endif
|
||||
|
||||
guint num_rows; /* number of rows that we have used */
|
||||
guint num_alloc; /* number of rows allocated */
|
||||
|
||||
@@ -37,18 +37,10 @@
|
||||
#include "palette.h"
|
||||
#include "maingui.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_DCC_CANCEL "dialog-cancel"
|
||||
#define ICON_DCC_ACCEPT "dialog-apply"
|
||||
#define ICON_DCC_RESUME "view-refresh"
|
||||
#define ICON_DCC_CLEAR "edit-clear"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_DCC_CANCEL GTK_STOCK_CANCEL
|
||||
#define ICON_DCC_ACCEPT GTK_STOCK_APPLY
|
||||
#define ICON_DCC_RESUME GTK_STOCK_REFRESH
|
||||
#define ICON_DCC_CLEAR GTK_STOCK_CLEAR
|
||||
#endif
|
||||
|
||||
|
||||
enum /* DCC SEND/RECV */
|
||||
@@ -116,7 +108,6 @@ static short view_mode; /* 1=download 2=upload 3=both */
|
||||
#define VIEW_UPLOAD 2
|
||||
#define VIEW_BOTH 3
|
||||
|
||||
#if HAVE_GTK3
|
||||
static GdkPixbuf *
|
||||
dcc_load_icon (const char *stock_name)
|
||||
{
|
||||
@@ -134,7 +125,6 @@ dcc_load_icon (const char *stock_name)
|
||||
|
||||
return gtk_icon_theme_load_icon (theme, icon_name, width, 0, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
@@ -192,7 +182,6 @@ dcc_store_color (GtkListStore *store, GtkTreeIter *iter, int column, int color_i
|
||||
if (color_index != 1)
|
||||
color = &colors[color_index];
|
||||
|
||||
#if HAVE_GTK3
|
||||
if (color)
|
||||
{
|
||||
GdkRGBA rgba = *color;
|
||||
@@ -202,9 +191,6 @@ dcc_store_color (GtkListStore *store, GtkTreeIter *iter, int column, int color_i
|
||||
{
|
||||
gtk_list_store_set (store, iter, column, NULL, -1);
|
||||
}
|
||||
#else
|
||||
gtk_list_store_set (store, iter, column, color, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -240,12 +226,7 @@ dcc_prepare_row_send (struct DCC *dcc, GtkListStore *store, GtkTreeIter *iter,
|
||||
float per;
|
||||
|
||||
if (!pix_up)
|
||||
#if HAVE_GTK3
|
||||
pix_up = dcc_load_icon ("gtk-go-up");
|
||||
#elif !HAVE_GTK3
|
||||
pix_up = gtk_widget_render_icon (dccfwin.window, "gtk-go-up",
|
||||
GTK_ICON_SIZE_MENU, NULL);
|
||||
#endif
|
||||
|
||||
/* percentage ack'ed */
|
||||
per = (float) ((dcc->ack * 100.00) / dcc->size);
|
||||
@@ -294,12 +275,7 @@ dcc_prepare_row_recv (struct DCC *dcc, GtkListStore *store, GtkTreeIter *iter,
|
||||
int to_go;
|
||||
|
||||
if (!pix_dn)
|
||||
#if HAVE_GTK3
|
||||
pix_dn = dcc_load_icon ("gtk-go-down");
|
||||
#elif !HAVE_GTK3
|
||||
pix_dn = gtk_widget_render_icon (dccfwin.window, "gtk-go-down",
|
||||
GTK_ICON_SIZE_MENU, NULL);
|
||||
#endif
|
||||
|
||||
proper_unit (dcc->size, size, sizeof (size));
|
||||
if (dcc->dccstat == STAT_QUEUED)
|
||||
@@ -791,31 +767,19 @@ dcc_detail_label (char *text, GtkWidget *box, int num)
|
||||
label = gtk_label_new (NULL);
|
||||
g_snprintf (buf, sizeof (buf), "<b>%s</b>", text);
|
||||
gtk_label_set_markup (GTK_LABEL (label), buf);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (label, FALSE);
|
||||
gtk_widget_set_vexpand (label, FALSE);
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_START);
|
||||
gtk_grid_attach (GTK_GRID (box), label, 0, 0 + num, 1, 1);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
|
||||
gtk_table_attach (GTK_TABLE (box), label, 0, 1, 0 + num, 1 + num,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (label, FALSE);
|
||||
gtk_widget_set_vexpand (label, FALSE);
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_START);
|
||||
gtk_grid_attach (GTK_GRID (box), label, 1, 0 + num, 1, 1);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
|
||||
gtk_table_attach (GTK_TABLE (box), label, 1, 2, 0 + num, 1 + num,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
|
||||
return label;
|
||||
}
|
||||
@@ -914,100 +878,63 @@ fe_dcc_open_recv_win (int passive)
|
||||
g_signal_connect (G_OBJECT (view), "row-activated",
|
||||
G_CALLBACK (dcc_dclick_cb), NULL);
|
||||
|
||||
#if HAVE_GTK3
|
||||
table = gtk_grid_new ();
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table), 16);
|
||||
#else
|
||||
table = gtk_table_new (1, 3, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 16);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, 0, 0, 0);
|
||||
|
||||
radio = gtk_radio_button_new_with_mnemonic (NULL, _("Both"));
|
||||
g_signal_connect (G_OBJECT (radio), "toggled",
|
||||
G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_BOTH));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (radio, FALSE);
|
||||
gtk_widget_set_vexpand (radio, FALSE);
|
||||
gtk_widget_set_halign (radio, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (radio, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (table), radio, 3, 0, 1, 1);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), radio, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
|
||||
|
||||
radio = gtk_radio_button_new_with_mnemonic (group, _("Uploads"));
|
||||
g_signal_connect (G_OBJECT (radio), "toggled",
|
||||
G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_UPLOAD));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (radio, FALSE);
|
||||
gtk_widget_set_vexpand (radio, FALSE);
|
||||
gtk_widget_set_halign (radio, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (radio, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (table), radio, 1, 0, 1, 1);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), radio, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
|
||||
|
||||
radio = gtk_radio_button_new_with_mnemonic (group, _("Downloads"));
|
||||
g_signal_connect (G_OBJECT (radio), "toggled",
|
||||
G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_DOWNLOAD));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (radio, FALSE);
|
||||
gtk_widget_set_vexpand (radio, FALSE);
|
||||
gtk_widget_set_halign (radio, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (radio, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (table), radio, 2, 0, 1, 1);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), radio, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
|
||||
exp = gtk_expander_new (_("Details"));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (exp, TRUE);
|
||||
gtk_widget_set_vexpand (exp, FALSE);
|
||||
gtk_widget_set_halign (exp, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (exp, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (table), exp, 0, 0, 1, 1);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), exp, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
detailbox = gtk_grid_new ();
|
||||
gtk_grid_set_column_spacing (GTK_GRID (detailbox), 6);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (detailbox), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (detailbox), 6);
|
||||
#else
|
||||
detailbox = gtk_table_new (3, 3, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (detailbox), 6);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (detailbox), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (detailbox), 6);
|
||||
#endif
|
||||
g_signal_connect (G_OBJECT (exp), "activate",
|
||||
G_CALLBACK (dcc_exp_cb), detailbox);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (detailbox, TRUE);
|
||||
gtk_widget_set_vexpand (detailbox, FALSE);
|
||||
gtk_widget_set_halign (detailbox, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (detailbox, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (table), detailbox, 0, 1, 4, 1);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), detailbox, 0, 4, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
|
||||
dccfwin.file_label = dcc_detail_label (_("File:"), detailbox, 0);
|
||||
dccfwin.address_label = dcc_detail_label (_("Address:"), detailbox, 1);
|
||||
|
||||
#if HAVE_GTK3
|
||||
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 2);
|
||||
|
||||
dccfwin.abort_button = gtkutil_button (bbox, ICON_DCC_CANCEL, 0, abort_clicked, 0, _("Abort"));
|
||||
@@ -1209,13 +1136,8 @@ fe_dcc_open_chat_win (int passive)
|
||||
g_signal_connect (G_OBJECT (view), "row-activated",
|
||||
G_CALLBACK (dcc_chat_dclick_cb), NULL);
|
||||
|
||||
#if HAVE_GTK3
|
||||
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 2);
|
||||
|
||||
dcccwin.abort_button = gtkutil_button (bbox, ICON_DCC_CANCEL, 0, abort_chat_clicked, 0, _("Abort"));
|
||||
|
||||
@@ -42,18 +42,10 @@
|
||||
#include "maingui.h"
|
||||
#include "editlist.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_EDITLIST_NEW "document-new"
|
||||
#define ICON_EDITLIST_DELETE "edit-delete"
|
||||
#define ICON_EDITLIST_CANCEL "dialog-cancel"
|
||||
#define ICON_EDITLIST_SAVE "document-save"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_EDITLIST_NEW GTK_STOCK_NEW
|
||||
#define ICON_EDITLIST_DELETE GTK_STOCK_DELETE
|
||||
#define ICON_EDITLIST_CANCEL GTK_STOCK_CANCEL
|
||||
#define ICON_EDITLIST_SAVE GTK_STOCK_SAVE
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -361,13 +353,8 @@ editlist_gui_open (char *title1, char *title2, GSList *list, char *title, char *
|
||||
if (help)
|
||||
gtk_widget_set_tooltip_text (view, help);
|
||||
|
||||
#if HAVE_GTK3
|
||||
box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
box = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
|
||||
gtk_widget_show (box);
|
||||
|
||||
@@ -589,7 +589,6 @@ fe_apply_windows_theme (gboolean dark)
|
||||
g_object_set (settings, "gtk-application-prefer-dark-theme", dark, NULL);
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
static GtkCssProvider *win_theme_provider = NULL;
|
||||
GdkScreen *screen = gdk_screen_get_default ();
|
||||
@@ -613,7 +612,6 @@ fe_apply_windows_theme (gboolean dark)
|
||||
GTK_STYLE_PROVIDER (win_theme_provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -675,7 +673,7 @@ fe_apply_theme_to_toplevel (GtkWidget *window)
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
#if defined(G_OS_WIN32) && HAVE_GTK3
|
||||
#ifdef G_OS_WIN32
|
||||
{
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (window);
|
||||
gboolean dark = fe_dark_mode_is_enabled ();
|
||||
@@ -718,7 +716,6 @@ create_input_style (InputStyle *style)
|
||||
{
|
||||
char buf[256];
|
||||
static int done_rc = FALSE;
|
||||
#if HAVE_GTK3
|
||||
static GtkCssProvider *input_css_provider = NULL;
|
||||
static char *last_theme_name = NULL;
|
||||
static gboolean last_dark_mode = FALSE;
|
||||
@@ -730,12 +727,9 @@ create_input_style (InputStyle *style)
|
||||
static guint16 last_bg_red;
|
||||
static guint16 last_bg_green;
|
||||
static guint16 last_bg_blue;
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
if (!style)
|
||||
style = g_new0 (InputStyle, 1);
|
||||
#endif
|
||||
|
||||
if (style->font_desc)
|
||||
pango_font_description_free (style->font_desc);
|
||||
@@ -752,31 +746,6 @@ create_input_style (InputStyle *style)
|
||||
|
||||
if (prefs.hex_gui_input_style)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
if (!done_rc)
|
||||
{
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
char *theme_name;
|
||||
|
||||
/* gnome-themes-standard 3.20+ relies on images to do theming
|
||||
* so we have to override that. */
|
||||
g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
|
||||
if (g_str_has_prefix (theme_name, "Adwaita") || g_str_has_prefix (theme_name, "Yaru"))
|
||||
gtk_rc_parse_string (adwaita_workaround_rc);
|
||||
g_free (theme_name);
|
||||
|
||||
{
|
||||
guint16 red;
|
||||
guint16 green;
|
||||
guint16 blue;
|
||||
|
||||
palette_color_get_rgb16 (&colors[COL_FG], &red, &green, &blue);
|
||||
sprintf (buf, cursor_color_rc, (red >> 8), (green >> 8), (blue >> 8));
|
||||
}
|
||||
gtk_rc_parse_string (buf);
|
||||
done_rc = TRUE;
|
||||
}
|
||||
#else
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
GdkScreen *screen = gdk_screen_get_default ();
|
||||
char *theme_name;
|
||||
@@ -877,9 +846,7 @@ create_input_style (InputStyle *style)
|
||||
}
|
||||
|
||||
g_free (theme_name);
|
||||
#endif
|
||||
}
|
||||
#if HAVE_GTK3
|
||||
else
|
||||
{
|
||||
GdkScreen *screen = gdk_screen_get_default ();
|
||||
@@ -896,13 +863,7 @@ create_input_style (InputStyle *style)
|
||||
last_input_style = FALSE;
|
||||
last_colors_set = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_GTK3
|
||||
style->bg[GTK_STATE_NORMAL] = colors[COL_FG];
|
||||
style->base[GTK_STATE_NORMAL] = colors[COL_BG];
|
||||
style->text[GTK_STATE_NORMAL] = colors[COL_FG];
|
||||
#endif
|
||||
|
||||
return style;
|
||||
}
|
||||
@@ -925,11 +886,7 @@ fe_init (void)
|
||||
gtkosx_application_set_dock_icon_pixbuf (osx_app, pix_zoitechat);
|
||||
#endif
|
||||
channelwin_pix = pixmap_load_from_file (prefs.hex_text_background);
|
||||
#if HAVE_GTK3
|
||||
input_style = create_input_style (input_style);
|
||||
#else
|
||||
input_style = create_input_style (gtk_style_new ());
|
||||
#endif
|
||||
|
||||
if (settings)
|
||||
{
|
||||
|
||||
@@ -32,22 +32,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <cairo.h>
|
||||
|
||||
#ifndef HAVE_GTK3
|
||||
#if GTK_MAJOR_VERSION >= 3
|
||||
#define HAVE_GTK3 1
|
||||
#else
|
||||
#define HAVE_GTK3 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !HAVE_GTK3
|
||||
/* GtkWidget expansion APIs were introduced in GTK3. Keep GTK2 builds
|
||||
* source-compatible by accepting the calls as no-ops.
|
||||
*/
|
||||
#define gtk_widget_set_hexpand(widget, expand) G_STMT_START { (void) (widget); (void) (expand); } G_STMT_END
|
||||
#define gtk_widget_set_vexpand(widget, expand) G_STMT_START { (void) (widget); (void) (expand); } G_STMT_END
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GTK_MAC
|
||||
#include <gtkosxapplication.h>
|
||||
#endif
|
||||
@@ -64,14 +48,10 @@
|
||||
#define flag_b flag_wid[7]
|
||||
#define NUM_FLAG_WIDS 8
|
||||
|
||||
#if HAVE_GTK3
|
||||
typedef struct _input_style
|
||||
{
|
||||
PangoFontDescription *font_desc;
|
||||
} InputStyle;
|
||||
#else
|
||||
typedef GtkStyle InputStyle;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GTK_MAC
|
||||
extern GtkosxApplication *osx_app;
|
||||
|
||||
@@ -53,18 +53,10 @@
|
||||
#include "textgui.h"
|
||||
#include "fkeys.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_FKEYS_NEW "document-new"
|
||||
#define ICON_FKEYS_DELETE "edit-delete"
|
||||
#define ICON_FKEYS_CANCEL "dialog-cancel"
|
||||
#define ICON_FKEYS_SAVE "document-save"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_FKEYS_NEW GTK_STOCK_NEW
|
||||
#define ICON_FKEYS_DELETE GTK_STOCK_DELETE
|
||||
#define ICON_FKEYS_CANCEL GTK_STOCK_CANCEL
|
||||
#define ICON_FKEYS_SAVE GTK_STOCK_SAVE
|
||||
#endif
|
||||
|
||||
static void replace_handle (GtkWidget * wid);
|
||||
void key_check_replace_on_change (GtkEditable *editable, gpointer data);
|
||||
@@ -753,7 +745,6 @@ key_dialog_treeview_new (GtkWidget *box)
|
||||
g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW(view))),
|
||||
"changed", G_CALLBACK (key_dialog_selection_changed), NULL);
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_name (view, "fkeys-treeview");
|
||||
{
|
||||
GtkCssProvider *provider = gtk_css_provider_new ();
|
||||
@@ -773,10 +764,6 @@ key_dialog_treeview_new (GtkWidget *box)
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
|
||||
#endif
|
||||
|
||||
render = gtk_cell_renderer_accel_new ();
|
||||
g_object_set (render, "editable", TRUE,
|
||||
@@ -925,13 +912,8 @@ key_dialog_show ()
|
||||
g_object_set_data (G_OBJECT (key_dialog), "view", view);
|
||||
g_object_set_data (G_OBJECT (key_dialog), "xtext", xtext);
|
||||
|
||||
#if HAVE_GTK3
|
||||
box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
box = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@ struct file_req
|
||||
int flags; /* FRF_* flags */
|
||||
};
|
||||
|
||||
#if HAVE_GTK3
|
||||
static const char *
|
||||
gtkutil_menu_custom_icon_from_stock (const char *stock_name)
|
||||
{
|
||||
@@ -162,60 +161,7 @@ gtkutil_menu_custom_icon_from_icon_name (const char *icon_name)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_GTK3
|
||||
static const char *
|
||||
gtkutil_stock_from_menu_custom_icon (const char *custom_icon)
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
const char *custom_icon;
|
||||
const char *stock;
|
||||
} icon_map[] = {
|
||||
{ "zc-menu-new", GTK_STOCK_NEW },
|
||||
{ "zc-menu-network-list", GTK_STOCK_INDEX },
|
||||
{ "zc-menu-load-plugin", GTK_STOCK_REVERT_TO_SAVED },
|
||||
{ "zc-menu-detach", GTK_STOCK_REDO },
|
||||
{ "zc-menu-close", GTK_STOCK_CLOSE },
|
||||
{ "zc-menu-quit", GTK_STOCK_QUIT },
|
||||
{ "zc-menu-disconnect", GTK_STOCK_DISCONNECT },
|
||||
{ "zc-menu-connect", GTK_STOCK_CONNECT },
|
||||
{ "zc-menu-join", GTK_STOCK_JUMP_TO },
|
||||
{ "zc-menu-chanlist", GTK_STOCK_INDEX },
|
||||
{ "zc-menu-preferences", GTK_STOCK_PREFERENCES },
|
||||
{ "zc-menu-clear", GTK_STOCK_CLEAR },
|
||||
{ "zc-menu-copy", GTK_STOCK_COPY },
|
||||
{ "zc-menu-delete", GTK_STOCK_DELETE },
|
||||
{ "zc-menu-add", GTK_STOCK_ADD },
|
||||
{ "zc-menu-remove", GTK_STOCK_REMOVE },
|
||||
{ "zc-menu-spell-check", GTK_STOCK_SPELL_CHECK },
|
||||
{ "zc-menu-save", GTK_STOCK_SAVE },
|
||||
{ "zc-menu-save-as", GTK_STOCK_SAVE_AS },
|
||||
{ "zc-menu-refresh", GTK_STOCK_REFRESH },
|
||||
{ "zc-menu-search", GTK_STOCK_JUSTIFY_LEFT },
|
||||
{ "zc-menu-find", GTK_STOCK_FIND },
|
||||
{ "zc-menu-previous", GTK_STOCK_GO_BACK },
|
||||
{ "zc-menu-next", GTK_STOCK_GO_FORWARD },
|
||||
{ "zc-menu-help", GTK_STOCK_HELP },
|
||||
{ "zc-menu-about", GTK_STOCK_ABOUT },
|
||||
{ "zc-menu-emoji", GTK_STOCK_CONVERT },
|
||||
{ "zc-menu-update", GTK_STOCK_REFRESH },
|
||||
};
|
||||
size_t i;
|
||||
|
||||
if (!custom_icon)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (icon_map); i++)
|
||||
{
|
||||
if (strcmp (custom_icon, icon_map[i].custom_icon) == 0)
|
||||
return icon_map[i].stock;
|
||||
}
|
||||
|
||||
return custom_icon;
|
||||
}
|
||||
#endif
|
||||
|
||||
static GdkPixbuf *
|
||||
gtkutil_menu_icon_pixbuf_new (const char *icon_name)
|
||||
@@ -239,7 +185,6 @@ gtkutil_menu_icon_pixbuf_new (const char *icon_name)
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
const char *
|
||||
gtkutil_icon_name_from_stock (const char *stock_name)
|
||||
{
|
||||
@@ -296,9 +241,7 @@ gtkutil_icon_name_from_stock (const char *stock_name)
|
||||
|
||||
return stock_name;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
static const char *
|
||||
gtkutil_menu_icon_theme_variant (void)
|
||||
{
|
||||
@@ -378,12 +321,10 @@ gtkutil_menu_icon_image_new (const char *icon_name, GtkIconSize size)
|
||||
|
||||
return image;
|
||||
}
|
||||
#endif
|
||||
|
||||
GtkWidget *
|
||||
gtkutil_image_new_from_stock (const char *stock, GtkIconSize size)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *image;
|
||||
const char *icon_name;
|
||||
|
||||
@@ -406,29 +347,11 @@ gtkutil_image_new_from_stock (const char *stock, GtkIconSize size)
|
||||
return image;
|
||||
|
||||
return gtk_image_new_from_icon_name (icon_name, size);
|
||||
#elif !HAVE_GTK3
|
||||
if (stock && g_str_has_prefix (stock, "zc-menu-"))
|
||||
{
|
||||
GdkPixbuf *pixbuf = gtkutil_menu_icon_pixbuf_new (stock);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
||||
if (stock && g_str_has_prefix (stock, "zc-menu-"))
|
||||
stock = gtkutil_stock_from_menu_custom_icon (stock);
|
||||
return gtk_image_new_from_stock (stock, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtkutil_button_new_from_stock (const char *stock, const char *label)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *button = label ? gtk_button_new_with_mnemonic (label) : gtk_button_new ();
|
||||
|
||||
if (stock)
|
||||
@@ -443,16 +366,8 @@ gtkutil_button_new_from_stock (const char *stock, const char *label)
|
||||
}
|
||||
|
||||
return button;
|
||||
#elif !HAVE_GTK3
|
||||
if (stock)
|
||||
return gtk_button_new_from_stock (stock);
|
||||
if (label)
|
||||
return gtk_button_new_with_mnemonic (label);
|
||||
return gtk_button_new ();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
void
|
||||
gtkutil_append_font_css (GString *css, const PangoFontDescription *font_desc)
|
||||
{
|
||||
@@ -568,16 +483,10 @@ gtkutil_append_font_css (GString *css, const PangoFontDescription *font_desc)
|
||||
void
|
||||
gtkutil_apply_palette (GtkWidget *widget, const GdkRGBA *bg, const GdkRGBA *fg,
|
||||
const PangoFontDescription *font_desc)
|
||||
#else
|
||||
void
|
||||
gtkutil_apply_palette (GtkWidget *widget, const GdkColor *bg, const GdkColor *fg,
|
||||
const PangoFontDescription *font_desc)
|
||||
#endif
|
||||
{
|
||||
if (!widget)
|
||||
return;
|
||||
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
static const char *class_name = "zoitechat-palette";
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
@@ -635,11 +544,6 @@ gtkutil_apply_palette (GtkWidget *widget, const GdkColor *bg, const GdkColor *fg
|
||||
g_free (bg_color);
|
||||
g_free (fg_color);
|
||||
}
|
||||
#else
|
||||
gtk_widget_modify_base (widget, GTK_STATE_NORMAL, bg);
|
||||
gtk_widget_modify_text (widget, GTK_STATE_NORMAL, fg);
|
||||
gtk_widget_modify_font (widget, (PangoFontDescription *) font_desc);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -782,7 +686,7 @@ gtkutil_file_req_response (GtkWidget *dialog, gint res, struct file_req *freq)
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
#if defined (WIN32) && HAVE_GTK3
|
||||
#ifdef WIN32
|
||||
static gboolean
|
||||
gtkutil_native_dialog_unref_idle (gpointer native)
|
||||
{
|
||||
@@ -826,7 +730,7 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
|
||||
|
||||
xdir = get_xdir ();
|
||||
|
||||
#if defined (WIN32) && HAVE_GTK3
|
||||
#ifdef WIN32
|
||||
{
|
||||
GtkFileChooserNative *native = gtk_file_chooser_native_new (
|
||||
title,
|
||||
@@ -902,37 +806,21 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
|
||||
|
||||
if (flags & FRF_WRITE)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
dialog = gtk_file_chooser_dialog_new (title, NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||
_("_Save"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#elif !HAVE_GTK3
|
||||
dialog = gtk_file_chooser_dialog_new (title, NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
if (!(flags & FRF_NOASKOVERWRITE))
|
||||
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
|
||||
}
|
||||
else
|
||||
#if HAVE_GTK3
|
||||
dialog = gtk_file_chooser_dialog_new (title, NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||
_("_Open"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#elif !HAVE_GTK3
|
||||
dialog = gtk_file_chooser_dialog_new (title, NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
if (filter && filter[0] && (flags & FRF_FILTERISINITIAL))
|
||||
{
|
||||
@@ -1088,17 +976,10 @@ fe_get_str (char *msg, char *def, void *callback, void *userdata)
|
||||
GtkWidget *label;
|
||||
extern GtkWidget *parent_window;
|
||||
|
||||
#if HAVE_GTK3
|
||||
dialog = gtk_dialog_new_with_buttons (msg, NULL, 0,
|
||||
_("_Cancel"), GTK_RESPONSE_REJECT,
|
||||
_("_OK"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#elif !HAVE_GTK3
|
||||
dialog = gtk_dialog_new_with_buttons (msg, NULL, 0,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
|
||||
gtk_box_set_homogeneous (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), TRUE);
|
||||
@@ -1190,17 +1071,10 @@ fe_get_int (char *msg, int def, void *callback, void *userdata)
|
||||
GtkAdjustment *adj;
|
||||
extern GtkWidget *parent_window;
|
||||
|
||||
#if HAVE_GTK3
|
||||
dialog = gtk_dialog_new_with_buttons (msg, NULL, 0,
|
||||
_("_Cancel"), GTK_RESPONSE_REJECT,
|
||||
_("_OK"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#elif !HAVE_GTK3
|
||||
dialog = gtk_dialog_new_with_buttons (msg, NULL, 0,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#endif
|
||||
gtk_box_set_homogeneous (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), TRUE);
|
||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
|
||||
@@ -1237,17 +1111,10 @@ fe_get_bool (char *title, char *prompt, void *callback, void *userdata)
|
||||
GtkWidget *prompt_label;
|
||||
extern GtkWidget *parent_window;
|
||||
|
||||
#if HAVE_GTK3
|
||||
dialog = gtk_dialog_new_with_buttons (title, NULL, 0,
|
||||
_("_No"), GTK_RESPONSE_REJECT,
|
||||
_("_Yes"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#elif !HAVE_GTK3
|
||||
dialog = gtk_dialog_new_with_buttons (title, NULL, 0,
|
||||
GTK_STOCK_NO, GTK_RESPONSE_REJECT,
|
||||
GTK_STOCK_YES, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#endif
|
||||
gtk_box_set_homogeneous (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), TRUE);
|
||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
|
||||
@@ -1278,20 +1145,12 @@ gtkutil_button (GtkWidget *box, char *stock, char *tip, void *callback,
|
||||
{
|
||||
gtk_button_set_label (GTK_BUTTON (wid), labeltext);
|
||||
img = NULL;
|
||||
#if HAVE_GTK3
|
||||
if (stock)
|
||||
img = gtkutil_image_new_from_stock (stock, GTK_ICON_SIZE_BUTTON);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
if (stock)
|
||||
img = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_BUTTON);
|
||||
#endif
|
||||
if (img)
|
||||
{
|
||||
gtk_button_set_image (GTK_BUTTON (wid), img);
|
||||
#if HAVE_GTK3
|
||||
gtk_button_set_always_show_image (GTK_BUTTON (wid), TRUE);
|
||||
#endif
|
||||
}
|
||||
gtk_button_set_use_underline (GTK_BUTTON (wid), TRUE);
|
||||
if (box)
|
||||
@@ -1304,21 +1163,13 @@ gtkutil_button (GtkWidget *box, char *stock, char *tip, void *callback,
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
img = NULL;
|
||||
#if HAVE_GTK3
|
||||
if (stock)
|
||||
img = gtkutil_image_new_from_stock (stock, GTK_ICON_SIZE_BUTTON);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
if (stock)
|
||||
img = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_BUTTON);
|
||||
#endif
|
||||
if (img)
|
||||
{
|
||||
gtk_container_add (GTK_CONTAINER (bbox), img);
|
||||
gtk_widget_show (img);
|
||||
#if HAVE_GTK3
|
||||
gtk_button_set_always_show_image (GTK_BUTTON (wid), TRUE);
|
||||
#endif
|
||||
}
|
||||
gtk_box_pack_start (GTK_BOX (box), wid, 0, 0, 0);
|
||||
}
|
||||
@@ -1545,10 +1396,8 @@ gtkutil_tray_icon_supported (GtkWindow *window)
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
GdkScreen *screen = gtk_window_get_screen (window);
|
||||
GdkDisplay *display = gdk_screen_get_display (screen);
|
||||
#if HAVE_GTK3
|
||||
if (!GDK_IS_X11_DISPLAY (display))
|
||||
return FALSE;
|
||||
#endif
|
||||
int screen_number = gdk_screen_get_number (screen);
|
||||
Display *xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
char *selection_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d", screen_number);
|
||||
@@ -1603,34 +1452,22 @@ gtkutil_find_font (const char *fontname)
|
||||
GtkWidget *
|
||||
gtkutil_box_new (GtkOrientation orientation, gboolean homogeneous, gint spacing)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *box = gtk_box_new (orientation, spacing);
|
||||
|
||||
gtk_box_set_homogeneous (GTK_BOX (box), homogeneous);
|
||||
return box;
|
||||
#elif !HAVE_GTK3
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
return gtk_hbox_new (homogeneous, spacing);
|
||||
|
||||
return gtk_vbox_new (homogeneous, spacing);
|
||||
#endif
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtkutil_grid_new (guint rows, guint columns, gboolean homogeneous)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *grid = gtk_grid_new ();
|
||||
|
||||
gtk_grid_set_row_homogeneous (GTK_GRID (grid), homogeneous);
|
||||
gtk_grid_set_column_homogeneous (GTK_GRID (grid), homogeneous);
|
||||
return grid;
|
||||
#elif !HAVE_GTK3
|
||||
return gtk_table_new (rows, columns, homogeneous);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
static GtkAlign
|
||||
gtkutil_align_from_options (GtkutilAttachOptions options, GtkAlign default_align)
|
||||
{
|
||||
@@ -1639,7 +1476,6 @@ gtkutil_align_from_options (GtkutilAttachOptions options, GtkAlign default_align
|
||||
|
||||
return default_align;
|
||||
}
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
gtkutil_expansion_from_options (GtkutilAttachOptions options, gboolean default_expand)
|
||||
@@ -1657,7 +1493,6 @@ gtkutil_grid_attach (GtkWidget *table, GtkWidget *child,
|
||||
GtkutilAttachOptions xoptions, GtkutilAttachOptions yoptions,
|
||||
guint xpad, guint ypad)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (child, gtkutil_expansion_from_options (xoptions, FALSE));
|
||||
gtk_widget_set_vexpand (child, gtkutil_expansion_from_options (yoptions, FALSE));
|
||||
gtk_widget_set_halign (child, gtkutil_align_from_options (xoptions, GTK_ALIGN_CENTER));
|
||||
@@ -1668,10 +1503,6 @@ gtkutil_grid_attach (GtkWidget *table, GtkWidget *child,
|
||||
gtk_widget_set_margin_bottom (child, ypad);
|
||||
gtk_grid_attach (GTK_GRID (table), child, left_attach, top_attach,
|
||||
right_attach - left_attach, bottom_attach - top_attach);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_table_attach (GTK_TABLE (table), child, left_attach, right_attach,
|
||||
top_attach, bottom_attach, xoptions, yoptions, xpad, ypad);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1679,15 +1510,10 @@ gtkutil_grid_attach_defaults (GtkWidget *table, GtkWidget *child,
|
||||
guint left_attach, guint right_attach,
|
||||
guint top_attach, guint bottom_attach)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (child, TRUE);
|
||||
gtk_widget_set_vexpand (child, TRUE);
|
||||
gtk_widget_set_halign (child, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (child, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (table), child, left_attach, top_attach,
|
||||
right_attach - left_attach, bottom_attach - top_attach);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), child, left_attach, right_attach,
|
||||
top_attach, bottom_attach);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -26,27 +26,13 @@
|
||||
|
||||
typedef void (*filereqcallback) (void *, char *file);
|
||||
|
||||
#ifndef HAVE_GTK3
|
||||
#if GTK_MAJOR_VERSION >= 3
|
||||
#define HAVE_GTK3 1
|
||||
#else
|
||||
#define HAVE_GTK3 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
typedef enum
|
||||
{
|
||||
GTKUTIL_ATTACH_EXPAND = 1 << 0,
|
||||
GTKUTIL_ATTACH_SHRINK = 1 << 1,
|
||||
GTKUTIL_ATTACH_FILL = 1 << 2
|
||||
} GtkutilAttachOptions;
|
||||
#else
|
||||
typedef GtkAttachOptions GtkutilAttachOptions;
|
||||
#define GTKUTIL_ATTACH_EXPAND GTK_EXPAND
|
||||
#define GTKUTIL_ATTACH_SHRINK GTK_SHRINK
|
||||
#define GTKUTIL_ATTACH_FILL GTK_FILL
|
||||
#endif
|
||||
|
||||
void gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *userdata, char *filter, char *extensions, int flags);
|
||||
void gtkutil_destroy (GtkWidget * igad, GtkWidget * dgad);
|
||||
@@ -55,9 +41,7 @@ GtkWidget *gtkutil_button (GtkWidget *box, char *stock, char *tip, void *callbac
|
||||
void *userdata, char *labeltext);
|
||||
GtkWidget *gtkutil_image_new_from_stock (const char *stock, GtkIconSize size);
|
||||
GtkWidget *gtkutil_button_new_from_stock (const char *stock, const char *label);
|
||||
#if HAVE_GTK3
|
||||
const char *gtkutil_icon_name_from_stock (const char *stock_name);
|
||||
#endif
|
||||
void gtkutil_label_new (char *text, GtkWidget * box);
|
||||
GtkWidget *gtkutil_entry_new (int max, GtkWidget * box, void *callback,
|
||||
gpointer userdata);
|
||||
@@ -82,14 +66,9 @@ void gtkutil_grid_attach (GtkWidget *table, GtkWidget *child,
|
||||
void gtkutil_grid_attach_defaults (GtkWidget *table, GtkWidget *child,
|
||||
guint left_attach, guint right_attach,
|
||||
guint top_attach, guint bottom_attach);
|
||||
#if HAVE_GTK3
|
||||
void gtkutil_apply_palette (GtkWidget *widget, const GdkRGBA *bg, const GdkRGBA *fg,
|
||||
const PangoFontDescription *font_desc);
|
||||
void gtkutil_append_font_css (GString *css, const PangoFontDescription *font_desc);
|
||||
#else
|
||||
void gtkutil_apply_palette (GtkWidget *widget, const GdkColor *bg, const GdkColor *fg,
|
||||
const PangoFontDescription *font_desc);
|
||||
#endif
|
||||
|
||||
#if defined (WIN32) || defined (__APPLE__)
|
||||
gboolean gtkutil_find_font (const char *fontname);
|
||||
|
||||
@@ -31,16 +31,9 @@
|
||||
#include "gtkutil.h"
|
||||
#include "maingui.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_IGNORE_NEW "document-new"
|
||||
#define ICON_IGNORE_DELETE "edit-delete"
|
||||
#define ICON_IGNORE_CLEAR "edit-clear"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_IGNORE_NEW GTK_STOCK_NEW
|
||||
#define ICON_IGNORE_DELETE GTK_STOCK_DELETE
|
||||
#define ICON_IGNORE_CLEAR GTK_STOCK_CLEAR
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -371,11 +364,7 @@ ignore_gui_open ()
|
||||
frame = gtk_frame_new (_("Ignore Stats:"));
|
||||
gtk_widget_show (frame);
|
||||
|
||||
#if HAVE_GTK3
|
||||
stat_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
||||
#elif !HAVE_GTK3
|
||||
stat_box = gtk_hbox_new (0, 2);
|
||||
#endif
|
||||
gtk_container_set_border_width (GTK_CONTAINER (stat_box), 6);
|
||||
gtk_container_add (GTK_CONTAINER (frame), stat_box);
|
||||
gtk_widget_show (stat_box);
|
||||
@@ -388,13 +377,8 @@ ignore_gui_open ()
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, 0, 0, 5);
|
||||
|
||||
#if HAVE_GTK3
|
||||
box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
box = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
|
||||
gtk_widget_show (box);
|
||||
|
||||
@@ -40,12 +40,7 @@
|
||||
#include "chanlist.h"
|
||||
#include "gtkutil.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_JOIND_NETWORK "network-workgroup"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_JOIND_NETWORK GTK_STOCK_NETWORK
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
@@ -159,13 +154,9 @@ joind_show_dialog (server *serv)
|
||||
image1 = gtkutil_image_new_from_stock (ICON_JOIND_NETWORK, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
gtk_widget_show (image1);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, TRUE, 24);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (image1, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (image1, GTK_ALIGN_START);
|
||||
gtk_widget_set_margin_top (image1, 2);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (image1), 0.5f, 0.06f);
|
||||
#endif
|
||||
|
||||
vbox2 = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 6);
|
||||
@@ -179,33 +170,21 @@ joind_show_dialog (server *serv)
|
||||
gtk_widget_show (label);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
#endif
|
||||
|
||||
label = gtk_label_new (_("In the server list window, no channel (chat room) has been entered to be automatically joined for this network."));
|
||||
gtk_widget_show (label);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
#endif
|
||||
|
||||
label = gtk_label_new (_("What would you like to do next?"));
|
||||
gtk_widget_show (label);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
#endif
|
||||
|
||||
serv->gui->joind_radio1 = radiobutton1 = gtk_radio_button_new_with_mnemonic (NULL, _("_Nothing, I'll join a channel later."));
|
||||
gtk_widget_show (radiobutton1);
|
||||
@@ -233,12 +212,8 @@ joind_show_dialog (server *serv)
|
||||
gtk_widget_show (label);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
#endif
|
||||
|
||||
radiobutton3 = gtk_radio_button_new_with_mnemonic (NULL, _("O_pen the channel list."));
|
||||
gtk_widget_show (radiobutton3);
|
||||
@@ -251,12 +226,8 @@ joind_show_dialog (server *serv)
|
||||
gtk_widget_show (label);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
#endif
|
||||
|
||||
serv->gui->joind_check = checkbutton1 = gtk_check_button_new_with_mnemonic (_("_Always show this dialog after connecting."));
|
||||
if (prefs.hex_gui_join_dialog)
|
||||
@@ -266,18 +237,7 @@ joind_show_dialog (server *serv)
|
||||
|
||||
okbutton1 = gtkutil_button_new_from_stock ("gtk-ok", _("_OK"));
|
||||
gtk_widget_show (okbutton1);
|
||||
#if HAVE_GTK3
|
||||
gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
|
||||
#elif !HAVE_GTK3
|
||||
{
|
||||
GtkWidget *dialog_action_area1;
|
||||
|
||||
dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (dialog1));
|
||||
gtk_widget_show (dialog_action_area1);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
|
||||
gtk_box_pack_end (GTK_BOX (dialog_action_area1), okbutton1, FALSE, TRUE, 0);
|
||||
}
|
||||
#endif
|
||||
gtk_widget_set_can_default (okbutton1, TRUE);
|
||||
|
||||
g_signal_connect (G_OBJECT (dialog1), "destroy",
|
||||
|
||||
@@ -60,20 +60,11 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_TAB_DETACH "zc-menu-detach"
|
||||
#define ICON_TAB_CLOSE "zc-menu-close"
|
||||
#define ICON_TAB_PREVIOUS "zc-menu-previous"
|
||||
#define ICON_TAB_NEXT "zc-menu-next"
|
||||
#define ICON_ENTRY_ERROR "dialog-error"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_TAB_DETACH GTK_STOCK_REDO
|
||||
#define ICON_TAB_CLOSE GTK_STOCK_CLOSE
|
||||
#define ICON_TAB_PREVIOUS GTK_STOCK_GO_BACK
|
||||
#define ICON_TAB_NEXT GTK_STOCK_GO_FORWARD
|
||||
#define ICON_ENTRY_ERROR GTK_STOCK_DIALOG_ERROR
|
||||
#endif
|
||||
|
||||
#define GUI_SPACING (3)
|
||||
#define GUI_BORDER (0)
|
||||
@@ -113,7 +104,6 @@ mg_color_component_to_pango (double value)
|
||||
return (guint16)(value * 65535.0 + 0.5);
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
static void
|
||||
mg_apply_font_css (GtkWidget *widget, const PangoFontDescription *desc,
|
||||
const char *class_name, const char *provider_key)
|
||||
@@ -148,33 +138,21 @@ mg_apply_font_css (GtkWidget *widget, const PangoFontDescription *desc,
|
||||
gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
mg_set_label_alignment_start (GtkWidget *widget)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
|
||||
#endif
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
mg_box_new (GtkOrientation orientation, gboolean homogeneous, gint spacing)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *box = gtk_box_new (orientation, spacing);
|
||||
|
||||
gtk_box_set_homogeneous (GTK_BOX (box), homogeneous);
|
||||
return box;
|
||||
#elif !HAVE_GTK3
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
return gtk_hbox_new (homogeneous, spacing);
|
||||
|
||||
return gtk_vbox_new (homogeneous, spacing);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -781,21 +759,11 @@ mg_progressbar_update (GtkWidget *bar)
|
||||
if (type == 0)
|
||||
{
|
||||
type = 1;
|
||||
#if HAVE_GTK3
|
||||
gtk_progress_bar_set_inverted (GTK_PROGRESS_BAR (bar), TRUE);
|
||||
#else
|
||||
gtk_progress_bar_set_orientation ((GtkProgressBar *) bar,
|
||||
GTK_PROGRESS_RIGHT_TO_LEFT);
|
||||
#endif
|
||||
} else
|
||||
{
|
||||
type = 0;
|
||||
#if HAVE_GTK3
|
||||
gtk_progress_bar_set_inverted (GTK_PROGRESS_BAR (bar), FALSE);
|
||||
#else
|
||||
gtk_progress_bar_set_orientation ((GtkProgressBar *) bar,
|
||||
GTK_PROGRESS_LEFT_TO_RIGHT);
|
||||
#endif
|
||||
}
|
||||
pos = 0.05;
|
||||
}
|
||||
@@ -1418,44 +1386,23 @@ mg_open_quit_dialog (gboolean minimize_button)
|
||||
dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
gtk_widget_show (dialog_vbox1);
|
||||
|
||||
#if HAVE_GTK3
|
||||
table1 = gtk_grid_new ();
|
||||
gtk_widget_show (table1);
|
||||
gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table1), 6);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table1), 12);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table1), 12);
|
||||
#else
|
||||
table1 = gtk_table_new (2, 2, FALSE);
|
||||
gtk_widget_show (table1);
|
||||
gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table1), 6);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table1), 12);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table1), 12);
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
|
||||
#endif
|
||||
gtk_widget_show (image);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (image, FALSE);
|
||||
gtk_widget_set_vexpand (image, FALSE);
|
||||
gtk_widget_set_halign (image, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (image, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (table1), image, 0, 0, 1, 1);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table1), image, 0, 1, 0, 1,
|
||||
(GtkAttachOptions) (GTK_FILL),
|
||||
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
||||
#endif
|
||||
|
||||
checkbutton1 = gtk_check_button_new_with_mnemonic (_("Don't ask next time."));
|
||||
gtk_widget_show (checkbutton1);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (checkbutton1, TRUE);
|
||||
gtk_widget_set_vexpand (checkbutton1, FALSE);
|
||||
gtk_widget_set_halign (checkbutton1, GTK_ALIGN_FILL);
|
||||
@@ -1463,11 +1410,6 @@ mg_open_quit_dialog (gboolean minimize_button)
|
||||
gtk_widget_set_margin_top (checkbutton1, 4);
|
||||
gtk_widget_set_margin_bottom (checkbutton1, 4);
|
||||
gtk_grid_attach (GTK_GRID (table1), checkbutton1, 0, 1, 2, 1);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table1), checkbutton1, 0, 2, 1, 2,
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 4);
|
||||
#endif
|
||||
|
||||
connecttext = g_strdup_printf (_("You are connected to %i IRC networks."), cons);
|
||||
text = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s\n%s",
|
||||
@@ -1479,30 +1421,14 @@ mg_open_quit_dialog (gboolean minimize_button)
|
||||
g_free (text);
|
||||
gtk_widget_show (label);
|
||||
mg_set_label_alignment_start (label);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_widget_set_vexpand (label, TRUE);
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
|
||||
gtk_grid_attach (GTK_GRID (table1), label, 1, 0, 1, 1);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table1), label, 1, 2, 0, 1,
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);
|
||||
#endif
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
|
||||
#if !HAVE_GTK3
|
||||
{
|
||||
GtkWidget *dialog_action_area1;
|
||||
|
||||
dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
|
||||
gtk_widget_show (dialog_action_area1);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1),
|
||||
GTK_BUTTONBOX_END);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (minimize_button && gtkutil_tray_icon_supported (GTK_WINDOW(dialog)))
|
||||
{
|
||||
@@ -1511,27 +1437,17 @@ mg_open_quit_dialog (gboolean minimize_button)
|
||||
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, 1);
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
button = gtk_button_new_with_mnemonic (_("_Cancel"));
|
||||
gtk_button_set_image (GTK_BUTTON (button),
|
||||
gtk_image_new_from_icon_name ("dialog-cancel", GTK_ICON_SIZE_BUTTON));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
button = gtk_button_new_from_stock ("gtk-cancel");
|
||||
#endif
|
||||
gtk_widget_show (button);
|
||||
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button,
|
||||
GTK_RESPONSE_CANCEL);
|
||||
gtk_widget_grab_focus (button);
|
||||
|
||||
#if HAVE_GTK3
|
||||
button = gtk_button_new_with_mnemonic (_("_Quit"));
|
||||
gtk_button_set_image (GTK_BUTTON (button),
|
||||
gtk_image_new_from_icon_name ("application-exit", GTK_ICON_SIZE_BUTTON));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
button = gtk_button_new_from_stock ("gtk-quit");
|
||||
#endif
|
||||
gtk_widget_show (button);
|
||||
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, 0);
|
||||
|
||||
@@ -1908,11 +1824,7 @@ mg_create_tabmenu (session *sess, GdkEventButton *event, chan *ch)
|
||||
g_object_unref (menu);
|
||||
g_signal_connect (G_OBJECT (menu), "selection-done",
|
||||
G_CALLBACK (mg_menu_destroy), NULL);
|
||||
#if HAVE_GTK3
|
||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *)event);
|
||||
#else
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, event->time);
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2029,15 +1941,11 @@ mg_userlist_button (GtkWidget * box, char *label, char *cmd,
|
||||
GtkWidget *wid = gtk_button_new_with_label (label);
|
||||
g_signal_connect (G_OBJECT (wid), "clicked",
|
||||
G_CALLBACK (userlist_button_cb), cmd);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (wid, TRUE);
|
||||
gtk_widget_set_vexpand (wid, TRUE);
|
||||
gtk_widget_set_halign (wid, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (wid, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (box), wid, a, c, b - a, d - c);
|
||||
#else
|
||||
gtk_table_attach_defaults (GTK_TABLE (box), wid, a, b, c, d);
|
||||
#endif
|
||||
show_and_unfocus (wid);
|
||||
}
|
||||
|
||||
@@ -2049,11 +1957,7 @@ mg_create_userlistbuttons (GtkWidget *box)
|
||||
int a = 0, b = 0;
|
||||
GtkWidget *tab;
|
||||
|
||||
#if HAVE_GTK3
|
||||
tab = gtk_grid_new ();
|
||||
#else
|
||||
tab = gtk_table_new (5, 2, FALSE);
|
||||
#endif
|
||||
gtk_box_pack_end (GTK_BOX (box), tab, FALSE, FALSE, 0);
|
||||
|
||||
while (list)
|
||||
@@ -2683,12 +2587,8 @@ mg_create_textarea (session *sess, GtkWidget *box)
|
||||
g_signal_connect (G_OBJECT (xtext), "word_click",
|
||||
G_CALLBACK (mg_word_clicked), NULL);
|
||||
|
||||
#if HAVE_GTK3
|
||||
gui->vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL,
|
||||
GTK_XTEXT (xtext)->adj);
|
||||
#elif !HAVE_GTK3
|
||||
gui->vscrollbar = gtk_vscrollbar_new (GTK_XTEXT (xtext)->adj);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (inbox), gui->vscrollbar, FALSE, TRUE, 0);
|
||||
|
||||
gtk_drag_dest_set (gui->vscrollbar, 5, dnd_dest_targets, 2,
|
||||
@@ -2815,7 +2715,7 @@ mg_create_userlist (session_gui *gui, GtkWidget *box)
|
||||
* - When "Use the text box font and colors" is enabled, we already want the
|
||||
* palette background.
|
||||
* - When "Dark mode" is enabled, we also force the user list to use the
|
||||
* palette colors so it doesn't stay blindingly white on GTK2 themes.
|
||||
* palette colors so it doesn't stay blindingly white on dark themes.
|
||||
*/
|
||||
if (prefs.hex_gui_ulist_style || fe_dark_mode_is_enabled ())
|
||||
{
|
||||
@@ -2873,34 +2773,18 @@ mg_create_center (session *sess, session_gui *gui, GtkWidget *box)
|
||||
GtkWidget *vbox, *hbox, *book;
|
||||
|
||||
/* sep between top and bottom of left side */
|
||||
#if HAVE_GTK3
|
||||
gui->vpane_left = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||
#elif !HAVE_GTK3
|
||||
gui->vpane_left = gtk_vpaned_new ();
|
||||
#endif
|
||||
|
||||
/* sep between top and bottom of right side */
|
||||
#if HAVE_GTK3
|
||||
gui->vpane_right = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||
#elif !HAVE_GTK3
|
||||
gui->vpane_right = gtk_vpaned_new ();
|
||||
#endif
|
||||
|
||||
/* sep between left and xtext */
|
||||
#if HAVE_GTK3
|
||||
gui->hpane_left = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_paned_set_wide_handle (GTK_PANED (gui->hpane_left), FALSE);
|
||||
#elif !HAVE_GTK3
|
||||
gui->hpane_left = gtk_hpaned_new ();
|
||||
#endif
|
||||
gtk_paned_set_position (GTK_PANED (gui->hpane_left), prefs.hex_gui_pane_left_size);
|
||||
|
||||
/* sep between xtext and right side */
|
||||
#if HAVE_GTK3
|
||||
gui->hpane_right = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
#elif !HAVE_GTK3
|
||||
gui->hpane_right = gtk_hpaned_new ();
|
||||
#endif
|
||||
|
||||
if (prefs.hex_gui_win_swap)
|
||||
{
|
||||
@@ -3017,13 +2901,8 @@ mg_place_userlist_and_chanview_real (session_gui *gui, GtkWidget *userlist, GtkW
|
||||
/* incase the previous pos was POS_HIDDEN */
|
||||
gtk_widget_show (chanview);
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_margin_top (chanview, 0);
|
||||
gtk_widget_set_margin_bottom (chanview, 0);
|
||||
#else
|
||||
gtk_table_set_row_spacing (GTK_TABLE (gui->main_table), 1, 0);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (gui->main_table), 2, 2);
|
||||
#endif
|
||||
|
||||
/* then place them back in their new positions */
|
||||
switch (prefs.hex_gui_tab_pos)
|
||||
@@ -3041,7 +2920,6 @@ mg_place_userlist_and_chanview_real (session_gui *gui, GtkWidget *userlist, GtkW
|
||||
gtk_paned_pack2 (GTK_PANED (gui->vpane_right), chanview, FALSE, TRUE);
|
||||
break;
|
||||
case POS_TOP:
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_margin_bottom (chanview, GUI_SPACING - 1);
|
||||
gtk_widget_set_hexpand (chanview, FALSE);
|
||||
gtk_widget_set_vexpand (chanview, FALSE);
|
||||
@@ -3049,17 +2927,11 @@ mg_place_userlist_and_chanview_real (session_gui *gui, GtkWidget *userlist, GtkW
|
||||
gtk_widget_set_valign (chanview, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (gui->main_table), chanview,
|
||||
1, 1, 1, 1);
|
||||
#else
|
||||
gtk_table_set_row_spacing (GTK_TABLE (gui->main_table), 1, GUI_SPACING-1);
|
||||
gtk_table_attach (GTK_TABLE (gui->main_table), chanview,
|
||||
1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
break;
|
||||
case POS_HIDDEN:
|
||||
gtk_widget_hide (chanview);
|
||||
/* always attach it to something to avoid ref_count=0 */
|
||||
if (prefs.hex_gui_ulist_pos == POS_TOP)
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
gtk_widget_set_hexpand (chanview, FALSE);
|
||||
gtk_widget_set_vexpand (chanview, FALSE);
|
||||
@@ -3068,13 +2940,8 @@ mg_place_userlist_and_chanview_real (session_gui *gui, GtkWidget *userlist, GtkW
|
||||
gtk_grid_attach (GTK_GRID (gui->main_table), chanview,
|
||||
1, 3, 1, 1);
|
||||
}
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (gui->main_table), chanview,
|
||||
1, 2, 3, 4, GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
|
||||
else
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
gtk_widget_set_hexpand (chanview, FALSE);
|
||||
gtk_widget_set_vexpand (chanview, FALSE);
|
||||
@@ -3083,13 +2950,8 @@ mg_place_userlist_and_chanview_real (session_gui *gui, GtkWidget *userlist, GtkW
|
||||
gtk_grid_attach (GTK_GRID (gui->main_table), chanview,
|
||||
1, 1, 1, 1);
|
||||
}
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (gui->main_table), chanview,
|
||||
1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
break;
|
||||
default:/* POS_BOTTOM */
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_margin_top (chanview, 3);
|
||||
gtk_widget_set_hexpand (chanview, FALSE);
|
||||
gtk_widget_set_vexpand (chanview, FALSE);
|
||||
@@ -3097,11 +2959,6 @@ mg_place_userlist_and_chanview_real (session_gui *gui, GtkWidget *userlist, GtkW
|
||||
gtk_widget_set_valign (chanview, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (gui->main_table), chanview,
|
||||
1, 3, 1, 1);
|
||||
#else
|
||||
gtk_table_set_row_spacing (GTK_TABLE (gui->main_table), 2, 3);
|
||||
gtk_table_attach (GTK_TABLE (gui->main_table), chanview,
|
||||
1, 2, 3, 4, GTK_FILL, GTK_FILL, 0, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3184,7 +3041,7 @@ mg_inputbox_rightclick (GtkEntry *entry, GtkWidget *menu)
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
* Emoji font handling (GTK2)
|
||||
* Emoji font handling
|
||||
*
|
||||
* Goal: prefer color emoji fonts when available, without changing existing
|
||||
* font size/style/weight, and without breaking user-configured fonts.
|
||||
@@ -3269,17 +3126,12 @@ static void
|
||||
mg_apply_emoji_fallback_widget (GtkWidget *widget)
|
||||
{
|
||||
PangoFontDescription *desc;
|
||||
#if HAVE_GTK3
|
||||
GtkStyleContext *context;
|
||||
const PangoFontDescription *base_desc;
|
||||
#else
|
||||
GtkStyle *style;
|
||||
#endif
|
||||
|
||||
if (!widget)
|
||||
return;
|
||||
|
||||
#if HAVE_GTK3
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
if (!context)
|
||||
return;
|
||||
@@ -3289,22 +3141,11 @@ mg_apply_emoji_fallback_widget (GtkWidget *widget)
|
||||
return;
|
||||
|
||||
desc = mg_fontdesc_with_fallback (base_desc, FALSE);
|
||||
#else
|
||||
style = gtk_widget_get_style (widget);
|
||||
if (!style || !style->font_desc)
|
||||
return;
|
||||
|
||||
desc = mg_fontdesc_with_fallback (style->font_desc, FALSE);
|
||||
#endif
|
||||
if (!desc)
|
||||
return;
|
||||
|
||||
#if HAVE_GTK3
|
||||
mg_apply_font_css (widget, desc, "zoitechat-emoji-font",
|
||||
"zoitechat-emoji-font-provider");
|
||||
#else
|
||||
gtk_widget_modify_font (widget, desc);
|
||||
#endif
|
||||
pango_font_description_free (desc);
|
||||
}
|
||||
|
||||
@@ -3340,12 +3181,7 @@ search_handle_event(int search_type, session *sess)
|
||||
|
||||
if (err)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, ICON_ENTRY_ERROR);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR);
|
||||
#endif
|
||||
gtk_entry_set_icon_tooltip_text (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, _(err->message));
|
||||
g_error_free (err);
|
||||
}
|
||||
@@ -3353,12 +3189,7 @@ search_handle_event(int search_type, session *sess)
|
||||
{
|
||||
if (text && text[0] == 0) /* empty string, no error */
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3366,24 +3197,14 @@ search_handle_event(int search_type, session *sess)
|
||||
last = gtk_xtext_search (GTK_XTEXT (sess->gui->xtext), text, flags, &err);
|
||||
if (!last) /* Not found error */
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, ICON_ENTRY_ERROR);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR);
|
||||
#endif
|
||||
gtk_entry_set_icon_tooltip_text (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, _("No results found."));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3430,12 +3251,7 @@ mg_search_toggle(session *sess)
|
||||
else
|
||||
{
|
||||
/* Reset search state */
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
|
||||
/* Show and focus */
|
||||
gtk_widget_show(sess->gui->shbox);
|
||||
@@ -3462,12 +3278,7 @@ mg_create_search(session *sess, GtkWidget *box)
|
||||
gtk_box_pack_start(GTK_BOX(box), gui->shbox, FALSE, FALSE, 0);
|
||||
|
||||
close = gtk_button_new ();
|
||||
#if HAVE_GTK3
|
||||
gtk_button_set_image (GTK_BUTTON (close), gtkutil_image_new_from_stock (ICON_TAB_CLOSE, GTK_ICON_SIZE_MENU));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_button_set_image (GTK_BUTTON (close), gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU));
|
||||
#endif
|
||||
gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE);
|
||||
gtk_widget_set_can_focus (close, FALSE);
|
||||
gtk_box_pack_start(GTK_BOX(gui->shbox), close, FALSE, FALSE, 0);
|
||||
@@ -3487,24 +3298,14 @@ mg_create_search(session *sess, GtkWidget *box)
|
||||
gtk_entry_set_icon_tooltip_text (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, _("Search hit end or not found."));
|
||||
|
||||
previous = gtk_button_new ();
|
||||
#if HAVE_GTK3
|
||||
gtk_button_set_image (GTK_BUTTON (previous), gtkutil_image_new_from_stock (ICON_TAB_PREVIOUS, GTK_ICON_SIZE_MENU));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_button_set_image (GTK_BUTTON (previous), gtk_image_new_from_stock (GTK_STOCK_GO_BACK, GTK_ICON_SIZE_MENU));
|
||||
#endif
|
||||
gtk_button_set_relief(GTK_BUTTON(previous), GTK_RELIEF_NONE);
|
||||
gtk_widget_set_can_focus (previous, FALSE);
|
||||
gtk_box_pack_start(GTK_BOX(gui->shbox), previous, FALSE, FALSE, 0);
|
||||
g_signal_connect(G_OBJECT(previous), "clicked", G_CALLBACK(mg_search_handle_previous), sess);
|
||||
|
||||
next = gtk_button_new ();
|
||||
#if HAVE_GTK3
|
||||
gtk_button_set_image (GTK_BUTTON (next), gtkutil_image_new_from_stock (ICON_TAB_NEXT, GTK_ICON_SIZE_MENU));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_button_set_image (GTK_BUTTON (next), gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_MENU));
|
||||
#endif
|
||||
gtk_button_set_relief(GTK_BUTTON(next), GTK_RELIEF_NONE);
|
||||
gtk_widget_set_can_focus (next, FALSE);
|
||||
gtk_box_pack_start(GTK_BOX(gui->shbox), next, FALSE, FALSE, 0);
|
||||
@@ -3538,7 +3339,6 @@ mg_create_entry (session *sess, GtkWidget *box)
|
||||
{
|
||||
GtkWidget *hbox, *but, *entry;
|
||||
session_gui *gui = sess->gui;
|
||||
#if HAVE_GTK3
|
||||
const char *emoji_fallback_icon_names[] = {
|
||||
"face-smile-symbolic",
|
||||
"face-smile",
|
||||
@@ -3548,7 +3348,6 @@ mg_create_entry (session *sess, GtkWidget *box)
|
||||
NULL
|
||||
};
|
||||
const char *emoji_fallback_icon_name;
|
||||
#endif
|
||||
|
||||
hbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), hbox, 0, 0, 0);
|
||||
@@ -3588,7 +3387,6 @@ mg_create_entry (session *sess, GtkWidget *box)
|
||||
if (prefs.hex_gui_input_style)
|
||||
mg_apply_entry_style (entry);
|
||||
|
||||
#if HAVE_GTK3
|
||||
g_object_set (G_OBJECT (entry), "show-emoji-icon", TRUE, NULL);
|
||||
|
||||
if (gtk_entry_get_icon_storage_type (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY) == GTK_IMAGE_EMPTY)
|
||||
@@ -3597,7 +3395,6 @@ mg_create_entry (session *sess, GtkWidget *box)
|
||||
if (emoji_fallback_icon_name)
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, emoji_fallback_icon_name);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3658,11 +3455,7 @@ mg_create_tabs (session_gui *gui)
|
||||
|
||||
gui->chanview = chanview_new (prefs.hex_gui_tab_layout, prefs.hex_gui_tab_trunc,
|
||||
prefs.hex_gui_tab_sort, use_icons,
|
||||
#if HAVE_GTK3
|
||||
input_style ? input_style->font_desc : NULL
|
||||
#else
|
||||
prefs.hex_gui_ulist_style ? input_style : NULL
|
||||
#endif
|
||||
);
|
||||
chanview_set_callbacks (gui->chanview, mg_switch_tab_cb, mg_xbutton_cb,
|
||||
mg_tab_contextmenu_cb, (void *)mg_tabs_compare);
|
||||
@@ -3706,16 +3499,11 @@ mg_create_menu (session_gui *gui, GtkWidget *table, int away_state)
|
||||
|
||||
gui->menu = menu_create_main (accel_group, TRUE, away_state, !gui->is_tab,
|
||||
gui->menu_item);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (gui->menu, TRUE);
|
||||
gtk_widget_set_vexpand (gui->menu, FALSE);
|
||||
gtk_widget_set_halign (gui->menu, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (gui->menu, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (table), gui->menu, 0, 0, 3, 1);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), gui->menu, 0, 3, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3725,16 +3513,11 @@ mg_create_irctab (session *sess, GtkWidget *table)
|
||||
session_gui *gui = sess->gui;
|
||||
|
||||
vbox = mg_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (vbox, TRUE);
|
||||
gtk_widget_set_vexpand (vbox, TRUE);
|
||||
gtk_widget_set_halign (vbox, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (vbox, GTK_ALIGN_FILL);
|
||||
gtk_grid_attach (GTK_GRID (table), vbox, 1, 2, 1, 1);
|
||||
#else
|
||||
gtk_table_attach (GTK_TABLE (table), vbox, 1, 2, 2, 3,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
#endif
|
||||
mg_create_center (sess, gui, vbox);
|
||||
}
|
||||
|
||||
@@ -3767,20 +3550,11 @@ mg_create_topwindow (session *sess)
|
||||
|
||||
palette_alloc (win);
|
||||
|
||||
#if HAVE_GTK3
|
||||
table = gtk_grid_new ();
|
||||
/* spacing under the menubar */
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table), GUI_SPACING);
|
||||
/* left and right borders */
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table), 1);
|
||||
#else
|
||||
table = gtk_table_new (4, 3, FALSE);
|
||||
/* spacing under the menubar */
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, GUI_SPACING);
|
||||
/* left and right borders */
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 1);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 1, 1);
|
||||
#endif
|
||||
gtk_container_add (GTK_CONTAINER (win), table);
|
||||
|
||||
mg_create_irctab (sess, table);
|
||||
@@ -3968,20 +3742,11 @@ mg_create_tabwindow (session *sess)
|
||||
|
||||
palette_alloc (win);
|
||||
|
||||
#if HAVE_GTK3
|
||||
sess->gui->main_table = table = gtk_grid_new ();
|
||||
/* spacing under the menubar */
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table), GUI_SPACING);
|
||||
/* left and right borders */
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table), 1);
|
||||
#else
|
||||
sess->gui->main_table = table = gtk_table_new (4, 3, FALSE);
|
||||
/* spacing under the menubar */
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, GUI_SPACING);
|
||||
/* left and right borders */
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 1);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 1, 1);
|
||||
#endif
|
||||
gtk_container_add (GTK_CONTAINER (win), table);
|
||||
|
||||
mg_create_irctab (sess, table);
|
||||
@@ -4597,13 +4362,9 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
grandparent = parent ? gtk_widget_get_parent (parent) : NULL;
|
||||
paned = grandparent ? GTK_PANED (grandparent) : NULL;
|
||||
#if HAVE_GTK3
|
||||
if (paned != NULL &&
|
||||
gtk_paned_get_child1 (paned) != NULL &&
|
||||
gtk_paned_get_child2 (paned) != NULL)
|
||||
#else
|
||||
if (paned != NULL && paned->child1 != NULL && paned->child2 != NULL)
|
||||
#endif
|
||||
{
|
||||
cairo_rectangle (cr, 1 + ox, 2 + oy, width - 3, height - 4);
|
||||
cairo_rectangle (cr, 0 + ox, 1 + oy, width - 1, height - 2);
|
||||
|
||||
@@ -130,9 +130,7 @@ menu_new (void)
|
||||
{
|
||||
GtkWidget *menu = gtk_menu_new ();
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtk_menu_set_reserve_toggle_size (GTK_MENU (menu), FALSE);
|
||||
#endif
|
||||
|
||||
return menu;
|
||||
}
|
||||
@@ -338,11 +336,9 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags,
|
||||
gpointer userdata, char *icon)
|
||||
{
|
||||
GtkWidget *img, *item;
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *box;
|
||||
GtkWidget *image = NULL;
|
||||
GtkWidget *label_widget;
|
||||
#endif
|
||||
|
||||
if (!label)
|
||||
item = gtk_menu_item_new ();
|
||||
@@ -355,7 +351,6 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags,
|
||||
else*/
|
||||
img = menu_icon_widget_new (icon);
|
||||
|
||||
#if HAVE_GTK3
|
||||
item = gtk_menu_item_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
if (img)
|
||||
@@ -365,11 +360,6 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags,
|
||||
gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), label_widget, FALSE, FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (item), box);
|
||||
#else
|
||||
item = gtk_image_menu_item_new_with_mnemonic (label);
|
||||
if (img)
|
||||
gtk_image_menu_item_set_image ((GtkImageMenuItem *)item, img);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -378,18 +368,10 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags,
|
||||
item = gtk_menu_item_new_with_label ("");
|
||||
if (flags & XCMENU_MNEMONIC)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_label_set_markup_with_mnemonic (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), label);
|
||||
#else
|
||||
gtk_label_set_markup_with_mnemonic (GTK_LABEL (GTK_BIN (item)->child), label);
|
||||
#endif
|
||||
} else
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), label);
|
||||
#else
|
||||
gtk_label_set_markup (GTK_LABEL (GTK_BIN (item)->child), label);
|
||||
#endif
|
||||
}
|
||||
} else
|
||||
{
|
||||
@@ -439,11 +421,7 @@ menu_quick_sub (char *name, GtkWidget *menu, GtkWidget **sub_item_ret, int flags
|
||||
if (flags & XCMENU_MARKUP)
|
||||
{
|
||||
sub_item = gtk_menu_item_new_with_label ("");
|
||||
#if HAVE_GTK3
|
||||
gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (sub_item))), name);
|
||||
#else
|
||||
gtk_label_set_markup (GTK_LABEL (GTK_BIN (sub_item)->child), name);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -483,11 +461,7 @@ toggle_cb (GtkWidget *item, char *pref_name)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
#if HAVE_GTK3
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
#else
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
#endif
|
||||
g_snprintf (buf, sizeof (buf), "set %s 1", pref_name);
|
||||
else
|
||||
g_snprintf (buf, sizeof (buf), "set %s 0", pref_name);
|
||||
@@ -668,7 +642,6 @@ menu_popup (GtkWidget *menu, GdkEventButton *event, gpointer objtounref)
|
||||
g_object_unref (menu);
|
||||
g_signal_connect (G_OBJECT (menu), "selection-done",
|
||||
G_CALLBACK (menu_destroy), objtounref);
|
||||
#if HAVE_GTK3
|
||||
if (event)
|
||||
{
|
||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *)event);
|
||||
@@ -684,10 +657,6 @@ menu_popup (GtkWidget *menu, GdkEventButton *event, gpointer objtounref)
|
||||
{
|
||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
|
||||
}
|
||||
#else
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
|
||||
0, event ? event->time : 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -808,9 +777,7 @@ void
|
||||
fe_userlist_update (session *sess, struct User *user)
|
||||
{
|
||||
GList *items, *next;
|
||||
#if HAVE_GTK3
|
||||
GList *iter;
|
||||
#endif
|
||||
|
||||
if (!nick_submenu || !str_copy)
|
||||
return;
|
||||
@@ -823,7 +790,6 @@ fe_userlist_update (session *sess, struct User *user)
|
||||
g_signal_handlers_disconnect_by_func (nick_submenu, menu_nickinfo_cb, sess);
|
||||
|
||||
/* destroy all the old items */
|
||||
#if HAVE_GTK3
|
||||
items = gtk_container_get_children (GTK_CONTAINER (nick_submenu));
|
||||
iter = items;
|
||||
while (iter)
|
||||
@@ -833,15 +799,6 @@ fe_userlist_update (session *sess, struct User *user)
|
||||
iter = next;
|
||||
}
|
||||
g_list_free (items);
|
||||
#else
|
||||
items = ((GtkMenuShell *) nick_submenu)->children;
|
||||
while (items)
|
||||
{
|
||||
next = items->next;
|
||||
gtk_widget_destroy (items->data);
|
||||
items = next;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* and re-create them with new info */
|
||||
menu_create_nickinfo_menu (user, nick_submenu);
|
||||
@@ -971,11 +928,7 @@ menu_setting_foreach (void (*callback) (session *), int id, guint state)
|
||||
|
||||
if (menu_item != NULL)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), state);
|
||||
#else
|
||||
GTK_CHECK_MENU_ITEM (menu_item)->active = state;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (callback)
|
||||
@@ -1309,7 +1262,6 @@ usermenu_destroy (GtkWidget * menu)
|
||||
{
|
||||
GList *items;
|
||||
GList *next;
|
||||
#if HAVE_GTK3
|
||||
GList *iter;
|
||||
|
||||
items = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
@@ -1321,16 +1273,6 @@ usermenu_destroy (GtkWidget * menu)
|
||||
iter = next;
|
||||
}
|
||||
g_list_free (items);
|
||||
#else
|
||||
items = ((GtkMenuShell *) menu)->children;
|
||||
|
||||
while (items)
|
||||
{
|
||||
next = items->next;
|
||||
gtk_widget_destroy (items->data);
|
||||
items = next;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1541,11 +1483,7 @@ menu_join_cb (GtkWidget *dialog, gint response, GtkEntry *entry)
|
||||
switch (response)
|
||||
{
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
#if HAVE_GTK3
|
||||
menu_chan_join (NULL, (char *)gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
#else
|
||||
menu_chan_join (NULL, entry->text);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_HELP:
|
||||
@@ -1566,11 +1504,8 @@ static void
|
||||
menu_join (GtkWidget * wid, gpointer none)
|
||||
{
|
||||
GtkWidget *hbox, *dialog, *entry, *label;
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *content_area;
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
dialog = gtk_dialog_new_with_buttons (_("Join Channel"),
|
||||
GTK_WINDOW (parent_window), 0,
|
||||
_("Retrieve channel list"), GTK_RESPONSE_HELP,
|
||||
@@ -1595,30 +1530,13 @@ menu_join (GtkWidget * wid, gpointer none)
|
||||
gtk_button_set_image (GTK_BUTTON (button),
|
||||
gtk_image_new_from_icon_name ("dialog-ok", GTK_ICON_SIZE_BUTTON));
|
||||
}
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
dialog = gtk_dialog_new_with_buttons (_("Join Channel"),
|
||||
GTK_WINDOW (parent_window), 0,
|
||||
_("Retrieve channel list"), GTK_RESPONSE_HELP,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
#endif
|
||||
#if HAVE_GTK3
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
gtk_box_set_homogeneous (GTK_BOX (content_area), TRUE);
|
||||
#else
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->vbox), TRUE);
|
||||
#endif
|
||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||
hbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, TRUE, 0);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
#if HAVE_GTK3
|
||||
gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE); /* avoid auto-selection */
|
||||
#else
|
||||
GTK_ENTRY (entry)->editable = 0; /* avoid auto-selection */
|
||||
#endif
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), "#");
|
||||
g_signal_connect (G_OBJECT (entry), "activate",
|
||||
G_CALLBACK (menu_join_entry_cb), dialog);
|
||||
@@ -1630,11 +1548,7 @@ menu_join (GtkWidget * wid, gpointer none)
|
||||
g_signal_connect (G_OBJECT (dialog), "response",
|
||||
G_CALLBACK (menu_join_cb), entry);
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtk_container_add (GTK_CONTAINER (content_area), hbox);
|
||||
#else
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
|
||||
#endif
|
||||
|
||||
gtk_widget_show_all (dialog);
|
||||
|
||||
@@ -1857,11 +1771,7 @@ static void
|
||||
menu_layout_cb (GtkWidget *item, gpointer none)
|
||||
{
|
||||
prefs.hex_gui_tab_layout = 2;
|
||||
#if HAVE_GTK3
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
#else
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
#endif
|
||||
prefs.hex_gui_tab_layout = 0;
|
||||
|
||||
menu_change_layout ();
|
||||
@@ -1876,11 +1786,7 @@ menu_apply_metres_cb (session *sess)
|
||||
static void
|
||||
menu_metres_off (GtkWidget *item, gpointer none)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
#else
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
#endif
|
||||
{
|
||||
prefs.hex_gui_lagometer = 0;
|
||||
prefs.hex_gui_throttlemeter = 0;
|
||||
@@ -1892,11 +1798,7 @@ menu_metres_off (GtkWidget *item, gpointer none)
|
||||
static void
|
||||
menu_metres_text (GtkWidget *item, gpointer none)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
#else
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
#endif
|
||||
{
|
||||
prefs.hex_gui_lagometer = 2;
|
||||
prefs.hex_gui_throttlemeter = 2;
|
||||
@@ -1908,11 +1810,7 @@ menu_metres_text (GtkWidget *item, gpointer none)
|
||||
static void
|
||||
menu_metres_graph (GtkWidget *item, gpointer none)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
#else
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
#endif
|
||||
{
|
||||
prefs.hex_gui_lagometer = 1;
|
||||
prefs.hex_gui_throttlemeter = 1;
|
||||
@@ -1924,11 +1822,7 @@ menu_metres_graph (GtkWidget *item, gpointer none)
|
||||
static void
|
||||
menu_metres_both (GtkWidget *item, gpointer none)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
#else
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
#endif
|
||||
{
|
||||
prefs.hex_gui_lagometer = 3;
|
||||
prefs.hex_gui_throttlemeter = 3;
|
||||
@@ -1979,11 +1873,7 @@ menu_about (GtkWidget *wid, gpointer sess)
|
||||
|
||||
gtk_about_dialog_set_program_name (dialog, _(DISPLAY_NAME));
|
||||
gtk_about_dialog_set_version (dialog, PACKAGE_VERSION);
|
||||
#if HAVE_GTK3
|
||||
gtk_about_dialog_set_license_type (GTK_ABOUT_DIALOG (dialog), GTK_LICENSE_GPL_2_0);
|
||||
#else
|
||||
gtk_about_dialog_set_license (dialog, license);
|
||||
#endif
|
||||
gtk_about_dialog_set_website (dialog, "http://zoitechat.zoite.net");
|
||||
gtk_about_dialog_set_website_label (dialog, "Website");
|
||||
gtk_about_dialog_set_logo (dialog, pix_zoitechat);
|
||||
@@ -2139,10 +2029,8 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock)
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *img = NULL;
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *box;
|
||||
GtkWidget *label_widget;
|
||||
#endif
|
||||
|
||||
if (is_stock)
|
||||
{
|
||||
@@ -2152,7 +2040,6 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock)
|
||||
{
|
||||
img = gtk_image_new_from_pixbuf (*((GdkPixbuf **)stock_name));
|
||||
}
|
||||
#if HAVE_GTK3
|
||||
item = gtk_menu_item_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
label_widget = gtk_label_new_with_mnemonic (labeltext);
|
||||
@@ -2164,21 +2051,15 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock)
|
||||
gtk_widget_show (img);
|
||||
gtk_widget_show (label_widget);
|
||||
gtk_widget_show (box);
|
||||
#else
|
||||
item = gtk_image_menu_item_new_with_mnemonic (labeltext);
|
||||
gtk_image_menu_item_set_image ((GtkImageMenuItem *)item, img);
|
||||
gtk_widget_show (img);
|
||||
#endif
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/* Override the default GTK2.4 handler, which would make menu
|
||||
/* Override the default handler, which would make menu
|
||||
bindings not work when the menu-bar is hidden. */
|
||||
static gboolean
|
||||
menu_canacaccel (GtkWidget *widget, guint signal_id, gpointer user_data)
|
||||
{
|
||||
/* GTK2.2 behaviour */
|
||||
return gtk_widget_is_sensitive (widget);
|
||||
}
|
||||
|
||||
@@ -2188,28 +2069,18 @@ static GtkMenuItem *
|
||||
menu_find_item (GtkWidget *menu, char *name)
|
||||
{
|
||||
GList *items;
|
||||
#if HAVE_GTK3
|
||||
GList *items_head;
|
||||
#endif
|
||||
GtkMenuItem *item;
|
||||
GtkWidget *child;
|
||||
const char *labeltext;
|
||||
GtkMenuItem *found = NULL;
|
||||
|
||||
#if HAVE_GTK3
|
||||
items_head = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
items = items_head;
|
||||
#else
|
||||
items = ((GtkMenuShell *) menu)->children;
|
||||
#endif
|
||||
while (items)
|
||||
{
|
||||
item = items->data;
|
||||
#if HAVE_GTK3
|
||||
child = gtk_bin_get_child (GTK_BIN (item));
|
||||
#else
|
||||
child = GTK_BIN (item)->child;
|
||||
#endif
|
||||
if (child) /* separators arn't labels, skip them */
|
||||
{
|
||||
labeltext = g_object_get_data (G_OBJECT (item), "name");
|
||||
@@ -2217,7 +2088,6 @@ menu_find_item (GtkWidget *menu, char *name)
|
||||
{
|
||||
if (GTK_IS_LABEL (child))
|
||||
labeltext = gtk_label_get_text (GTK_LABEL (child));
|
||||
#ifdef HAVE_GTK3
|
||||
else if (GTK_IS_CONTAINER (child))
|
||||
{
|
||||
GList *kids, *l;
|
||||
@@ -2232,7 +2102,6 @@ menu_find_item (GtkWidget *menu, char *name)
|
||||
}
|
||||
g_list_free (kids);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!menu_streq (labeltext, name, 1))
|
||||
@@ -2247,9 +2116,7 @@ menu_find_item (GtkWidget *menu, char *name)
|
||||
}
|
||||
items = items->next;
|
||||
}
|
||||
#if HAVE_GTK3
|
||||
g_list_free (items_head);
|
||||
#endif
|
||||
|
||||
return found;
|
||||
}
|
||||
@@ -2333,11 +2200,7 @@ menu_update_cb (GtkWidget *menu, menu_entry *me, char *target)
|
||||
gtk_widget_set_sensitive (item, me->enable);
|
||||
/* must do it without triggering the callback */
|
||||
if (GTK_IS_CHECK_MENU_ITEM (item))
|
||||
#if HAVE_GTK3
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), me->state);
|
||||
#else
|
||||
GTK_CHECK_MENU_ITEM (item)->active = me->state;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2346,11 +2209,7 @@ static void
|
||||
menu_radio_cb (GtkCheckMenuItem *item, menu_entry *me)
|
||||
{
|
||||
me->state = 0;
|
||||
#if HAVE_GTK3
|
||||
if (gtk_check_menu_item_get_active (item))
|
||||
#else
|
||||
if (item->active)
|
||||
#endif
|
||||
me->state = 1;
|
||||
|
||||
/* update the state, incase this was changed via right-click. */
|
||||
@@ -2366,11 +2225,7 @@ static void
|
||||
menu_toggle_cb (GtkCheckMenuItem *item, menu_entry *me)
|
||||
{
|
||||
me->state = 0;
|
||||
#if HAVE_GTK3
|
||||
if (gtk_check_menu_item_get_active (item))
|
||||
#else
|
||||
if (item->active)
|
||||
#endif
|
||||
me->state = 1;
|
||||
|
||||
/* update the state, incase this was changed via right-click. */
|
||||
@@ -2412,7 +2267,6 @@ menu_reorder (GtkMenu *menu, GtkWidget *item, int pos)
|
||||
return;
|
||||
|
||||
if (pos < 0) /* position offset from end/bottom */
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
GList *children = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
int length = g_list_length (children);
|
||||
@@ -2420,9 +2274,6 @@ menu_reorder (GtkMenu *menu, GtkWidget *item, int pos)
|
||||
g_list_free (children);
|
||||
gtk_menu_reorder_child (menu, item, (length + pos) - 1);
|
||||
}
|
||||
#else
|
||||
gtk_menu_reorder_child (menu, item, (g_list_length (GTK_MENU_SHELL (menu)->children) + pos) - 1);
|
||||
#endif
|
||||
else
|
||||
gtk_menu_reorder_child (menu, item, pos);
|
||||
}
|
||||
@@ -2488,7 +2339,6 @@ menu_add_sub (GtkWidget *menu, menu_entry *me)
|
||||
{
|
||||
pos = me->pos;
|
||||
if (pos < 0) /* position offset from end/bottom */
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
GList *children = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
int length = g_list_length (children);
|
||||
@@ -2496,9 +2346,6 @@ menu_add_sub (GtkWidget *menu, menu_entry *me)
|
||||
g_list_free (children);
|
||||
pos = length + pos;
|
||||
}
|
||||
#else
|
||||
pos = g_list_length (GTK_MENU_SHELL (menu)->children) + pos;
|
||||
#endif
|
||||
menu_quick_sub (me->label, menu, &item, me->markup ? XCMENU_MARKUP|XCMENU_MNEMONIC : XCMENU_MNEMONIC, pos);
|
||||
}
|
||||
return item;
|
||||
@@ -2776,11 +2623,7 @@ normalitem:
|
||||
item = gtk_check_menu_item_new_with_mnemonic (_(mymenu[i].text));
|
||||
togitem:
|
||||
/* must avoid callback for Radio buttons */
|
||||
#if HAVE_GTK3
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), mymenu[i].state);
|
||||
#else
|
||||
GTK_CHECK_MENU_ITEM (item)->active = mymenu[i].state;
|
||||
#endif
|
||||
/*gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
|
||||
mymenu[i].state);*/
|
||||
if (mymenu[i].key != 0)
|
||||
|
||||
@@ -35,42 +35,34 @@ zoitechat_gtk_deps = [
|
||||
libgmodule_dep, # used by libsexy
|
||||
]
|
||||
|
||||
if get_option('gtk3')
|
||||
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22')
|
||||
zoitechat_gtk_cflags += '-DHAVE_GTK3'
|
||||
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22')
|
||||
|
||||
if host_machine.system() != 'windows'
|
||||
appindicator_opt = get_option('appindicator')
|
||||
if host_machine.system() != 'windows'
|
||||
appindicator_opt = get_option('appindicator')
|
||||
|
||||
if appindicator_opt.allowed()
|
||||
appindicator_dep = dependency('ayatana-appindicator3-0.1', required: false)
|
||||
if appindicator_opt.allowed()
|
||||
appindicator_dep = dependency('ayatana-appindicator3-0.1', required: false)
|
||||
if appindicator_dep.found()
|
||||
zoitechat_gtk_deps += appindicator_dep
|
||||
zoitechat_gtk_cflags += '-DHAVE_AYATANA_APPINDICATOR'
|
||||
else
|
||||
appindicator_dep = dependency('appindicator3-0.1', required: false)
|
||||
if appindicator_dep.found()
|
||||
zoitechat_gtk_deps += appindicator_dep
|
||||
zoitechat_gtk_cflags += '-DHAVE_AYATANA_APPINDICATOR'
|
||||
else
|
||||
appindicator_dep = dependency('appindicator3-0.1', required: false)
|
||||
if appindicator_dep.found()
|
||||
zoitechat_gtk_deps += appindicator_dep
|
||||
zoitechat_gtk_cflags += '-DHAVE_APPINDICATOR'
|
||||
elif appindicator_opt.enabled()
|
||||
error('appindicator=enabled, but neither ayatana-appindicator3-0.1 nor appindicator3-0.1 was found')
|
||||
endif
|
||||
zoitechat_gtk_cflags += '-DHAVE_APPINDICATOR'
|
||||
elif appindicator_opt.enabled()
|
||||
error('appindicator=enabled, but neither ayatana-appindicator3-0.1 nor appindicator3-0.1 was found')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
gtk_dep = dependency('gtk+-2.0', version: '>= 2.24.0')
|
||||
zoitechat_gtk_cflags += '-DHAVE_GTK2'
|
||||
endif
|
||||
|
||||
zoitechat_gtk_deps += gtk_dep
|
||||
|
||||
if host_machine.system() != 'windows'
|
||||
if get_option('gtk3')
|
||||
gdk_x11_dep = dependency('gdk-x11-3.0', required: false)
|
||||
if gdk_x11_dep.found()
|
||||
zoitechat_gtk_deps += gdk_x11_dep
|
||||
endif
|
||||
gdk_x11_dep = dependency('gdk-x11-3.0', required: false)
|
||||
if gdk_x11_dep.found()
|
||||
zoitechat_gtk_deps += gdk_x11_dep
|
||||
endif
|
||||
|
||||
x11_dep = dependency('x11', required: false)
|
||||
|
||||
@@ -37,18 +37,10 @@
|
||||
#include "palette.h"
|
||||
#include "notifygui.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_NOTIFY_NEW "document-new"
|
||||
#define ICON_NOTIFY_DELETE "edit-delete"
|
||||
#define LABEL_NOTIFY_CANCEL _("_Cancel")
|
||||
#define LABEL_NOTIFY_OK _("_OK")
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_NOTIFY_NEW GTK_STOCK_NEW
|
||||
#define ICON_NOTIFY_DELETE GTK_STOCK_DELETE
|
||||
#define LABEL_NOTIFY_CANCEL GTK_STOCK_CANCEL
|
||||
#define LABEL_NOTIFY_OK GTK_STOCK_OK
|
||||
#endif
|
||||
|
||||
|
||||
/* model for the notify treeview */
|
||||
@@ -91,24 +83,16 @@ notify_treecell_property_mapper (GtkTreeViewColumn *col, GtkCellRenderer *cell,
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (model), iter,
|
||||
COLOUR_COLUMN, &colour,
|
||||
model_column, &text, -1);
|
||||
#if HAVE_GTK3
|
||||
g_object_set (G_OBJECT (cell), "text", text,
|
||||
PALETTE_FOREGROUND_PROPERTY, colour, NULL);
|
||||
if (colour)
|
||||
gdk_rgba_free (colour);
|
||||
#else
|
||||
g_object_set (G_OBJECT (cell), "text", text,
|
||||
PALETTE_FOREGROUND_PROPERTY, colour, NULL);
|
||||
if (colour)
|
||||
gdk_color_free (colour);
|
||||
#endif
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
notify_store_color (GtkListStore *store, GtkTreeIter *iter, const PaletteColor *color)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
if (color)
|
||||
{
|
||||
GdkRGBA rgba = *color;
|
||||
@@ -118,9 +102,6 @@ notify_store_color (GtkListStore *store, GtkTreeIter *iter, const PaletteColor *
|
||||
{
|
||||
gtk_list_store_set (store, iter, COLOUR_COLUMN, NULL, -1);
|
||||
}
|
||||
#else
|
||||
gtk_list_store_set (store, iter, COLOUR_COLUMN, color, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -398,13 +379,8 @@ fe_notify_ask (char *nick, char *networks)
|
||||
|
||||
table = gtkutil_grid_new (2, 3, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
|
||||
#if HAVE_GTK3
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table), 3);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table), 8);
|
||||
#else
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 8);
|
||||
#endif
|
||||
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table);
|
||||
|
||||
label = gtk_label_new (msg);
|
||||
@@ -465,13 +441,8 @@ notify_opengui (void)
|
||||
view = notify_treeview_new (vbox);
|
||||
g_object_set_data (G_OBJECT (notify_window), "view", view);
|
||||
|
||||
#if HAVE_GTK3
|
||||
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), bbox, 0, 0, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
@@ -38,16 +38,11 @@
|
||||
#include "../common/cfgfiles.h"
|
||||
#include "../common/typedef.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define PALETTE_COLOR_INIT(r, g, b) { (r) / 65535.0, (g) / 65535.0, (b) / 65535.0, 1.0 }
|
||||
#else
|
||||
#define PALETTE_COLOR_INIT(r, g, b) { 0, (r), (g), (b) }
|
||||
#endif
|
||||
|
||||
static void
|
||||
palette_color_set_rgb16 (PaletteColor *color, guint16 red, guint16 green, guint16 blue)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
char color_string[16];
|
||||
GdkRGBA parsed = { 0 };
|
||||
gboolean parsed_ok;
|
||||
@@ -63,18 +58,6 @@ palette_color_set_rgb16 (PaletteColor *color, guint16 red, guint16 green, guint1
|
||||
parsed.alpha = 1.0;
|
||||
}
|
||||
*color = parsed;
|
||||
#else
|
||||
char color_string[16];
|
||||
|
||||
g_snprintf (color_string, sizeof (color_string), "#%04x%04x%04x", red, green, blue);
|
||||
if (!gdk_color_parse (color_string, color))
|
||||
{
|
||||
color->red = red;
|
||||
color->green = green;
|
||||
color->blue = blue;
|
||||
color->pixel = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static XTextColor
|
||||
@@ -82,17 +65,10 @@ palette_color_from_gdk (const PaletteColor *color)
|
||||
{
|
||||
XTextColor result;
|
||||
|
||||
#if HAVE_GTK3
|
||||
result.red = color->red;
|
||||
result.green = color->green;
|
||||
result.blue = color->blue;
|
||||
result.alpha = color->alpha;
|
||||
#else
|
||||
result.red = color->red / 65535.0;
|
||||
result.green = color->green / 65535.0;
|
||||
result.blue = color->blue / 65535.0;
|
||||
result.alpha = 1.0;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -227,14 +203,7 @@ palette_user_set_color (int idx, const PaletteColor *col)
|
||||
user_colors_valid = TRUE;
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
user_colors[idx] = *col;
|
||||
#else
|
||||
user_colors[idx].red = col->red;
|
||||
user_colors[idx].green = col->green;
|
||||
user_colors[idx].blue = col->blue;
|
||||
user_colors[idx].pixel = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -252,14 +221,7 @@ palette_dark_set_color (int idx, const PaletteColor *col)
|
||||
dark_user_colors_valid = TRUE;
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
dark_user_colors[idx] = *col;
|
||||
#else
|
||||
dark_user_colors[idx].red = col->red;
|
||||
dark_user_colors[idx].green = col->green;
|
||||
dark_user_colors[idx].blue = col->blue;
|
||||
dark_user_colors[idx].pixel = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -24,30 +24,18 @@
|
||||
|
||||
#include "xtext-color.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
typedef GdkRGBA PaletteColor;
|
||||
#define PALETTE_GDK_TYPE GDK_TYPE_RGBA
|
||||
#define PALETTE_FOREGROUND_PROPERTY "foreground-rgba"
|
||||
#else
|
||||
typedef GdkColor PaletteColor;
|
||||
#define PALETTE_GDK_TYPE GDK_TYPE_COLOR
|
||||
#define PALETTE_FOREGROUND_PROPERTY "foreground-gdk"
|
||||
#endif
|
||||
|
||||
extern PaletteColor colors[];
|
||||
|
||||
static inline void
|
||||
palette_color_get_rgb16 (const PaletteColor *color, guint16 *red, guint16 *green, guint16 *blue)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
*red = (guint16) CLAMP (color->red * 65535.0 + 0.5, 0.0, 65535.0);
|
||||
*green = (guint16) CLAMP (color->green * 65535.0 + 0.5, 0.0, 65535.0);
|
||||
*blue = (guint16) CLAMP (color->blue * 65535.0 + 0.5, 0.0, 65535.0);
|
||||
#else
|
||||
*red = color->red;
|
||||
*green = color->green;
|
||||
*blue = color->blue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define COL_MARK_FG 32
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "menu.h"
|
||||
#include "gtkutil.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#include <gio/gio.h>
|
||||
#if defined(GTK_DISABLE_DEPRECATED)
|
||||
typedef struct _GtkStatusIcon GtkStatusIcon;
|
||||
@@ -43,7 +42,6 @@ typedef struct _GtkStatusIcon GtkStatusIcon;
|
||||
#include <libappindicator/app-indicator.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ICON_TRAY_PREFERENCES "zc-menu-preferences"
|
||||
#define ICON_TRAY_QUIT "zc-menu-quit"
|
||||
@@ -70,7 +68,7 @@ typedef enum
|
||||
WS_HIDDEN
|
||||
} WinStatus;
|
||||
|
||||
#if HAVE_GTK3 && !defined(WIN32) && (defined(HAVE_AYATANA_APPINDICATOR) || defined(HAVE_APPINDICATOR))
|
||||
#if !defined(WIN32) && (defined(HAVE_AYATANA_APPINDICATOR) || defined(HAVE_APPINDICATOR))
|
||||
#define HAVE_APPINDICATOR_BACKEND 1
|
||||
#else
|
||||
#define HAVE_APPINDICATOR_BACKEND 0
|
||||
@@ -109,7 +107,7 @@ typedef GdkPixbuf* TrayCustomIcon;
|
||||
#define ICON_HILIGHT pix_tray_highlight
|
||||
#define ICON_FILE pix_tray_fileoffer
|
||||
#endif
|
||||
#if HAVE_GTK3 && defined(GTK_DISABLE_DEPRECATED) && !HAVE_APPINDICATOR_BACKEND
|
||||
#if defined(GTK_DISABLE_DEPRECATED) && !HAVE_APPINDICATOR_BACKEND
|
||||
GtkStatusIcon *gtk_status_icon_new_from_pixbuf (GdkPixbuf *pixbuf);
|
||||
void gtk_status_icon_set_from_pixbuf (GtkStatusIcon *status_icon, GdkPixbuf *pixbuf);
|
||||
void gtk_status_icon_set_tooltip_text (GtkStatusIcon *status_icon, const gchar *text);
|
||||
@@ -1098,7 +1096,7 @@ tray_menu_populate (GtkWidget *menu)
|
||||
mg_create_icon_item (_("_Quit"), ICON_TRAY_QUIT, menu, tray_menu_quit_cb, NULL);
|
||||
}
|
||||
|
||||
#if HAVE_GTK3 && !defined(WIN32)
|
||||
#if !defined(WIN32)
|
||||
static void
|
||||
tray_menu_clear (GtkWidget *menu)
|
||||
{
|
||||
|
||||
@@ -68,7 +68,6 @@ plugingui_get_target_session (void)
|
||||
#define ICON_PLUGIN_UNLOAD "zc-menu-delete"
|
||||
#define ICON_PLUGIN_RELOAD "zc-menu-refresh"
|
||||
|
||||
#if HAVE_GTK3
|
||||
static GtkWidget *
|
||||
plugingui_icon_button (GtkWidget *box, const char *label,
|
||||
const char *icon_name, GCallback callback,
|
||||
@@ -87,7 +86,6 @@ plugingui_icon_button (GtkWidget *box, const char *label,
|
||||
|
||||
return button;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static GtkWidget *
|
||||
@@ -355,17 +353,11 @@ plugingui_open (void)
|
||||
g_object_set_data (G_OBJECT (plugin_window), "view", view);
|
||||
|
||||
|
||||
#if HAVE_GTK3
|
||||
hbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
hbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0);
|
||||
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
plugingui_icon_button (hbox, _("_Load..."), ICON_PLUGIN_LOAD,
|
||||
G_CALLBACK (plugingui_loadbutton_cb), NULL);
|
||||
@@ -374,17 +366,6 @@ plugingui_open (void)
|
||||
plugingui_icon_button (hbox, _("_Reload"), ICON_PLUGIN_RELOAD,
|
||||
G_CALLBACK (plugingui_reloadbutton_cb), view);
|
||||
}
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtkutil_button (hbox, ICON_PLUGIN_LOAD, NULL,
|
||||
plugingui_loadbutton_cb, NULL, _("_Load..."));
|
||||
|
||||
gtkutil_button (hbox, ICON_PLUGIN_UNLOAD, NULL,
|
||||
plugingui_unload, NULL, _("_Unload"));
|
||||
|
||||
gtkutil_button (hbox, ICON_PLUGIN_RELOAD, NULL,
|
||||
plugingui_reloadbutton_cb, view, _("_Reload"));
|
||||
#endif
|
||||
|
||||
fe_pluginlist_update ();
|
||||
|
||||
|
||||
@@ -42,14 +42,8 @@
|
||||
#include "xtext.h"
|
||||
#include "fkeys.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_RAWLOG_CLEAR "zc-menu-clear"
|
||||
#define ICON_RAWLOG_SAVE_AS "zc-menu-save-as"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_RAWLOG_CLEAR GTK_STOCK_CLEAR
|
||||
#define ICON_RAWLOG_SAVE_AS GTK_STOCK_SAVE_AS
|
||||
#endif
|
||||
|
||||
static void
|
||||
close_rawlog (GtkWidget *wid, server *serv)
|
||||
@@ -128,13 +122,9 @@ open_rawlog (struct server *serv)
|
||||
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_IN);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (scrolledwindow, TRUE);
|
||||
gtk_widget_set_vexpand (scrolledwindow, TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), scrolledwindow, TRUE, TRUE, 0);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_container_add (GTK_CONTAINER (vbox), scrolledwindow);
|
||||
#endif
|
||||
|
||||
palette_get_xtext_colors (xtext_palette, XTEXT_COLS);
|
||||
serv->gui->rawlog_textlist = gtk_xtext_new (xtext_palette, 0);
|
||||
@@ -142,13 +132,8 @@ open_rawlog (struct server *serv)
|
||||
gtk_xtext_set_font (GTK_XTEXT (serv->gui->rawlog_textlist), prefs.hex_text_font);
|
||||
GTK_XTEXT (serv->gui->rawlog_textlist)->ignore_hidden = 1;
|
||||
|
||||
#if HAVE_GTK3
|
||||
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_box_pack_end (GTK_BOX (vbox), bbox, 0, 0, 4);
|
||||
|
||||
gtkutil_button (bbox, ICON_RAWLOG_CLEAR, NULL, rawlog_clearbutton,
|
||||
|
||||
@@ -39,20 +39,11 @@
|
||||
#define SERVLIST_X_PADDING 4 /* horizontal paddig in the network editor */
|
||||
#define SERVLIST_Y_PADDING 0 /* vertical padding in the network editor */
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_SERVLIST_CONNECT "zc-menu-connect"
|
||||
#define ICON_SERVLIST_ADD "list-add"
|
||||
#define ICON_SERVLIST_REMOVE "list-remove"
|
||||
#define ICON_SERVLIST_CLOSE "window-close"
|
||||
#define ICON_SERVLIST_ERROR "dialog-error"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_SERVLIST_CONNECT GTK_STOCK_CONNECT
|
||||
#define ICON_SERVLIST_ADD GTK_STOCK_ADD
|
||||
#define ICON_SERVLIST_REMOVE GTK_STOCK_REMOVE
|
||||
#define ICON_SERVLIST_CLOSE GTK_STOCK_CLOSE
|
||||
#define ICON_SERVLIST_ERROR GTK_STOCK_DIALOG_ERROR
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENSSL
|
||||
# define DEFAULT_SERVER "newserver/6697"
|
||||
@@ -107,7 +98,6 @@ static session *servlist_sess;
|
||||
static void servlist_network_row_cb (GtkTreeSelection *sel, gpointer user_data);
|
||||
static GtkWidget *servlist_open_edit (GtkWidget *parent, ircnet *net);
|
||||
|
||||
#if HAVE_GTK3
|
||||
static GtkWidget *
|
||||
servlist_icon_button_new (const char *label, const char *icon_name)
|
||||
{
|
||||
@@ -121,7 +111,6 @@ servlist_icon_button_new (const char *label, const char *icon_name)
|
||||
|
||||
return button;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static const char *pages[]=
|
||||
@@ -1289,7 +1278,6 @@ typedef enum
|
||||
SERVLIST_ALIGN_FILL
|
||||
} servlist_align;
|
||||
|
||||
#if HAVE_GTK3
|
||||
static GtkAlign
|
||||
servlist_align_to_gtk (servlist_align align)
|
||||
{
|
||||
@@ -1304,7 +1292,6 @@ servlist_align_to_gtk (servlist_align align)
|
||||
return GTK_ALIGN_START;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
servlist_table_attach (GtkWidget *table, GtkWidget *child,
|
||||
@@ -1314,7 +1301,6 @@ servlist_table_attach (GtkWidget *table, GtkWidget *child,
|
||||
servlist_align halign, servlist_align valign,
|
||||
guint xpad, guint ypad)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (child, hexpand);
|
||||
gtk_widget_set_vexpand (child, vexpand);
|
||||
gtk_widget_set_halign (child, servlist_align_to_gtk (halign));
|
||||
@@ -1325,28 +1311,6 @@ servlist_table_attach (GtkWidget *table, GtkWidget *child,
|
||||
gtk_widget_set_margin_bottom (child, ypad);
|
||||
gtk_grid_attach (GTK_GRID (table), child, left_attach, top_attach,
|
||||
right_attach - left_attach, bottom_attach - top_attach);
|
||||
#else
|
||||
GtkAttachOptions xoptions = 0;
|
||||
GtkAttachOptions yoptions = 0;
|
||||
|
||||
if (hexpand)
|
||||
xoptions |= GTK_EXPAND;
|
||||
else
|
||||
xoptions |= GTK_SHRINK;
|
||||
if (halign == SERVLIST_ALIGN_FILL)
|
||||
xoptions |= GTK_FILL;
|
||||
|
||||
if (vexpand)
|
||||
yoptions |= GTK_EXPAND;
|
||||
else
|
||||
yoptions |= GTK_SHRINK;
|
||||
if (valign == SERVLIST_ALIGN_FILL)
|
||||
yoptions |= GTK_FILL;
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), child, left_attach, right_attach,
|
||||
top_attach, bottom_attach, xoptions, yoptions,
|
||||
xpad, ypad);
|
||||
#endif
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
@@ -1381,12 +1345,8 @@ servlist_create_entry (GtkWidget *table, char *labeltext, int row,
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
SERVLIST_X_PADDING, SERVLIST_Y_PADDING);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
#endif
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_tooltip_text (entry, tip);
|
||||
@@ -1675,24 +1635,14 @@ servlist_username_changed_cb (GtkEntry *entry, gpointer userdata)
|
||||
|
||||
if (gtk_entry_get_text (entry)[0] == 0)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, ICON_SERVLIST_ERROR);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR);
|
||||
#endif
|
||||
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY,
|
||||
_("User name cannot be left blank."));
|
||||
gtk_widget_set_sensitive (connect_btn, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
gtk_widget_set_sensitive (connect_btn, TRUE);
|
||||
}
|
||||
}
|
||||
@@ -1707,38 +1657,22 @@ servlist_nick_changed_cb (GtkEntry *entry, gpointer userdata)
|
||||
if (!nick1[0] || !nick2[0])
|
||||
{
|
||||
entry = GTK_ENTRY(!nick1[0] ? entry_nick1 : entry_nick2);
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, ICON_SERVLIST_ERROR);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR);
|
||||
#endif
|
||||
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY,
|
||||
_("You cannot have an empty nick name."));
|
||||
gtk_widget_set_sensitive (connect_btn, FALSE);
|
||||
}
|
||||
else if (!rfc_casecmp (nick1, nick2))
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, ICON_SERVLIST_ERROR);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR);
|
||||
#endif
|
||||
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY,
|
||||
_("You must have two unique nick names."));
|
||||
gtk_widget_set_sensitive (connect_btn, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY(entry_nick1), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY(entry_nick2), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_entry_set_icon_from_stock (GTK_ENTRY(entry_nick1), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
gtk_entry_set_icon_from_stock (GTK_ENTRY(entry_nick2), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
gtk_widget_set_sensitive (connect_btn, TRUE);
|
||||
}
|
||||
}
|
||||
@@ -1818,12 +1752,8 @@ bold_label (char *text)
|
||||
g_snprintf (buf, sizeof (buf), "<b>%s</b>", text);
|
||||
label = gtk_label_new (buf);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
#endif
|
||||
gtk_widget_show (label);
|
||||
|
||||
return label;
|
||||
@@ -1988,32 +1918,18 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
|
||||
|
||||
|
||||
/* Button Box */
|
||||
#if HAVE_GTK3
|
||||
vbuttonbox1 = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
|
||||
#elif !HAVE_GTK3
|
||||
vbuttonbox1 = gtk_vbutton_box_new ();
|
||||
#endif
|
||||
gtk_box_set_spacing (GTK_BOX (vbuttonbox1), 3);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox1), GTK_BUTTONBOX_START);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), vbuttonbox1, FALSE, FALSE, 3);
|
||||
|
||||
#if HAVE_GTK3
|
||||
buttonadd = servlist_icon_button_new (_("_Add"), ICON_SERVLIST_ADD);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
buttonadd = gtk_button_new_from_stock (GTK_STOCK_ADD);
|
||||
#endif
|
||||
g_signal_connect (G_OBJECT (buttonadd), "clicked",
|
||||
G_CALLBACK (servlist_addbutton_cb), notebook);
|
||||
gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonadd);
|
||||
gtk_widget_set_can_default (buttonadd, TRUE);
|
||||
|
||||
#if HAVE_GTK3
|
||||
buttonremove = servlist_icon_button_new (_("_Remove"), ICON_SERVLIST_REMOVE);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
buttonremove = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
|
||||
#endif
|
||||
g_signal_connect (G_OBJECT (buttonremove), "clicked",
|
||||
G_CALLBACK (servlist_deletebutton_cb), notebook);
|
||||
gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonremove);
|
||||
@@ -2029,13 +1945,8 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
|
||||
/* Checkboxes and entries */
|
||||
table3 = gtkutil_grid_new (13, 2, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox5), table3, FALSE, FALSE, 0);
|
||||
#if HAVE_GTK3
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table3), 2);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table3), 8);
|
||||
#else
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table3), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table3), 8);
|
||||
#endif
|
||||
|
||||
check = servlist_create_check (0, !(net->flags & FLAG_CYCLE), table3, 0, 0, _("Connect to selected server only"));
|
||||
gtk_widget_set_tooltip_text (check, _("Don't cycle through all the servers when the connection fails."));
|
||||
@@ -2061,12 +1972,8 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
SERVLIST_X_PADDING, SERVLIST_Y_PADDING);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label_logintype, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label_logintype, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label_logintype), 0, 0.5);
|
||||
#endif
|
||||
combobox_logintypes = servlist_create_logintypecombo (notebook);
|
||||
servlist_table_attach (table3, combobox_logintypes, 1, 2, 10, 11,
|
||||
FALSE, FALSE,
|
||||
@@ -2083,12 +1990,8 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
SERVLIST_X_PADDING, SERVLIST_Y_PADDING);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label34, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label34, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label34), 0, 0.5);
|
||||
#endif
|
||||
comboboxentry_charset = servlist_create_charsetcombo ();
|
||||
servlist_table_attach (table3, comboboxentry_charset, 1, 2, 12, 13,
|
||||
FALSE, FALSE,
|
||||
@@ -2097,28 +2000,14 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
|
||||
|
||||
|
||||
/* Rule and Close button */
|
||||
#if HAVE_GTK3
|
||||
hseparator2 = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
#elif !HAVE_GTK3
|
||||
hseparator2 = gtk_hseparator_new ();
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox5), hseparator2, FALSE, FALSE, 8);
|
||||
|
||||
#if HAVE_GTK3
|
||||
hbuttonbox4 = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox4), GTK_BUTTONBOX_END);
|
||||
#elif !HAVE_GTK3
|
||||
hbuttonbox4 = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox4), GTK_BUTTONBOX_END);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox5), hbuttonbox4, FALSE, FALSE, 0);
|
||||
|
||||
#if HAVE_GTK3
|
||||
button10 = servlist_icon_button_new (_("_Close"), ICON_SERVLIST_CLOSE);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
button10 = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
|
||||
#endif
|
||||
g_signal_connect (G_OBJECT (button10), "clicked",
|
||||
G_CALLBACK (servlist_edit_close_cb), 0);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox4), button10);
|
||||
@@ -2203,13 +2092,8 @@ servlist_open_networks (void)
|
||||
gtk_widget_show (table1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table1), 8);
|
||||
#if HAVE_GTK3
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table1), 2);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table1), 4);
|
||||
#else
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table1), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table1), 4);
|
||||
#endif
|
||||
|
||||
label3 = gtk_label_new_with_mnemonic (_("_Nick name:"));
|
||||
gtk_widget_show (label3);
|
||||
@@ -2217,12 +2101,8 @@ servlist_open_networks (void)
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
0, 0);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label3, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label3, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);
|
||||
#endif
|
||||
|
||||
label4 = gtk_label_new (_("Second choice:"));
|
||||
gtk_widget_show (label4);
|
||||
@@ -2230,12 +2110,8 @@ servlist_open_networks (void)
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
0, 0);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label4, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label4, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
|
||||
#endif
|
||||
|
||||
label5 = gtk_label_new (_("Third choice:"));
|
||||
gtk_widget_show (label5);
|
||||
@@ -2243,12 +2119,8 @@ servlist_open_networks (void)
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
0, 0);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label5, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label5, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);
|
||||
#endif
|
||||
|
||||
label6 = gtk_label_new_with_mnemonic (_("_User name:"));
|
||||
gtk_widget_show (label6);
|
||||
@@ -2256,12 +2128,8 @@ servlist_open_networks (void)
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
0, 0);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label6, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label6, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
|
||||
#endif
|
||||
|
||||
/* label7 = gtk_label_new_with_mnemonic (_("Rea_l name:"));
|
||||
gtk_widget_show (label7);
|
||||
@@ -2320,13 +2188,8 @@ servlist_open_networks (void)
|
||||
gtk_widget_show (table4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), table4, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table4), 8);
|
||||
#if HAVE_GTK3
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table4), 2);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table4), 3);
|
||||
#else
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table4), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table4), 3);
|
||||
#endif
|
||||
|
||||
scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow3);
|
||||
@@ -2385,11 +2248,7 @@ servlist_open_networks (void)
|
||||
G_CALLBACK (fav_servlist), 0);
|
||||
gtk_widget_show (checkbutton_fav);
|
||||
|
||||
#if HAVE_GTK3
|
||||
vbuttonbox2 = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
|
||||
#elif !HAVE_GTK3
|
||||
vbuttonbox2 = gtk_vbutton_box_new ();
|
||||
#endif
|
||||
gtk_box_set_spacing (GTK_BOX (vbuttonbox2), 3);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox2), GTK_BUTTONBOX_START);
|
||||
gtk_widget_show (vbuttonbox2);
|
||||
@@ -2398,24 +2257,14 @@ servlist_open_networks (void)
|
||||
SERVLIST_ALIGN_FILL, SERVLIST_ALIGN_FILL,
|
||||
0, 0);
|
||||
|
||||
#if HAVE_GTK3
|
||||
button_add = servlist_icon_button_new (_("_Add"), ICON_SERVLIST_ADD);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
button_add = gtk_button_new_from_stock (GTK_STOCK_ADD);
|
||||
#endif
|
||||
g_signal_connect (G_OBJECT (button_add), "clicked",
|
||||
G_CALLBACK (servlist_addnet_cb), networks_tree);
|
||||
gtk_widget_show (button_add);
|
||||
gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_add);
|
||||
gtk_widget_set_can_default (button_add, TRUE);
|
||||
|
||||
#if HAVE_GTK3
|
||||
button_remove = servlist_icon_button_new (_("_Remove"), ICON_SERVLIST_REMOVE);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
button_remove = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
|
||||
#endif
|
||||
g_signal_connect (G_OBJECT (button_remove), "clicked",
|
||||
G_CALLBACK (servlist_deletenet_cb), 0);
|
||||
gtk_widget_show (button_remove);
|
||||
@@ -2446,31 +2295,17 @@ servlist_open_networks (void)
|
||||
gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_sort);
|
||||
gtk_widget_set_can_default (button_sort, TRUE);
|
||||
|
||||
#if HAVE_GTK3
|
||||
hseparator1 = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
#elif !HAVE_GTK3
|
||||
hseparator1 = gtk_hseparator_new ();
|
||||
#endif
|
||||
gtk_widget_show (hseparator1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, FALSE, TRUE, 4);
|
||||
|
||||
#if HAVE_GTK3
|
||||
hbuttonbox1 = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
hbuttonbox1 = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_widget_show (hbuttonbox1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, FALSE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbuttonbox1), 8);
|
||||
|
||||
#if HAVE_GTK3
|
||||
button_close = servlist_icon_button_new (_("_Close"), ICON_SERVLIST_CLOSE);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
button_close = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
|
||||
#endif
|
||||
gtk_widget_show (button_close);
|
||||
g_signal_connect (G_OBJECT (button_close), "clicked",
|
||||
G_CALLBACK (servlist_close_cb), 0);
|
||||
|
||||
@@ -713,7 +713,6 @@ typedef enum
|
||||
SETUP_ALIGN_FILL
|
||||
} setup_align;
|
||||
|
||||
#if HAVE_GTK3
|
||||
static GtkAlign
|
||||
setup_align_to_gtk (setup_align align)
|
||||
{
|
||||
@@ -728,7 +727,6 @@ setup_align_to_gtk (setup_align align)
|
||||
return GTK_ALIGN_START;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
setup_table_attach (GtkWidget *table, GtkWidget *child,
|
||||
@@ -738,7 +736,6 @@ setup_table_attach (GtkWidget *table, GtkWidget *child,
|
||||
setup_align halign, setup_align valign,
|
||||
guint xpad, guint ypad)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_hexpand (child, hexpand);
|
||||
gtk_widget_set_vexpand (child, vexpand);
|
||||
gtk_widget_set_halign (child, setup_align_to_gtk (halign));
|
||||
@@ -750,28 +747,6 @@ setup_table_attach (GtkWidget *table, GtkWidget *child,
|
||||
|
||||
gtk_grid_attach (GTK_GRID (table), child, left_attach, top_attach,
|
||||
right_attach - left_attach, bottom_attach - top_attach);
|
||||
#else
|
||||
GtkAttachOptions xoptions = 0;
|
||||
GtkAttachOptions yoptions = 0;
|
||||
|
||||
if (hexpand)
|
||||
xoptions |= GTK_EXPAND;
|
||||
else
|
||||
xoptions |= GTK_SHRINK;
|
||||
if (halign == SETUP_ALIGN_FILL)
|
||||
xoptions |= GTK_FILL;
|
||||
|
||||
if (vexpand)
|
||||
yoptions |= GTK_EXPAND;
|
||||
else
|
||||
yoptions |= GTK_SHRINK;
|
||||
if (valign == SETUP_ALIGN_FILL)
|
||||
yoptions |= GTK_FILL;
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), child, left_attach, right_attach,
|
||||
top_attach, bottom_attach, xoptions, yoptions,
|
||||
xpad, ypad);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -795,12 +770,8 @@ setup_headlabel (GtkWidget *tab, int row, int col, char *text)
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), buf);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (tab, label, col, col + 1, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER, 4, 0);
|
||||
}
|
||||
@@ -822,12 +793,8 @@ setup_create_3oggle (GtkWidget *tab, int row, const setting *set)
|
||||
int *offsets = (int *)set->list;
|
||||
|
||||
label = gtk_label_new (_(set->label));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
if (set->tooltip)
|
||||
{
|
||||
gtk_widget_set_tooltip_text (label, _(set->tooltip));
|
||||
@@ -942,36 +909,20 @@ static GtkWidget *
|
||||
setup_create_spin (GtkWidget *table, int row, const setting *set)
|
||||
{
|
||||
GtkWidget *label, *wid, *rbox;
|
||||
#if !HAVE_GTK3
|
||||
GtkWidget *align;
|
||||
#endif
|
||||
char *text;
|
||||
|
||||
label = gtk_label_new (_(set->label));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (table, label, 2, 3, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
|
||||
#if HAVE_GTK3
|
||||
rbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
gtk_widget_set_halign (rbox, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (rbox, GTK_ALIGN_CENTER);
|
||||
setup_table_attach (table, rbox, 3, 4, row, row + 1, TRUE, FALSE,
|
||||
SETUP_ALIGN_FILL, SETUP_ALIGN_FILL, 0, 0);
|
||||
#elif !HAVE_GTK3
|
||||
align = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
setup_table_attach (table, align, 3, 4, row, row + 1, TRUE, FALSE,
|
||||
SETUP_ALIGN_FILL, SETUP_ALIGN_FILL, 0, 0);
|
||||
|
||||
rbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (align), rbox);
|
||||
#endif
|
||||
|
||||
wid = gtk_spin_button_new_with_range (0, set->extra, 1);
|
||||
g_object_set_data (G_OBJECT (wid), "lbl", label);
|
||||
@@ -1027,21 +978,13 @@ setup_create_hscale (GtkWidget *table, int row, const setting *set)
|
||||
GtkWidget *wid;
|
||||
|
||||
wid = gtk_label_new (_(set->label));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (wid, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (wid, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (wid), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (table, wid, 2, 3, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
|
||||
#if HAVE_GTK3
|
||||
wid = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0., 255., 1.);
|
||||
#elif !HAVE_GTK3
|
||||
wid = gtk_hscale_new_with_range (0., 255., 1.);
|
||||
#endif
|
||||
gtk_scale_set_value_pos (GTK_SCALE (wid), GTK_POS_RIGHT);
|
||||
gtk_range_set_value (GTK_RANGE (wid), setup_get_int (&setup_prefs, set));
|
||||
g_signal_connect (G_OBJECT(wid), "value_changed",
|
||||
@@ -1096,21 +1039,13 @@ setup_create_radio (GtkWidget *table, int row, const setting *set)
|
||||
GSList *group;
|
||||
|
||||
wid = gtk_label_new (_(set->label));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (wid, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (wid, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (wid), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (table, wid, 2, 3, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
|
||||
#if HAVE_GTK3
|
||||
hbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
#elif !HAVE_GTK3
|
||||
hbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
#endif
|
||||
setup_table_attach (table, hbox, 3, 4, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_FILL, SETUP_ALIGN_FILL, 0, 0);
|
||||
|
||||
@@ -1169,12 +1104,8 @@ setup_create_id_menu (GtkWidget *table, char *label, int row, char *dest)
|
||||
};
|
||||
|
||||
wid = gtk_label_new (label);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (wid, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (wid, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (wid), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (table, wid, 2, 3, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
@@ -1221,12 +1152,8 @@ setup_create_menu (GtkWidget *table, int row, const setting *set)
|
||||
int i;
|
||||
|
||||
wid = gtk_label_new (_(set->label));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (wid, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (wid, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (wid), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (table, wid, 2, 3, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
@@ -1241,11 +1168,7 @@ setup_create_menu (GtkWidget *table, int row, const setting *set)
|
||||
g_signal_connect (G_OBJECT (cbox), "changed",
|
||||
G_CALLBACK (setup_menu_cb), (gpointer)set);
|
||||
|
||||
#if HAVE_GTK3
|
||||
box = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
#elif !HAVE_GTK3
|
||||
box = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (box), cbox, 0, 0, 0);
|
||||
setup_table_attach (table, box, 3, 4, row, row + 1, TRUE, FALSE,
|
||||
SETUP_ALIGN_FILL, SETUP_ALIGN_FILL, 0, 0);
|
||||
@@ -1279,38 +1202,7 @@ setup_browsefile_cb (GtkWidget *button, GtkWidget *entry)
|
||||
entry, NULL, filter, filter_type|FRF_RECENTLYUSED|FRF_MODAL);
|
||||
}
|
||||
|
||||
#if !HAVE_GTK3
|
||||
static void
|
||||
setup_fontsel_destroy (GtkWidget *button, GtkFontSelectionDialog *dialog)
|
||||
{
|
||||
font_dialog = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_fontsel_cb (GtkWidget *button, GtkFontSelectionDialog *dialog)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
char *font_name;
|
||||
|
||||
entry = g_object_get_data (G_OBJECT (button), "e");
|
||||
font_name = gtk_font_selection_dialog_get_font_name (dialog);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), font_name);
|
||||
|
||||
g_free (font_name);
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
font_dialog = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_fontsel_cancel (GtkWidget *button, GtkFontSelectionDialog *dialog)
|
||||
{
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
font_dialog = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
static void
|
||||
setup_fontchooser_response (GtkDialog *dialog, gint response, GtkWidget *entry)
|
||||
{
|
||||
@@ -1329,7 +1221,6 @@ setup_fontchooser_response (GtkDialog *dialog, gint response, GtkWidget *entry)
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
font_dialog = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
setup_browsefolder_cb (GtkWidget *button, GtkEntry *entry)
|
||||
@@ -1340,7 +1231,6 @@ setup_browsefolder_cb (GtkWidget *button, GtkEntry *entry)
|
||||
static void
|
||||
setup_browsefont_cb (GtkWidget *button, GtkWidget *entry)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *dialog;
|
||||
const char *font_name;
|
||||
|
||||
@@ -1357,34 +1247,6 @@ setup_browsefont_cb (GtkWidget *button, GtkWidget *entry)
|
||||
G_CALLBACK (setup_fontchooser_response), entry);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
#elif !HAVE_GTK3
|
||||
GtkFontSelection *sel;
|
||||
GtkFontSelectionDialog *dialog;
|
||||
GtkWidget *ok_button;
|
||||
|
||||
dialog = (GtkFontSelectionDialog *) gtk_font_selection_dialog_new (_("Select font"));
|
||||
font_dialog = (GtkWidget *)dialog; /* global var */
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (font_dialog), GTK_WINDOW (setup_window));
|
||||
gtk_window_set_modal (GTK_WINDOW (font_dialog), TRUE);
|
||||
|
||||
sel = (GtkFontSelection *) gtk_font_selection_dialog_get_font_selection (dialog);
|
||||
|
||||
if (gtk_entry_get_text (GTK_ENTRY (entry))[0])
|
||||
gtk_font_selection_set_font_name (sel, gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
|
||||
ok_button = gtk_font_selection_dialog_get_ok_button (dialog);
|
||||
g_object_set_data (G_OBJECT (ok_button), "e", entry);
|
||||
|
||||
g_signal_connect (G_OBJECT (dialog), "destroy",
|
||||
G_CALLBACK (setup_fontsel_destroy), dialog);
|
||||
g_signal_connect (G_OBJECT (ok_button), "clicked",
|
||||
G_CALLBACK (setup_fontsel_cb), dialog);
|
||||
g_signal_connect (G_OBJECT (gtk_font_selection_dialog_get_cancel_button (dialog)), "clicked",
|
||||
G_CALLBACK (setup_fontsel_cancel), dialog);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (dialog));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1434,12 +1296,8 @@ setup_create_entry (GtkWidget *table, int row, const setting *set)
|
||||
GtkWidget *wid, *bwid;
|
||||
|
||||
label = gtk_label_new (_(set->label));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (table, label, 2, 3, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
@@ -1503,12 +1361,8 @@ setup_create_header (GtkWidget *table, int row, char *labeltext)
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), buf);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (table, label, 0, 4, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER, 0, 5);
|
||||
}
|
||||
@@ -1529,13 +1383,8 @@ setup_create_frame (void)
|
||||
|
||||
tab = gtkutil_grid_new (3, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (tab), 6);
|
||||
#if HAVE_GTK3
|
||||
gtk_grid_set_row_spacing (GTK_GRID (tab), 2);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (tab), 3);
|
||||
#else
|
||||
gtk_table_set_row_spacings (GTK_TABLE (tab), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (tab), 3);
|
||||
#endif
|
||||
|
||||
return tab;
|
||||
}
|
||||
@@ -1656,12 +1505,8 @@ setup_create_dark_mode_menu (GtkWidget *table, int row, const setting *set)
|
||||
int i;
|
||||
|
||||
wid = gtk_label_new (_(set->label));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (wid, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (wid, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (wid), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (table, wid, 2, 3, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
@@ -1676,11 +1521,7 @@ setup_create_dark_mode_menu (GtkWidget *table, int row, const setting *set)
|
||||
g_signal_connect (G_OBJECT (cbox), "changed",
|
||||
G_CALLBACK (setup_dark_mode_menu_cb), (gpointer)set);
|
||||
|
||||
#if HAVE_GTK3
|
||||
box = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
#elif !HAVE_GTK3
|
||||
box = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (box), cbox, 0, 0, 0);
|
||||
setup_table_attach (table, box, 3, 4, row, row + 1, TRUE, FALSE,
|
||||
SETUP_ALIGN_FILL, SETUP_ALIGN_FILL, 0, 0);
|
||||
@@ -1693,36 +1534,15 @@ setup_color_button_apply (GtkWidget *button, const PaletteColor *color)
|
||||
{
|
||||
GtkWidget *target = g_object_get_data (G_OBJECT (button), "zoitechat-color-box");
|
||||
GtkWidget *apply_widget = GTK_IS_WIDGET (target) ? target : button;
|
||||
#if !HAVE_GTK3
|
||||
GtkStateType states[] = {
|
||||
GTK_STATE_NORMAL,
|
||||
GTK_STATE_PRELIGHT,
|
||||
GTK_STATE_ACTIVE,
|
||||
GTK_STATE_SELECTED,
|
||||
GTK_STATE_INSENSITIVE
|
||||
};
|
||||
guint i;
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtkutil_apply_palette (apply_widget, color, NULL, NULL);
|
||||
#else
|
||||
for (i = 0; i < G_N_ELEMENTS (states); i++)
|
||||
gtk_widget_modify_bg (apply_widget, states[i], color);
|
||||
#endif
|
||||
|
||||
if (apply_widget != button)
|
||||
#if HAVE_GTK3
|
||||
gtkutil_apply_palette (button, color, NULL, NULL);
|
||||
#else
|
||||
for (i = 0; i < G_N_ELEMENTS (states); i++)
|
||||
gtk_widget_modify_bg (button, states[i], color);
|
||||
#endif
|
||||
|
||||
gtk_widget_queue_draw (button);
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *button;
|
||||
@@ -1770,42 +1590,10 @@ setup_color_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
g_free (data);
|
||||
}
|
||||
#else
|
||||
static void
|
||||
setup_color_ok_cb (GtkWidget *button, GtkWidget *dialog)
|
||||
{
|
||||
GtkColorSelectionDialog *cdialog = GTK_COLOR_SELECTION_DIALOG (dialog);
|
||||
PaletteColor *col;
|
||||
col = g_object_get_data (G_OBJECT (button), "c");
|
||||
|
||||
button = g_object_get_data (G_OBJECT (button), "b");
|
||||
|
||||
if (!GTK_IS_WIDGET (button))
|
||||
{
|
||||
gtk_widget_destroy (dialog);
|
||||
return;
|
||||
}
|
||||
|
||||
color_change = TRUE;
|
||||
|
||||
gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (cdialog)), col);
|
||||
|
||||
setup_color_button_apply (button, col);
|
||||
|
||||
/* Persist custom colors for the palette the user is editing. */
|
||||
if (fe_dark_mode_is_enabled_for (setup_prefs.hex_gui_dark_mode))
|
||||
palette_dark_set_color ((int)(col - colors), col);
|
||||
else
|
||||
palette_user_set_color ((int)(col - colors), col);
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
setup_color_cb (GtkWidget *button, gpointer userdata)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *dialog;
|
||||
PaletteColor *color;
|
||||
GdkRGBA rgba;
|
||||
@@ -1823,37 +1611,6 @@ setup_color_cb (GtkWidget *button, gpointer userdata)
|
||||
data->color = color;
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (setup_color_response_cb), data);
|
||||
gtk_widget_show (dialog);
|
||||
#else
|
||||
GtkWidget *dialog, *cancel_button, *ok_button, *help_button;
|
||||
GtkColorSelectionDialog *cdialog;
|
||||
PaletteColor *color;
|
||||
|
||||
color = &colors[GPOINTER_TO_INT (userdata)];
|
||||
|
||||
dialog = gtk_color_selection_dialog_new (_("Select color"));
|
||||
cdialog = GTK_COLOR_SELECTION_DIALOG (dialog);
|
||||
|
||||
g_object_get (G_OBJECT(cdialog), "cancel-button", &cancel_button,
|
||||
"ok-button", &ok_button,
|
||||
"help-button", &help_button, NULL);
|
||||
|
||||
gtk_widget_hide (help_button);
|
||||
g_signal_connect (G_OBJECT (ok_button), "clicked",
|
||||
G_CALLBACK (setup_color_ok_cb), dialog);
|
||||
g_signal_connect (G_OBJECT (cancel_button), "clicked",
|
||||
G_CALLBACK (gtkutil_destroy), dialog);
|
||||
g_object_set_data (G_OBJECT (ok_button), "c", color);
|
||||
g_object_set_data (G_OBJECT (ok_button), "b", button);
|
||||
gtk_widget_set_sensitive (help_button, FALSE);
|
||||
gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (cdialog)), color);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (setup_window));
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
g_object_unref (cancel_button);
|
||||
g_object_unref (ok_button);
|
||||
g_object_unref (help_button);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1862,9 +1619,6 @@ setup_create_color_button (GtkWidget *table, int num, int row, int col)
|
||||
GtkWidget *but;
|
||||
GtkWidget *label;
|
||||
GtkWidget *box;
|
||||
#if !HAVE_GTK3
|
||||
GtkWidget *alignment;
|
||||
#endif
|
||||
char buf[64];
|
||||
|
||||
if (num > 31)
|
||||
@@ -1881,17 +1635,8 @@ setup_create_color_button (GtkWidget *table, int num, int row, int col)
|
||||
gtk_event_box_set_visible_window (GTK_EVENT_BOX (box), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
gtk_container_add (GTK_CONTAINER (but), box);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
|
||||
#else
|
||||
alignment = gtk_bin_get_child (GTK_BIN (but));
|
||||
if (GTK_IS_ALIGNMENT (alignment))
|
||||
{
|
||||
gtk_alignment_set (GTK_ALIGNMENT (alignment), 0.5, 0.5, 1.0, 1.0);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (box);
|
||||
/* win32 build uses this to turn off themeing */
|
||||
@@ -1913,12 +1658,8 @@ setup_create_other_colorR (char *text, int num, int row, GtkWidget *tab)
|
||||
GtkWidget *label;
|
||||
|
||||
label = gtk_label_new (text);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (tab, label, 5, 9, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
@@ -1931,12 +1672,8 @@ setup_create_other_color (char *text, int num, int row, GtkWidget *tab)
|
||||
GtkWidget *label;
|
||||
|
||||
label = gtk_label_new (text);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (tab, label, 2, 3, row, row + 1, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
@@ -1956,24 +1693,15 @@ setup_create_color_page (void)
|
||||
|
||||
tab = gtkutil_grid_new (9, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (tab), 6);
|
||||
#if HAVE_GTK3
|
||||
gtk_grid_set_row_spacing (GTK_GRID (tab), 2);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (tab), 3);
|
||||
#else
|
||||
gtk_table_set_row_spacings (GTK_TABLE (tab), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (tab), 3);
|
||||
#endif
|
||||
gtk_container_add (GTK_CONTAINER (box), tab);
|
||||
|
||||
setup_create_header (tab, 0, N_("Text Colors"));
|
||||
|
||||
label = gtk_label_new (_("mIRC colors:"));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (tab, label, 2, 3, 1, 2, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
@@ -1982,12 +1710,8 @@ setup_create_color_page (void)
|
||||
setup_create_color_button (tab, i, 1, i+3);
|
||||
|
||||
label = gtk_label_new (_("Local colors:"));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (tab, label, 2, 3, 2, 3, FALSE, FALSE,
|
||||
SETUP_ALIGN_START, SETUP_ALIGN_CENTER,
|
||||
LABEL_INDENT, 0);
|
||||
@@ -2016,12 +1740,8 @@ setup_create_color_page (void)
|
||||
setup_create_header (tab, 15, N_("Color Stripping"));
|
||||
|
||||
/* label = gtk_label_new (_("Strip colors from:"));
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
setup_table_attach (tab, label, 2, 3, 16, 17, FALSE, FALSE,
|
||||
SETUP_ALIGN_FILL, SETUP_ALIGN_FILL,
|
||||
LABEL_INDENT, 0); */
|
||||
@@ -2171,11 +1891,7 @@ setup_create_theme_page (void)
|
||||
|
||||
ui = g_new0 (setup_theme_ui, 1);
|
||||
|
||||
#if HAVE_GTK3
|
||||
box = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 6);
|
||||
#elif !HAVE_GTK3
|
||||
box = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 6);
|
||||
#endif
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 6);
|
||||
|
||||
themes_dir = g_build_filename (get_xdir (), "themes", NULL);
|
||||
@@ -2183,21 +1899,13 @@ setup_create_theme_page (void)
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), markup);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
|
||||
g_free (markup);
|
||||
g_free (themes_dir);
|
||||
|
||||
#if HAVE_GTK3
|
||||
hbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 6);
|
||||
#elif !HAVE_GTK3
|
||||
hbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 6);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
|
||||
|
||||
ui->combo = gtk_combo_box_text_new ();
|
||||
@@ -2205,11 +1913,7 @@ setup_create_theme_page (void)
|
||||
g_signal_connect (G_OBJECT (ui->combo), "changed",
|
||||
G_CALLBACK (setup_theme_selection_changed), ui);
|
||||
|
||||
#if HAVE_GTK3
|
||||
button_box = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 6);
|
||||
#elif !HAVE_GTK3
|
||||
button_box = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 6);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button_box, FALSE, FALSE, 0);
|
||||
|
||||
ui->apply_button = gtk_button_new_with_mnemonic (_("_Apply Theme"));
|
||||
@@ -2228,12 +1932,8 @@ setup_create_theme_page (void)
|
||||
G_CALLBACK (setup_theme_open_folder_cb), ui);
|
||||
|
||||
ui->status_label = gtk_label_new (NULL);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (ui->status_label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (ui->status_label, GTK_ALIGN_CENTER);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (ui->status_label), 0.0, 0.5);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (box), ui->status_label, FALSE, FALSE, 0);
|
||||
|
||||
setup_theme_populate (ui);
|
||||
@@ -2426,19 +2126,11 @@ setup_create_sound_page (void)
|
||||
GtkWidget *sound_play;
|
||||
GtkTreeSelection *sel;
|
||||
|
||||
#if HAVE_GTK3
|
||||
vbox1 = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||
#elif !HAVE_GTK3
|
||||
vbox1 = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||
#endif
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox1), 6);
|
||||
gtk_widget_show (vbox1);
|
||||
|
||||
#if HAVE_GTK3
|
||||
vbox2 = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||
#elif !HAVE_GTK3
|
||||
vbox2 = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||
#endif
|
||||
gtk_widget_show (vbox2);
|
||||
gtk_container_add (GTK_CONTAINER (vbox1), vbox2);
|
||||
|
||||
@@ -2464,13 +2156,8 @@ setup_create_sound_page (void)
|
||||
table1 = gtkutil_grid_new (2, 3, FALSE);
|
||||
gtk_widget_show (table1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), table1, FALSE, TRUE, 8);
|
||||
#if HAVE_GTK3
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table1), 2);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table1), 4);
|
||||
#else
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table1), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table1), 4);
|
||||
#endif
|
||||
|
||||
sound_label = gtk_label_new_with_mnemonic (_("Sound file:"));
|
||||
gtk_widget_show (sound_label);
|
||||
@@ -2510,27 +2197,18 @@ setup_add_page (const char *title, GtkWidget *book, GtkWidget *tab)
|
||||
GtkScrolledWindow *sw;
|
||||
char buf[128];
|
||||
|
||||
#if HAVE_GTK3
|
||||
vvbox = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||
#elif !HAVE_GTK3
|
||||
vvbox = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||
#endif
|
||||
|
||||
/* label */
|
||||
label = gtk_label_new (NULL);
|
||||
g_snprintf (buf, sizeof (buf), "<b><big>%s</big></b>", _(title));
|
||||
gtk_label_set_markup (GTK_LABEL (label), buf);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_margin_start (label, 2);
|
||||
gtk_widget_set_margin_end (label, 2);
|
||||
gtk_widget_set_margin_top (label, 1);
|
||||
gtk_widget_set_margin_bottom (label, 1);
|
||||
#elif !HAVE_GTK3
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_misc_set_padding (GTK_MISC (label), 2, 1);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vvbox), label, FALSE, FALSE, 2);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vvbox), tab);
|
||||
@@ -2732,14 +2410,8 @@ setup_create_tree (GtkWidget *box, GtkWidget *book)
|
||||
static void
|
||||
setup_apply_entry_style (GtkWidget *entry)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtkutil_apply_palette (entry, &colors[COL_BG], &colors[COL_FG],
|
||||
input_style->font_desc);
|
||||
#else
|
||||
gtk_widget_modify_base (entry, GTK_STATE_NORMAL, &colors[COL_BG]);
|
||||
gtk_widget_modify_text (entry, GTK_STATE_NORMAL, &colors[COL_FG]);
|
||||
gtk_widget_modify_font (entry, input_style->font_desc);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2748,12 +2420,7 @@ setup_apply_to_sess (session_gui *gui)
|
||||
mg_update_xtext (gui->xtext);
|
||||
chanview_apply_theme ((chanview *) gui->chanview);
|
||||
|
||||
#if !HAVE_GTK3
|
||||
if (prefs.hex_gui_ulist_style)
|
||||
gtk_widget_modify_font (gui->user_tree, input_style->font_desc);
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
const PaletteColor *bg = NULL;
|
||||
const PaletteColor *fg = NULL;
|
||||
@@ -2768,25 +2435,9 @@ setup_apply_to_sess (session_gui *gui)
|
||||
|
||||
gtkutil_apply_palette (gui->user_tree, bg, fg, font);
|
||||
}
|
||||
#else
|
||||
if (prefs.hex_gui_ulist_style || fe_dark_mode_is_enabled ())
|
||||
{
|
||||
gtk_widget_modify_base (gui->user_tree, GTK_STATE_NORMAL, &colors[COL_BG]);
|
||||
if (fe_dark_mode_is_enabled ())
|
||||
gtk_widget_modify_text (gui->user_tree, GTK_STATE_NORMAL, &colors[COL_FG]);
|
||||
else
|
||||
gtk_widget_modify_text (gui->user_tree, GTK_STATE_NORMAL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_modify_base (gui->user_tree, GTK_STATE_NORMAL, NULL);
|
||||
gtk_widget_modify_text (gui->user_tree, GTK_STATE_NORMAL, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (prefs.hex_gui_input_style)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
char buf[128];
|
||||
GtkCssProvider *provider = gtk_css_provider_new ();
|
||||
GtkStyleContext *context;
|
||||
@@ -2811,15 +2462,6 @@ setup_apply_to_sess (session_gui *gui)
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
g_object_unref (provider);
|
||||
#else
|
||||
extern char cursor_color_rc[];
|
||||
char buf[256];
|
||||
sprintf (buf, cursor_color_rc,
|
||||
(colors[COL_FG].red >> 8),
|
||||
(colors[COL_FG].green >> 8),
|
||||
(colors[COL_FG].blue >> 8));
|
||||
gtk_rc_parse_string (buf);
|
||||
#endif
|
||||
|
||||
setup_apply_entry_style (gui->input_box);
|
||||
setup_apply_entry_style (gui->limit_entry);
|
||||
@@ -3076,31 +2718,18 @@ setup_window_open (void)
|
||||
g_snprintf(buf, sizeof(buf), _("Preferences - %s"), _(DISPLAY_NAME));
|
||||
win = gtkutil_window_new (buf, "prefs", 0, 600, 2);
|
||||
|
||||
#if HAVE_GTK3
|
||||
vbox = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 5);
|
||||
#elif !HAVE_GTK3
|
||||
vbox = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 5);
|
||||
#endif
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
||||
gtk_container_add (GTK_CONTAINER (win), vbox);
|
||||
|
||||
#if HAVE_GTK3
|
||||
hbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 4);
|
||||
#elif !HAVE_GTK3
|
||||
hbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 4);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
|
||||
setup_create_tree (hbox, setup_create_pages (hbox));
|
||||
|
||||
/* prepare the button box */
|
||||
#if HAVE_GTK3
|
||||
hbbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbbox), GTK_BUTTONBOX_END);
|
||||
#elif !HAVE_GTK3
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbbox), GTK_BUTTONBOX_END);
|
||||
#endif
|
||||
gtk_box_set_spacing (GTK_BOX (hbbox), 4);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbbox, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
@@ -51,13 +51,6 @@
|
||||
#include "xtext.h"
|
||||
#include "gtkutil.h"
|
||||
|
||||
#ifndef HAVE_GTK3
|
||||
#if GTK_MAJOR_VERSION >= 3
|
||||
#define HAVE_GTK3 1
|
||||
#else
|
||||
#define HAVE_GTK3 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ICON_ADD "zc-menu-add"
|
||||
#define ICON_REMOVE "zc-menu-remove"
|
||||
@@ -108,21 +101,11 @@ struct _SexySpellEntryPriv
|
||||
};
|
||||
|
||||
static void sexy_spell_entry_class_init(SexySpellEntryClass *klass);
|
||||
#if HAVE_GTK3
|
||||
static void sexy_spell_entry_editable_init (GtkEditableInterface *iface);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
static void sexy_spell_entry_editable_init (GtkEditableClass *iface);
|
||||
#endif
|
||||
static void sexy_spell_entry_init(SexySpellEntry *entry);
|
||||
static void sexy_spell_entry_finalize(GObject *obj);
|
||||
static void sexy_spell_entry_destroy(GObject *obj);
|
||||
#if HAVE_GTK3
|
||||
static gboolean sexy_spell_entry_draw(GtkWidget *widget, cairo_t *cr);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
static gint sexy_spell_entry_expose(GtkWidget *widget, GdkEventExpose *event);
|
||||
#endif
|
||||
static gint sexy_spell_entry_button_press(GtkWidget *widget, GdkEventButton *event);
|
||||
|
||||
/* GtkEditable handlers */
|
||||
@@ -266,12 +249,7 @@ sexy_spell_entry_class_init(SexySpellEntryClass *klass)
|
||||
|
||||
object_class->dispose = sexy_spell_entry_destroy;
|
||||
|
||||
#if HAVE_GTK3
|
||||
widget_class->draw = sexy_spell_entry_draw;
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
widget_class->expose_event = sexy_spell_entry_expose;
|
||||
#endif
|
||||
widget_class->button_press_event = sexy_spell_entry_button_press;
|
||||
|
||||
/**
|
||||
@@ -302,19 +280,11 @@ sexy_spell_entry_class_init(SexySpellEntryClass *klass)
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
static void
|
||||
sexy_spell_entry_editable_init (GtkEditableInterface *iface)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_GTK3
|
||||
static void
|
||||
sexy_spell_entry_editable_init (GtkEditableClass *iface)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static gint
|
||||
gtk_entry_find_position (GtkEntry *entry, gint x)
|
||||
@@ -327,7 +297,6 @@ gtk_entry_find_position (GtkEntry *entry, gint x)
|
||||
gint pos;
|
||||
gboolean trailing;
|
||||
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
gint layout_x;
|
||||
gint layout_y;
|
||||
@@ -335,35 +304,16 @@ gtk_entry_find_position (GtkEntry *entry, gint x)
|
||||
gtk_entry_get_layout_offsets(entry, &layout_x, &layout_y);
|
||||
x -= layout_x;
|
||||
}
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
x = x + entry->scroll_offset;
|
||||
#endif
|
||||
|
||||
layout = gtk_entry_get_layout(entry);
|
||||
text = pango_layout_get_text(layout);
|
||||
#if HAVE_GTK3
|
||||
cursor_index = g_utf8_offset_to_pointer(
|
||||
text,
|
||||
gtk_editable_get_position(GTK_EDITABLE(entry))) - text;
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
cursor_index = g_utf8_offset_to_pointer(text, entry->current_pos) - text;
|
||||
#endif
|
||||
|
||||
line = pango_layout_get_lines(layout)->data;
|
||||
pango_layout_line_x_to_index(line, x * PANGO_SCALE, &index, &trailing);
|
||||
|
||||
#if !HAVE_GTK3
|
||||
if (index >= cursor_index && entry->preedit_length) {
|
||||
if (index >= cursor_index + entry->preedit_length) {
|
||||
index -= entry->preedit_length;
|
||||
} else {
|
||||
index = cursor_index;
|
||||
trailing = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pos = g_utf8_pointer_to_offset (text, text + index);
|
||||
pos += trailing;
|
||||
@@ -718,7 +668,6 @@ static GtkWidget *
|
||||
sexy_spell_entry_icon_menu_item (const char *label, const char *stock_name)
|
||||
{
|
||||
GtkWidget *item;
|
||||
#if HAVE_GTK3
|
||||
const char *icon_name;
|
||||
GtkWidget *box;
|
||||
GtkWidget *image = NULL;
|
||||
@@ -736,13 +685,6 @@ sexy_spell_entry_icon_menu_item (const char *label, const char *stock_name)
|
||||
gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), label_widget, FALSE, FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (item), box);
|
||||
#else
|
||||
GtkWidget *image;
|
||||
|
||||
item = gtk_image_menu_item_new_with_label (label);
|
||||
image = gtkutil_image_new_from_stock (stock_name, GTK_ICON_SIZE_MENU);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
|
||||
#endif
|
||||
|
||||
return item;
|
||||
}
|
||||
@@ -1244,7 +1186,6 @@ sexy_spell_entry_recheck_all(SexySpellEntry *entry)
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
static gboolean
|
||||
sexy_spell_entry_draw(GtkWidget *widget, cairo_t *cr)
|
||||
{
|
||||
@@ -1257,29 +1198,7 @@ sexy_spell_entry_draw(GtkWidget *widget, cairo_t *cr)
|
||||
|
||||
return GTK_WIDGET_CLASS(parent_class)->draw (widget, cr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_GTK3
|
||||
static gint
|
||||
sexy_spell_entry_expose(GtkWidget *widget, GdkEventExpose *event)
|
||||
{
|
||||
SexySpellEntry *entry = SEXY_SPELL_ENTRY(widget);
|
||||
GtkEntry *gtk_entry = GTK_ENTRY(widget);
|
||||
PangoLayout *layout;
|
||||
|
||||
layout = gtk_entry_get_layout(gtk_entry);
|
||||
if (gtk_entry->preedit_length == 0)
|
||||
{
|
||||
pango_layout_set_attributes(layout, entry->priv->attr_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
pango_layout_set_attributes(layout, empty_attrs_list);
|
||||
}
|
||||
|
||||
return GTK_WIDGET_CLASS(parent_class)->expose_event (widget, event);
|
||||
}
|
||||
#endif
|
||||
|
||||
static gint
|
||||
sexy_spell_entry_button_press(GtkWidget *widget, GdkEventButton *event)
|
||||
|
||||
@@ -44,11 +44,7 @@ typedef enum {
|
||||
|
||||
struct _SexySpellEntry
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GtkEntry parent_instance;
|
||||
#else
|
||||
GtkEntry parent_object;
|
||||
#endif
|
||||
|
||||
SexySpellEntryPriv *priv;
|
||||
|
||||
|
||||
@@ -38,16 +38,9 @@
|
||||
#include "palette.h"
|
||||
#include "textgui.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_TEXTEVENT_SAVE_AS "document-save-as"
|
||||
#define ICON_TEXTEVENT_OPEN "document-open"
|
||||
#define ICON_TEXTEVENT_OK "dialog-ok"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_TEXTEVENT_SAVE_AS GTK_STOCK_SAVE_AS
|
||||
#define ICON_TEXTEVENT_OPEN GTK_STOCK_OPEN
|
||||
#define ICON_TEXTEVENT_OK GTK_STOCK_OK
|
||||
#endif
|
||||
|
||||
extern struct text_event te[];
|
||||
extern char *pntevts_text[];
|
||||
@@ -462,11 +455,7 @@ pevent_dialog_show ()
|
||||
TRUE, FALSE, pevent_dialog_close, NULL,
|
||||
600, 455, &vbox, 0);
|
||||
|
||||
#if HAVE_GTK3
|
||||
pane = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||
#elif !HAVE_GTK3
|
||||
pane = gtk_vpaned_new ();
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox), pane, TRUE, TRUE, 0);
|
||||
|
||||
pevent_dialog_list = pevent_treeview_new (pane);
|
||||
@@ -485,13 +474,8 @@ pevent_dialog_show ()
|
||||
gtk_container_add (GTK_CONTAINER (wid), pevent_dialog_twid);
|
||||
gtk_xtext_set_font (GTK_XTEXT (pevent_dialog_twid), prefs.hex_text_font);
|
||||
|
||||
#if HAVE_GTK3
|
||||
hbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
hbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4);
|
||||
gtkutil_button (hbox, ICON_TEXTEVENT_SAVE_AS, NULL, pevent_save_cb,
|
||||
(void *) 1, _("Save As..."));
|
||||
|
||||
@@ -33,16 +33,9 @@
|
||||
#include "maingui.h"
|
||||
#include "urlgrab.h"
|
||||
|
||||
#if HAVE_GTK3
|
||||
#define ICON_URLGRAB_CLEAR "zc-menu-clear"
|
||||
#define ICON_URLGRAB_COPY "zc-menu-copy"
|
||||
#define ICON_URLGRAB_SAVE_AS "zc-menu-save-as"
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#define ICON_URLGRAB_CLEAR GTK_STOCK_CLEAR
|
||||
#define ICON_URLGRAB_COPY GTK_STOCK_COPY
|
||||
#define ICON_URLGRAB_SAVE_AS GTK_STOCK_SAVE_AS
|
||||
#endif
|
||||
|
||||
/* model for the URL treeview */
|
||||
enum
|
||||
@@ -218,13 +211,8 @@ url_opengui ()
|
||||
g_object_set_data (G_OBJECT (urlgrabberwindow), "model",
|
||||
gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
|
||||
|
||||
#if HAVE_GTK3
|
||||
hbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
|
||||
#elif !HAVE_GTK3
|
||||
hbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
|
||||
#endif
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
@@ -473,7 +473,6 @@ userlist_store_color (GtkListStore *store, GtkTreeIter *iter, int color_index)
|
||||
{
|
||||
const PaletteColor *color = color_index ? &colors[color_index] : NULL;
|
||||
|
||||
#if HAVE_GTK3
|
||||
if (color)
|
||||
{
|
||||
GdkRGBA rgba = *color;
|
||||
@@ -483,9 +482,6 @@ userlist_store_color (GtkListStore *store, GtkTreeIter *iter, int color_index)
|
||||
{
|
||||
gtk_list_store_set (store, iter, COL_GDKCOLOR, NULL, -1);
|
||||
}
|
||||
#else
|
||||
gtk_list_store_set (store, iter, COL_GDKCOLOR, color, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
GtkListStore *
|
||||
|
||||
@@ -203,11 +203,7 @@ gtk_xtext_cursor_unref (GdkCursor *cursor)
|
||||
{
|
||||
if (!cursor)
|
||||
return;
|
||||
#if !HAVE_GTK3
|
||||
gdk_cursor_unref (cursor);
|
||||
#else
|
||||
g_object_unref (cursor);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -220,117 +216,70 @@ xtext_set_source_color (cairo_t *cr, const XTextColor *color, gdouble alpha)
|
||||
static inline gdouble
|
||||
xtext_adj_get_value (GtkAdjustment *adj)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
return adj->value;
|
||||
#else
|
||||
return gtk_adjustment_get_value (adj);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
xtext_adj_set_value (GtkAdjustment *adj, gdouble value)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
adj->value = value;
|
||||
#else
|
||||
gtk_adjustment_set_value (adj, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline gdouble
|
||||
xtext_adj_get_upper (GtkAdjustment *adj)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
return adj->upper;
|
||||
#else
|
||||
return gtk_adjustment_get_upper (adj);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
xtext_adj_set_upper (GtkAdjustment *adj, gdouble upper)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
adj->upper = upper;
|
||||
#else
|
||||
gtk_adjustment_set_upper (adj, upper);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline gdouble
|
||||
xtext_adj_get_lower (GtkAdjustment *adj)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
return adj->lower;
|
||||
#else
|
||||
return gtk_adjustment_get_lower (adj);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
xtext_adj_set_lower (GtkAdjustment *adj, gdouble lower)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
adj->lower = lower;
|
||||
#else
|
||||
gtk_adjustment_set_lower (adj, lower);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline gdouble
|
||||
xtext_adj_get_page_size (GtkAdjustment *adj)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
return adj->page_size;
|
||||
#else
|
||||
return gtk_adjustment_get_page_size (adj);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
xtext_adj_set_page_size (GtkAdjustment *adj, gdouble page_size)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
adj->page_size = page_size;
|
||||
#else
|
||||
gtk_adjustment_set_page_size (adj, page_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline gdouble
|
||||
xtext_adj_get_page_increment (GtkAdjustment *adj)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
return adj->page_increment;
|
||||
#else
|
||||
return gtk_adjustment_get_page_increment (adj);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
xtext_adjustment_apply (GtkAdjustment *adj, gdouble lower, gdouble upper, gdouble value, gdouble page_size)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_adjustment_set_lower (adj, lower);
|
||||
gtk_adjustment_set_upper (adj, upper);
|
||||
gtk_adjustment_set_page_size (adj, page_size);
|
||||
gtk_adjustment_set_value (adj, value);
|
||||
#else
|
||||
adj->lower = lower;
|
||||
adj->upper = upper;
|
||||
adj->page_size = page_size;
|
||||
adj->value = value;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
xtext_adj_set_page_increment (GtkAdjustment *adj, gdouble page_increment)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
adj->page_increment = page_increment;
|
||||
#else
|
||||
gtk_adjustment_set_page_increment (adj, page_increment);
|
||||
#endif
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
@@ -735,15 +684,10 @@ gtk_xtext_adjustment_set (xtext_buffer *buf, int fire_signal)
|
||||
if (upper == 0)
|
||||
upper = 1;
|
||||
|
||||
#if HAVE_GTK3
|
||||
GtkAllocation allocation;
|
||||
|
||||
gtk_widget_get_allocation (GTK_WIDGET (buf->xtext), &allocation);
|
||||
page_size = allocation.height / buf->xtext->fontsize;
|
||||
#else
|
||||
page_size = GTK_WIDGET (buf->xtext)->allocation.height /
|
||||
buf->xtext->fontsize;
|
||||
#endif
|
||||
|
||||
if (value > upper - page_size)
|
||||
{
|
||||
@@ -759,11 +703,7 @@ gtk_xtext_adjustment_set (xtext_buffer *buf, int fire_signal)
|
||||
|
||||
if (fire_signal)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_adjustment_value_changed (adj);
|
||||
#else
|
||||
gtk_adjustment_changed (adj);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -825,11 +765,7 @@ gtk_xtext_new (const XTextColor *palette, int separator)
|
||||
xtext->buffer = gtk_xtext_buffer_new (xtext);
|
||||
xtext->orig_buffer = xtext->buffer;
|
||||
|
||||
#if !HAVE_GTK3
|
||||
gtk_widget_set_double_buffered (GTK_WIDGET (xtext), FALSE);
|
||||
#else
|
||||
/* GTK3 already uses the GTK render pipeline; no manual double-buffering toggle. */
|
||||
#endif
|
||||
gtk_xtext_set_palette (xtext, palette);
|
||||
|
||||
return GTK_WIDGET (xtext);
|
||||
@@ -897,20 +833,7 @@ gtk_xtext_cleanup (GtkXText *xtext)
|
||||
}
|
||||
}
|
||||
|
||||
#if !HAVE_GTK3
|
||||
static void
|
||||
gtk_xtext_destroy (GtkObject * object)
|
||||
{
|
||||
GtkXText *xtext = GTK_XTEXT (object);
|
||||
|
||||
gtk_xtext_cleanup (xtext);
|
||||
|
||||
if (GTK_OBJECT_CLASS (gtk_xtext_parent_class)->destroy)
|
||||
(*GTK_OBJECT_CLASS (gtk_xtext_parent_class)->destroy) (object);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
static void
|
||||
gtk_xtext_dispose (GObject *object)
|
||||
{
|
||||
@@ -928,7 +851,6 @@ gtk_xtext_finalize (GObject *object)
|
||||
if (G_OBJECT_CLASS (gtk_xtext_parent_class)->finalize)
|
||||
(*G_OBJECT_CLASS (gtk_xtext_parent_class)->finalize) (object);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gtk_xtext_unrealize (GtkWidget * widget)
|
||||
@@ -940,25 +862,17 @@ gtk_xtext_unrealize (GtkWidget * widget)
|
||||
* GtkWidget's unrealize path unregisters the window and expects
|
||||
* gdk_window_get_user_data(window) == widget.
|
||||
*/
|
||||
#if !HAVE_GTK3
|
||||
gdk_window_set_user_data (widget->window, NULL);
|
||||
#endif
|
||||
|
||||
if (GTK_WIDGET_CLASS (gtk_xtext_parent_class)->unrealize)
|
||||
(*GTK_WIDGET_CLASS (gtk_xtext_parent_class)->unrealize) (widget);
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_window (widget, NULL);
|
||||
gtk_widget_set_realized (widget, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_xtext_get_pointer (GdkWindow *window, gint *x, gint *y, GdkModifierType *mask)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
gdk_window_get_pointer (window, x, y, mask);
|
||||
#else
|
||||
GdkDisplay *display;
|
||||
GdkSeat *seat;
|
||||
GdkDevice *device;
|
||||
@@ -1012,19 +926,14 @@ gtk_xtext_get_pointer (GdkWindow *window, gint *x, gint *y, GdkModifierType *mas
|
||||
*y = root_y - win_y;
|
||||
if (mask)
|
||||
gdk_device_get_state (device, window, NULL, mask);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
gtk_xtext_clear_background (GtkWidget *widget)
|
||||
{
|
||||
#if !HAVE_GTK3
|
||||
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
|
||||
#else
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
if (window)
|
||||
gdk_window_set_background_pattern (window, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1040,19 +949,10 @@ gtk_xtext_realize (GtkWidget * widget)
|
||||
xtext = GTK_XTEXT (widget);
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
parent_window = gtk_widget_get_parent_window (widget);
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
allocation = widget->allocation;
|
||||
parent_window = widget->parent->window;
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
#endif
|
||||
|
||||
attributes.x = allocation.x;
|
||||
attributes.y = allocation.y;
|
||||
@@ -1066,11 +966,7 @@ gtk_xtext_realize (GtkWidget * widget)
|
||||
|
||||
window = gdk_window_new (parent_window, &attributes, attributes_mask);
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_window (widget, window);
|
||||
#else
|
||||
widget->window = window;
|
||||
#endif
|
||||
|
||||
gdk_window_set_user_data (window, widget);
|
||||
|
||||
@@ -1131,15 +1027,7 @@ gtk_xtext_size_request_internal (GtkWidget *widget, GtkRequisition *requisition)
|
||||
requisition->height = 90;
|
||||
}
|
||||
|
||||
#if !HAVE_GTK3
|
||||
static void
|
||||
gtk_xtext_size_request (GtkWidget *widget, GtkRequisition *requisition)
|
||||
{
|
||||
gtk_xtext_size_request_internal (widget, requisition);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
static void
|
||||
gtk_xtext_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural)
|
||||
{
|
||||
@@ -1171,7 +1059,6 @@ gtk_xtext_get_preferred_height_for_width (GtkWidget *widget, gint width,
|
||||
*minimum = requisition.height;
|
||||
*natural = requisition.height;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gtk_xtext_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
|
||||
@@ -1183,23 +1070,13 @@ gtk_xtext_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
|
||||
if (allocation->width == xtext->buffer->window_width)
|
||||
height_only = TRUE;
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
widget->allocation = *allocation;
|
||||
#endif
|
||||
if (gtk_widget_get_realized (GTK_WIDGET(widget)))
|
||||
{
|
||||
xtext->buffer->window_width = allocation->width;
|
||||
xtext->buffer->window_height = allocation->height;
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (widget);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = widget->window;
|
||||
#endif
|
||||
if (window)
|
||||
gdk_window_move_resize (window, allocation->x, allocation->y,
|
||||
allocation->width, allocation->height);
|
||||
@@ -1391,13 +1268,8 @@ gtk_xtext_draw_sep (GtkXText * xtext, int y)
|
||||
if (y == -1)
|
||||
{
|
||||
y = 0;
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_get_allocation (GTK_WIDGET (xtext), &allocation);
|
||||
height = allocation.height;
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
height = GTK_WIDGET (xtext)->allocation.height;
|
||||
#endif
|
||||
} else
|
||||
{
|
||||
height = xtext->fontsize;
|
||||
@@ -1460,12 +1332,7 @@ gtk_xtext_draw_marker (GtkXText * xtext, textentry * ent, int y)
|
||||
else return;
|
||||
|
||||
x = 0;
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_get_allocation (GTK_WIDGET (xtext), &allocation);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
allocation = GTK_WIDGET (xtext)->allocation;
|
||||
#endif
|
||||
width = allocation.width;
|
||||
|
||||
cr = xtext_create_context (xtext);
|
||||
@@ -1489,12 +1356,7 @@ gtk_xtext_render (GtkWidget *widget, GdkRectangle *area, cairo_t *cr)
|
||||
|
||||
xtext->draw_cr = cr;
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
allocation = widget->allocation;
|
||||
#endif
|
||||
|
||||
if (area->x == 0 && area->y == 0 &&
|
||||
area->height == allocation.height &&
|
||||
@@ -1566,7 +1428,6 @@ gtk_xtext_paint (GtkWidget *widget, GdkRectangle *area)
|
||||
* can be buffered without ever being presented. Queue a redraw instead and
|
||||
* let the widget's ::draw handler do the actual painting.
|
||||
*/
|
||||
#if HAVE_GTK3
|
||||
if (G_LIKELY (gtk_widget_get_realized (widget)))
|
||||
{
|
||||
if (area)
|
||||
@@ -1574,12 +1435,8 @@ gtk_xtext_paint (GtkWidget *widget, GdkRectangle *area)
|
||||
else
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
#else
|
||||
gtk_xtext_render (widget, area, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
static gboolean
|
||||
gtk_xtext_draw (GtkWidget *widget, cairo_t *cr)
|
||||
{
|
||||
@@ -1599,16 +1456,7 @@ gtk_xtext_draw (GtkWidget *widget, cairo_t *cr)
|
||||
gtk_xtext_render (widget, &area, cr);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_GTK3
|
||||
static gboolean
|
||||
gtk_xtext_expose (GtkWidget * widget, GdkEventExpose * event)
|
||||
{
|
||||
gtk_xtext_render (widget, &event->area, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* render a selection that has extended or contracted upward */
|
||||
|
||||
@@ -1933,12 +1781,7 @@ gtk_xtext_scrolldown_timeout (GtkXText * xtext)
|
||||
GtkAdjustment *adj = xtext->adj;
|
||||
GdkWindow *window;
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = GTK_WIDGET (xtext)->window;
|
||||
#endif
|
||||
if (!window)
|
||||
return 0;
|
||||
gtk_xtext_get_pointer (window, NULL, &p_y, NULL);
|
||||
@@ -1977,12 +1820,7 @@ gtk_xtext_scrollup_timeout (GtkXText * xtext)
|
||||
int delta_y;
|
||||
GdkWindow *window;
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = GTK_WIDGET (xtext)->window;
|
||||
#endif
|
||||
if (!window)
|
||||
return 0;
|
||||
gtk_xtext_get_pointer (window, NULL, &p_y, NULL);
|
||||
@@ -2029,12 +1867,7 @@ gtk_xtext_selection_update (GtkXText * xtext, GdkEventMotion * event, int p_y, g
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = GTK_WIDGET (xtext)->window;
|
||||
#endif
|
||||
if (!window)
|
||||
return;
|
||||
win_height = gdk_window_get_height (window);
|
||||
@@ -2209,9 +2042,7 @@ static gboolean
|
||||
gtk_xtext_leave_notify (GtkWidget * widget, GdkEventCrossing * event)
|
||||
{
|
||||
GtkXText *xtext = GTK_XTEXT (widget);
|
||||
#if HAVE_GTK3
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
#endif
|
||||
|
||||
if (xtext->cursor_hand)
|
||||
{
|
||||
@@ -2219,13 +2050,8 @@ gtk_xtext_leave_notify (GtkWidget * widget, GdkEventCrossing * event)
|
||||
xtext->hilight_start = -1;
|
||||
xtext->hilight_end = -1;
|
||||
xtext->cursor_hand = FALSE;
|
||||
#if HAVE_GTK3
|
||||
if (window)
|
||||
gdk_window_set_cursor (window, 0);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gdk_window_set_cursor (widget->window, 0);
|
||||
#endif
|
||||
xtext->hilight_ent = NULL;
|
||||
}
|
||||
|
||||
@@ -2235,13 +2061,8 @@ gtk_xtext_leave_notify (GtkWidget * widget, GdkEventCrossing * event)
|
||||
xtext->hilight_start = -1;
|
||||
xtext->hilight_end = -1;
|
||||
xtext->cursor_resize = FALSE;
|
||||
#if HAVE_GTK3
|
||||
if (window)
|
||||
gdk_window_set_cursor (window, 0);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gdk_window_set_cursor (widget->window, 0);
|
||||
#endif
|
||||
xtext->hilight_ent = NULL;
|
||||
}
|
||||
|
||||
@@ -2333,14 +2154,8 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event)
|
||||
GdkWindow *window;
|
||||
GtkAllocation allocation;
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (widget);
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = widget->window;
|
||||
allocation = widget->allocation;
|
||||
#endif
|
||||
if (!window)
|
||||
return FALSE;
|
||||
|
||||
@@ -2522,12 +2337,7 @@ gtk_xtext_button_release (GtkWidget * widget, GdkEventButton * event)
|
||||
int old;
|
||||
GtkAllocation allocation;
|
||||
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
allocation = widget->allocation;
|
||||
#endif
|
||||
|
||||
if (xtext->moving_separator)
|
||||
{
|
||||
@@ -2606,12 +2416,7 @@ gtk_xtext_button_press (GtkWidget * widget, GdkEventButton * event)
|
||||
int line_x, x, y, offset, len;
|
||||
GdkWindow *window;
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (widget);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = widget->window;
|
||||
#endif
|
||||
if (!window)
|
||||
return FALSE;
|
||||
|
||||
@@ -2845,7 +2650,6 @@ gtk_xtext_selection_get (GtkWidget * widget,
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
{
|
||||
GdkDisplay *display;
|
||||
#if HAVE_GTK3
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
|
||||
if (!window || !GDK_IS_WINDOW (window))
|
||||
@@ -2853,10 +2657,6 @@ gtk_xtext_selection_get (GtkWidget * widget,
|
||||
display = gdk_window_get_display (window);
|
||||
if (!display)
|
||||
break;
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
display = gdk_window_get_display (widget->window);
|
||||
#endif
|
||||
GdkAtom encoding;
|
||||
gint format;
|
||||
gint new_length;
|
||||
@@ -2929,15 +2729,10 @@ gtk_xtext_scroll_adjustments (GtkXText *xtext, GtkAdjustment *hadj, GtkAdjustmen
|
||||
if (xtext->adj != vadj)
|
||||
{
|
||||
xtext->adj = vadj;
|
||||
#if HAVE_GTK3
|
||||
if (g_object_is_floating (xtext->adj))
|
||||
g_object_ref_sink (xtext->adj);
|
||||
else
|
||||
g_object_ref (xtext->adj);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
g_object_ref_sink (xtext->adj);
|
||||
#endif
|
||||
|
||||
xtext->vc_signal_tag = g_signal_connect (xtext->adj, "value-changed",
|
||||
G_CALLBACK (gtk_xtext_adjustment_changed),
|
||||
@@ -2952,19 +2747,9 @@ gtk_xtext_class_init (GtkXTextClass * class)
|
||||
{
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkXTextClass *xtext_class;
|
||||
#if HAVE_GTK3
|
||||
GObjectClass *object_class;
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
GtkObjectClass *object_class;
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
object_class = G_OBJECT_CLASS (class);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
object_class = (GtkObjectClass *) class;
|
||||
#endif
|
||||
widget_class = (GtkWidgetClass *) class;
|
||||
xtext_class = (GtkXTextClass *) class;
|
||||
|
||||
@@ -2987,38 +2772,23 @@ gtk_xtext_class_init (GtkXTextClass * class)
|
||||
G_TYPE_NONE,
|
||||
2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
|
||||
|
||||
#if HAVE_GTK3
|
||||
object_class->dispose = gtk_xtext_dispose;
|
||||
object_class->finalize = gtk_xtext_finalize;
|
||||
#else
|
||||
object_class->destroy = gtk_xtext_destroy;
|
||||
#endif
|
||||
|
||||
widget_class->realize = gtk_xtext_realize;
|
||||
widget_class->unrealize = gtk_xtext_unrealize;
|
||||
#if !HAVE_GTK3
|
||||
widget_class->size_request = gtk_xtext_size_request;
|
||||
#endif
|
||||
widget_class->size_allocate = gtk_xtext_size_allocate;
|
||||
widget_class->button_press_event = gtk_xtext_button_press;
|
||||
widget_class->button_release_event = gtk_xtext_button_release;
|
||||
widget_class->motion_notify_event = gtk_xtext_motion_notify;
|
||||
widget_class->selection_clear_event = (void *)gtk_xtext_selection_kill;
|
||||
widget_class->selection_get = gtk_xtext_selection_get;
|
||||
#if HAVE_GTK3
|
||||
widget_class->draw = gtk_xtext_draw;
|
||||
widget_class->get_preferred_width = gtk_xtext_get_preferred_width;
|
||||
widget_class->get_preferred_height = gtk_xtext_get_preferred_height;
|
||||
widget_class->get_preferred_height_for_width = gtk_xtext_get_preferred_height_for_width;
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
widget_class->expose_event = gtk_xtext_expose;
|
||||
#endif
|
||||
widget_class->scroll_event = gtk_xtext_scroll;
|
||||
widget_class->leave_notify_event = gtk_xtext_leave_notify;
|
||||
#if !HAVE_GTK3
|
||||
widget_class->set_scroll_adjustments_signal = xtext_signals[SET_SCROLL_ADJUSTMENTS];
|
||||
#endif
|
||||
|
||||
xtext_class->word_click = NULL;
|
||||
xtext_class->set_scroll_adjustments = gtk_xtext_scroll_adjustments;
|
||||
@@ -3206,9 +2976,7 @@ gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
|
||||
int dest_x = 0, dest_y = 0;
|
||||
int tile_x = xtext->ts_x;
|
||||
int tile_y = xtext->ts_y;
|
||||
#if HAVE_GTK3
|
||||
GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
||||
#endif
|
||||
|
||||
if (xtext->dont_render || len < 1 || xtext->hidden)
|
||||
return 0;
|
||||
@@ -3232,16 +3000,10 @@ gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
|
||||
goto dounder;
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
if (!window)
|
||||
return str_width;
|
||||
surface = gdk_window_create_similar_surface (window,
|
||||
CAIRO_CONTENT_COLOR_ALPHA, str_width, xtext->fontsize);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
surface = gdk_window_create_similar_surface (GTK_WIDGET (xtext)->window,
|
||||
CAIRO_CONTENT_COLOR_ALPHA, str_width, xtext->fontsize);
|
||||
#endif
|
||||
if (surface)
|
||||
{
|
||||
dest_x = x;
|
||||
@@ -4288,12 +4050,7 @@ gtk_xtext_calc_lines (xtext_buffer *buf, int fire_signal)
|
||||
int lines;
|
||||
GdkWindow *window;
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (GTK_WIDGET (buf->xtext));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = GTK_WIDGET (buf->xtext)->window;
|
||||
#endif
|
||||
if (!window)
|
||||
return;
|
||||
height = gdk_window_get_height (window);
|
||||
@@ -4385,7 +4142,6 @@ gtk_xtext_render_ents (GtkXText * xtext, textentry * enta, textentry * entb)
|
||||
* window painting may not be presented immediately. Queue a frame instead so
|
||||
* selections appear right away.
|
||||
*/
|
||||
#if HAVE_GTK3
|
||||
if (xtext->draw_cr == NULL)
|
||||
{
|
||||
GtkWidget *w = GTK_WIDGET (xtext);
|
||||
@@ -4393,7 +4149,6 @@ gtk_xtext_render_ents (GtkXText * xtext, textentry * enta, textentry * entb)
|
||||
gtk_widget_queue_draw (w);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
textentry *ent, *orig_ent, *tmp_ent;
|
||||
int line;
|
||||
@@ -4407,12 +4162,7 @@ gtk_xtext_render_ents (GtkXText * xtext, textentry * enta, textentry * entb)
|
||||
if (xtext->buffer->indent < MARGIN)
|
||||
xtext->buffer->indent = MARGIN; /* 2 pixels is our left margin */
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = GTK_WIDGET (xtext)->window;
|
||||
#endif
|
||||
if (!window)
|
||||
return 0;
|
||||
height = gdk_window_get_height (window);
|
||||
@@ -4497,7 +4247,6 @@ gtk_xtext_render_page (GtkXText * xtext)
|
||||
* If we're not currently inside ::draw, xtext->draw_cr is NULL. In that case
|
||||
* just request a redraw and let the normal GTK paint cycle do the work.
|
||||
*/
|
||||
#if HAVE_GTK3
|
||||
if (xtext->draw_cr == NULL)
|
||||
{
|
||||
GtkWidget *w = GTK_WIDGET (xtext);
|
||||
@@ -4505,7 +4254,6 @@ gtk_xtext_render_page (GtkXText * xtext)
|
||||
gtk_widget_queue_draw (w);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
textentry *ent;
|
||||
int line;
|
||||
@@ -4525,12 +4273,7 @@ gtk_xtext_render_page (GtkXText * xtext)
|
||||
if (xtext->buffer->indent < MARGIN)
|
||||
xtext->buffer->indent = MARGIN; /* 2 pixels is our left margin */
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = GTK_WIDGET (xtext)->window;
|
||||
#endif
|
||||
if (!window)
|
||||
return;
|
||||
width = gdk_window_get_width (window);
|
||||
@@ -4581,12 +4324,7 @@ gtk_xtext_render_page (GtkXText * xtext)
|
||||
cr = xtext_create_context (xtext);
|
||||
cairo_save (cr);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
#if HAVE_GTK3
|
||||
surface = xtext_surface_from_window (window);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
surface = xtext_surface_from_window (GTK_WIDGET (xtext)->window);
|
||||
#endif
|
||||
if (!surface)
|
||||
{
|
||||
cairo_restore (cr);
|
||||
@@ -4613,12 +4351,7 @@ gtk_xtext_render_page (GtkXText * xtext)
|
||||
cr = xtext_create_context (xtext);
|
||||
cairo_save (cr);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
#if HAVE_GTK3
|
||||
surface = xtext_surface_from_window (window);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
surface = xtext_surface_from_window (GTK_WIDGET (xtext)->window);
|
||||
#endif
|
||||
if (!surface)
|
||||
{
|
||||
cairo_restore (cr);
|
||||
@@ -4890,12 +4623,7 @@ gtk_xtext_check_ent_visibility (GtkXText * xtext, textentry *find_ent, int add)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = GTK_WIDGET (xtext)->window;
|
||||
#endif
|
||||
if (!window)
|
||||
return FALSE;
|
||||
height = gdk_window_get_height (window);
|
||||
@@ -5780,12 +5508,7 @@ gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render)
|
||||
if (!gtk_widget_get_realized (GTK_WIDGET (xtext)))
|
||||
gtk_widget_realize (GTK_WIDGET (xtext));
|
||||
|
||||
#if HAVE_GTK3
|
||||
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
window = GTK_WIDGET (xtext)->window;
|
||||
#endif
|
||||
if (!window)
|
||||
return;
|
||||
h = gdk_window_get_height (window);
|
||||
@@ -5848,7 +5571,6 @@ gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render)
|
||||
}
|
||||
|
||||
gtk_xtext_render_page (xtext);
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
gdouble lower = 0;
|
||||
@@ -5875,9 +5597,6 @@ gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render)
|
||||
gtk_adjustment_set_page_increment (xtext->adj, page_size);
|
||||
gtk_adjustment_value_changed (xtext->adj);
|
||||
}
|
||||
#else
|
||||
gtk_adjustment_changed (xtext->adj);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -130,11 +130,7 @@ typedef struct {
|
||||
|
||||
struct _GtkXText
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GtkWidget parent_instance;
|
||||
#else
|
||||
GtkWidget parent;
|
||||
#endif
|
||||
|
||||
xtext_buffer *buffer;
|
||||
xtext_buffer *orig_buffer;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<!-- G_DISABLE_DEPRECATED is unfeasible due to g_completion_* -->
|
||||
<!-- must be buildable with GSEAL_ENABLE in the future, xtext, setup, and chanview-tabs stand in the way -->
|
||||
<OwnFlags>GTK_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;HAVE_X509_GET_SIGNATURE_NID;HAVE_SSL_CTX_GET_SSL_METHOD;DEFAULT_CERT_FILE="cert.pem";HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline;$(GtkDefines)</OwnFlags>
|
||||
<OwnFlags>GTK_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;HAVE_X509_GET_SIGNATURE_NID;HAVE_SSL_CTX_GET_SSL_METHOD;DEFAULT_CERT_FILE="cert.pem";HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline</OwnFlags>
|
||||
|
||||
<!-- FIXME: Add ability to use debug builds -->
|
||||
<DepsRoot>$(YourDepsPath)\$(ZoiteChatPlatform)\release</DepsRoot>
|
||||
@@ -67,7 +67,6 @@
|
||||
<Glib>$(DepsRoot)\include\glib-2.0;$(DepsRoot)\lib\glib-2.0\include;$(DepsRoot)\include\libxml2</Glib>
|
||||
|
||||
<UsingGtk3 Condition="Exists('$(DepsRoot)\\include\\gtk-3.0\\gtk\\gtk.h')">true</UsingGtk3>
|
||||
<GtkDefines>HAVE_GTK3</GtkDefines>
|
||||
<Gtk3>$(DepsRoot)\include\gtk-3.0;$(DepsRoot)\lib\gtk-3.0\include</Gtk3>
|
||||
<GtkCommon>$(DepsRoot)\include\atk-1.0;$(DepsRoot)\include\cairo;$(DepsRoot)\include\pango-1.0;$(DepsRoot)\include\gdk-pixbuf-2.0;$(DepsRoot)\include\harfbuzz</GtkCommon>
|
||||
<Gtk>$(Gtk3);$(GtkCommon)</Gtk>
|
||||
|
||||
Reference in New Issue
Block a user