mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 16:00:18 +00:00
Removed GTK2/GTK3 dual-path preprocessor branches across src/fe-gtk by keeping GTK3-native paths only, including the high-density targets you prioritized (xtext.c, setup.c, maingui.c, gtkutil.c, servlistgui.c).
Removed GTK2 compatibility shims from headers (fe-gtk.h, gtkutil.h), leaving direct GTK3-facing declarations/includes only (and platform-specific guards unrelated to GTK2 kept as-is). Cleaned GTK2-specific comments/wording now that behavior is GTK3-native (menu accelerator note and emoji/userlist comment blocks).
This commit is contained in:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user