mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Added a GTK3 icon-button helper for the channel list and reused it for the action buttons, plus guarded the GTK2 popup timestamp handling.
Added a GTK3 icon-button helper for the plugin list controls and used it for the load/unload/reload buttons. Added a GTK3 help icon to the join-channel dialog button configuration.
This commit is contained in:
@@ -92,6 +92,25 @@ chanlist_box_new (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
static GtkWidget *
|
||||
chanlist_icon_button (const char *label, const char *icon_name,
|
||||
GCallback callback, gpointer userdata)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *image;
|
||||
|
||||
button = gtk_button_new_with_mnemonic (label);
|
||||
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
gtk_button_set_image (GTK_BUTTON (button), image);
|
||||
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
|
||||
g_signal_connect (G_OBJECT (button), "clicked", callback, userdata);
|
||||
gtk_widget_show (button);
|
||||
|
||||
return button;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static gboolean
|
||||
chanlist_match (server *serv, const char *str)
|
||||
@@ -704,7 +723,7 @@ chanlist_button_cb (GtkTreeView *tree, GdkEventButton *event, server *serv)
|
||||
}
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, event->time);
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, event ? event->time : 0);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
@@ -870,13 +889,8 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
gtk_widget_show (table);
|
||||
|
||||
#if HAVE_GTK3
|
||||
wid = gtk_button_new_with_mnemonic (_("_Search"));
|
||||
gtk_button_set_image (GTK_BUTTON (wid),
|
||||
gtk_image_new_from_icon_name ("edit-find", GTK_ICON_SIZE_MENU));
|
||||
gtk_button_set_use_underline (GTK_BUTTON (wid), TRUE);
|
||||
g_signal_connect (G_OBJECT (wid), "clicked",
|
||||
G_CALLBACK (chanlist_search_pressed), serv);
|
||||
gtk_widget_show (wid);
|
||||
wid = chanlist_icon_button (_("_Search"), "edit-find",
|
||||
G_CALLBACK (chanlist_search_pressed), serv);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
wid = gtkutil_button (NULL, GTK_STOCK_FIND, 0, chanlist_search_pressed, serv,
|
||||
@@ -891,13 +905,8 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
wid = gtk_button_new_with_mnemonic (_("_Download List"));
|
||||
gtk_button_set_image (GTK_BUTTON (wid),
|
||||
gtk_image_new_from_icon_name ("view-refresh", GTK_ICON_SIZE_MENU));
|
||||
gtk_button_set_use_underline (GTK_BUTTON (wid), TRUE);
|
||||
g_signal_connect (G_OBJECT (wid), "clicked",
|
||||
G_CALLBACK (chanlist_refresh), serv);
|
||||
gtk_widget_show (wid);
|
||||
wid = chanlist_icon_button (_("_Download List"), "view-refresh",
|
||||
G_CALLBACK (chanlist_refresh), serv);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
wid = gtkutil_button (NULL, GTK_STOCK_REFRESH, 0, chanlist_refresh, serv,
|
||||
@@ -912,13 +921,8 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
wid = gtk_button_new_with_mnemonic (_("Save _List..."));
|
||||
gtk_button_set_image (GTK_BUTTON (wid),
|
||||
gtk_image_new_from_icon_name ("document-save-as", GTK_ICON_SIZE_MENU));
|
||||
gtk_button_set_use_underline (GTK_BUTTON (wid), TRUE);
|
||||
g_signal_connect (G_OBJECT (wid), "clicked",
|
||||
G_CALLBACK (chanlist_save), serv);
|
||||
gtk_widget_show (wid);
|
||||
wid = chanlist_icon_button (_("Save _List..."), "document-save-as",
|
||||
G_CALLBACK (chanlist_save), serv);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
wid = gtkutil_button (NULL, GTK_STOCK_SAVE_AS, 0, chanlist_save, serv,
|
||||
@@ -933,13 +937,8 @@ chanlist_opengui (server *serv, int do_refresh)
|
||||
#endif
|
||||
|
||||
#if HAVE_GTK3
|
||||
wid = gtk_button_new_with_mnemonic (_("_Join Channel"));
|
||||
gtk_button_set_image (GTK_BUTTON (wid),
|
||||
gtk_image_new_from_icon_name ("go-jump", GTK_ICON_SIZE_MENU));
|
||||
gtk_button_set_use_underline (GTK_BUTTON (wid), TRUE);
|
||||
g_signal_connect (G_OBJECT (wid), "clicked",
|
||||
G_CALLBACK (chanlist_join), serv);
|
||||
gtk_widget_show (wid);
|
||||
wid = chanlist_icon_button (_("_Join Channel"), "go-jump",
|
||||
G_CALLBACK (chanlist_join), serv);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
wid = gtkutil_button (NULL, GTK_STOCK_JUMP_TO, 0, chanlist_join, serv,
|
||||
|
||||
@@ -1445,6 +1445,11 @@ menu_join (GtkWidget * wid, gpointer none)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_HELP);
|
||||
if (button)
|
||||
gtk_button_set_image (GTK_BUTTON (button),
|
||||
gtk_image_new_from_icon_name ("help-browser", GTK_ICON_SIZE_BUTTON));
|
||||
|
||||
button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_REJECT);
|
||||
if (button)
|
||||
gtk_button_set_image (GTK_BUTTON (button),
|
||||
|
||||
@@ -48,6 +48,27 @@ enum
|
||||
|
||||
static GtkWidget *plugin_window = NULL;
|
||||
|
||||
#if HAVE_GTK3
|
||||
static GtkWidget *
|
||||
plugingui_icon_button (GtkWidget *box, const char *label,
|
||||
const char *icon_name, GCallback callback,
|
||||
gpointer userdata)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *image;
|
||||
|
||||
button = gtk_button_new_with_mnemonic (label);
|
||||
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
gtk_button_set_image (GTK_BUTTON (button), image);
|
||||
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (box), button);
|
||||
g_signal_connect (G_OBJECT (button), "clicked", callback, userdata);
|
||||
gtk_widget_show (button);
|
||||
|
||||
return button;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static GtkWidget *
|
||||
plugingui_treeview_new (GtkWidget *box)
|
||||
@@ -254,34 +275,12 @@ plugingui_open (void)
|
||||
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
button = gtk_button_new_with_mnemonic (_("_Load..."));
|
||||
gtk_button_set_image (GTK_BUTTON (button),
|
||||
gtk_image_new_from_icon_name ("document-open", GTK_ICON_SIZE_MENU));
|
||||
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (plugingui_loadbutton_cb), NULL);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_mnemonic (_("_Unload"));
|
||||
gtk_button_set_image (GTK_BUTTON (button),
|
||||
gtk_image_new_from_icon_name ("edit-delete", GTK_ICON_SIZE_MENU));
|
||||
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (plugingui_unload), NULL);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_mnemonic (_("_Reload"));
|
||||
gtk_button_set_image (GTK_BUTTON (button),
|
||||
gtk_image_new_from_icon_name ("view-refresh", GTK_ICON_SIZE_MENU));
|
||||
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (plugingui_reloadbutton_cb), view);
|
||||
gtk_widget_show (button);
|
||||
plugingui_icon_button (hbox, _("_Load..."), "document-open",
|
||||
G_CALLBACK (plugingui_loadbutton_cb), NULL);
|
||||
plugingui_icon_button (hbox, _("_Unload"), "edit-delete",
|
||||
G_CALLBACK (plugingui_unload), NULL);
|
||||
plugingui_icon_button (hbox, _("_Reload"), "view-refresh",
|
||||
G_CALLBACK (plugingui_reloadbutton_cb), view);
|
||||
}
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
|
||||
Reference in New Issue
Block a user