From eb24c70f1239ee527ea90e1d89313df2fdf7ecca Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Tue, 21 May 2024 18:46:02 +0100 Subject: [PATCH] wmclockmon: replace deprecated `gtk_signal_*` Signed-off-by: Jeremy Sowden --- wmclockmon/wmclockmon-cal/mainwindow.c | 42 ++++++++++--------------- wmclockmon/wmclockmon-config/actions.c | 6 ++-- wmclockmon/wmclockmon-config/edit.c | 30 +++++++----------- wmclockmon/wmclockmon-config/edit.h | 4 +-- wmclockmon/wmclockmon-config/mainwindow.c | 51 ++++++++++--------------------- wmclockmon/wmclockmon-config/mainwindow.h | 6 +--- 6 files changed, 48 insertions(+), 91 deletions(-) diff --git a/wmclockmon/wmclockmon-cal/mainwindow.c b/wmclockmon/wmclockmon-cal/mainwindow.c index 45cd323..6531577 100644 --- a/wmclockmon/wmclockmon-cal/mainwindow.c +++ b/wmclockmon/wmclockmon-cal/mainwindow.c @@ -75,7 +75,7 @@ static void hide_editor(void) { } -static void toggle_displ(GtkWidget *widget UNUSED, void *data UNUSED) { +static void toggle_displ(void) { switch (shown) { case 1: show_editor(); @@ -325,11 +325,9 @@ void create_mainwindow(void) { /*** FENÊTRE PRINCIPALE ***/ application = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(application), PACKAGE" Calendar"); - /*-- Connexion aux signaux --*/ - gtk_signal_connect(GTK_OBJECT(application), "delete_event", - GTK_SIGNAL_FUNC(quit_app), NULL); - gtk_signal_connect(GTK_OBJECT(application), "destroy", - GTK_SIGNAL_FUNC(quit_app), "WM destroy"); + /*-- Connexion aux signaux --*/ + g_signal_connect(application, "delete_event", G_CALLBACK(quit_app), NULL); + g_signal_connect(application, "destroy", G_CALLBACK(quit_app), NULL); /*-- Taille de la fenêtre --*/ gtk_widget_set_size_request(GTK_WIDGET(application), WIN_WIDTH, WIN_HEIGHT); gtk_widget_realize(application); @@ -350,12 +348,11 @@ void create_mainwindow(void) { gtk_calendar_select_day(GTK_CALENDAR(calendar), timeinfos->tm_mday); mark_days(); gtk_box_pack_start(GTK_BOX(main_vbox), calendar, TRUE, TRUE, 1); - gtk_signal_connect(GTK_OBJECT(calendar), "day-selected-double-click", - GTK_SIGNAL_FUNC(cal_click), NULL); - gtk_signal_connect(GTK_OBJECT(calendar), "day-selected-double-click", - GTK_SIGNAL_FUNC(toggle_displ), NULL); - gtk_signal_connect(GTK_OBJECT(calendar), "month-changed", - GTK_SIGNAL_FUNC(mark_days), NULL); + g_signal_connect(calendar, "day-selected-double-click", + G_CALLBACK(cal_click), NULL); + g_signal_connect(calendar, "day-selected-double-click", + G_CALLBACK(toggle_displ), NULL); + g_signal_connect(calendar, "month-changed", G_CALLBACK(mark_days), NULL); gtk_widget_show(calendar); edit = gtk_text_view_new(); @@ -371,8 +368,7 @@ void create_mainwindow(void) { button_u = gtk_toggle_button_new(); - gtk_signal_connect(GTK_OBJECT(button_u), "clicked", - GTK_SIGNAL_FUNC(set_text_u), NULL); + g_signal_connect(button_u, "clicked", G_CALLBACK(set_text_u), NULL); gtk_box_pack_start(GTK_BOX(text_buttons), button_u, TRUE, TRUE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_u), TRUE); gtk_widget_show(button_u); @@ -382,8 +378,7 @@ void create_mainwindow(void) { button_y = gtk_toggle_button_new(); - gtk_signal_connect(GTK_OBJECT(button_y), "clicked", - GTK_SIGNAL_FUNC(set_text_y), NULL); + g_signal_connect(button_y, "clicked", G_CALLBACK(set_text_y), NULL); gtk_box_pack_start(GTK_BOX(text_buttons), button_y, TRUE, TRUE, 0); gtk_widget_show(button_y); label_y = gtk_label_new(" Yearly "); @@ -392,8 +387,7 @@ void create_mainwindow(void) { button_m = gtk_toggle_button_new(); - gtk_signal_connect(GTK_OBJECT(button_m), "clicked", - GTK_SIGNAL_FUNC(set_text_m), NULL); + g_signal_connect(button_m, "clicked", G_CALLBACK(set_text_m), NULL); gtk_box_pack_start(GTK_BOX(text_buttons), button_m, TRUE, TRUE, 0); gtk_widget_show(button_m); label_m = gtk_label_new(" Monthly "); @@ -409,8 +403,7 @@ void create_mainwindow(void) { closewindow = gtk_button_new_with_label(" Close "); - gtk_signal_connect(GTK_OBJECT(closewindow), "clicked", - GTK_SIGNAL_FUNC(quit_app), NULL); + g_signal_connect(closewindow, "clicked", G_CALLBACK(quit_app), NULL); gtk_box_pack_start(GTK_BOX(buttons_hbox), closewindow, TRUE, TRUE, 0); gtk_widget_set_can_default(GTK_WIDGET(closewindow), TRUE); gtk_widget_grab_default(GTK_WIDGET(closewindow)); @@ -418,22 +411,19 @@ void create_mainwindow(void) { save = gtk_button_new_with_label(" Save "); - gtk_signal_connect(GTK_OBJECT(save), "clicked", - GTK_SIGNAL_FUNC(save_datas), NULL); + g_signal_connect(save, "clicked", G_CALLBACK(save_datas), NULL); gtk_box_pack_start(GTK_BOX(buttons_hbox), save, TRUE, TRUE, 0); gtk_widget_set_can_default(GTK_WIDGET(save), TRUE); delete = gtk_button_new_with_label(" Delete "); - gtk_signal_connect(GTK_OBJECT(delete), "clicked", - GTK_SIGNAL_FUNC(delete_file), NULL); + g_signal_connect(delete, "clicked", G_CALLBACK(delete_file), NULL); gtk_box_pack_start(GTK_BOX(buttons_hbox), delete, TRUE, TRUE, 0); gtk_widget_set_can_default(GTK_WIDGET(delete), TRUE); cancel = gtk_button_new_with_label(" Close "); - gtk_signal_connect(GTK_OBJECT(cancel), "clicked", - GTK_SIGNAL_FUNC(toggle_displ), NULL); + g_signal_connect(cancel, "clicked", G_CALLBACK(toggle_displ), NULL); gtk_box_pack_start(GTK_BOX(buttons_hbox), cancel, TRUE, TRUE, 0); gtk_widget_set_can_default(GTK_WIDGET(cancel), TRUE); diff --git a/wmclockmon/wmclockmon-config/actions.c b/wmclockmon/wmclockmon-config/actions.c index b95c341..b6a6bc7 100644 --- a/wmclockmon/wmclockmon-config/actions.c +++ b/wmclockmon/wmclockmon-config/actions.c @@ -49,7 +49,7 @@ void set_list() { r++; } gtk_clist_thaw(GTK_CLIST(alarmlist)); - list_unsel_cb(GTK_CLIST(alarmlist), 0, 0, NULL, NULL); + list_unsel_cb(); } void set_values(void) { @@ -105,7 +105,7 @@ void save_datas(void) { } -void do_add(GtkWidget *widget UNUSED, void *data UNUSED) { +void do_add(void) { alrm_add(&alarms, newalarm); set_list(); FREE(newalarm); @@ -117,7 +117,7 @@ void add_alarm(void) { } -void do_change(GtkWidget *widget UNUSED, void *data UNUSED) { +void do_change(void) { Alarm *alrm; char *time = NULL, *date = NULL, *ison = NULL, *mesg = NULL, *at; char *tokstr = xstrdup(newalarm); diff --git a/wmclockmon/wmclockmon-config/edit.c b/wmclockmon/wmclockmon-config/edit.c index 4f33097..2a4a051 100644 --- a/wmclockmon/wmclockmon-config/edit.c +++ b/wmclockmon/wmclockmon-config/edit.c @@ -46,7 +46,7 @@ void edit_dialog(const char *title, const char *atime, const char *adate, const char *amesg, - void (*f_ok)(GtkWidget *, void *)) { + void (*f_ok)(void)) { GtkWidget *dialog; GtkWidget *bouton; @@ -58,23 +58,16 @@ void edit_dialog(const char *title, FREE(newalarm); dialog = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(dialog), title); - gtk_signal_connect(GTK_OBJECT(dialog), "delete_event", - GTK_SIGNAL_FUNC(gtk_widget_destroy), - NULL); - gtk_signal_connect(GTK_OBJECT(dialog), "destroy", - GTK_SIGNAL_FUNC(gtk_widget_destroy), - NULL); + g_signal_connect(dialog, "delete_event", + G_CALLBACK(gtk_widget_destroy), NULL); + g_signal_connect(dialog, "destroy", + G_CALLBACK(gtk_widget_destroy), NULL); bouton = gtk_button_new_with_label("Ok"); - gtk_signal_connect(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(set_data), - NULL); - gtk_signal_connect(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(f_ok), - NULL); - gtk_signal_connect_object(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(gtk_widget_destroy), - GTK_OBJECT(dialog)); + g_signal_connect(bouton, "clicked", G_CALLBACK(set_data), NULL); + g_signal_connect(bouton, "clicked", G_CALLBACK(f_ok), NULL); + g_signal_connect_swapped(bouton, "clicked", + G_CALLBACK(gtk_widget_destroy), dialog); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), bouton, TRUE, TRUE, 0); gtk_widget_set_can_default(GTK_WIDGET(bouton), TRUE); @@ -82,9 +75,8 @@ void edit_dialog(const char *title, gtk_widget_show(bouton); bouton = gtk_button_new_with_label("Cancel"); - gtk_signal_connect_object(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(gtk_widget_destroy), - GTK_OBJECT(dialog)); + g_signal_connect_swapped(bouton, "clicked", + G_CALLBACK(gtk_widget_destroy), dialog); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), bouton, TRUE, TRUE, 0); gtk_widget_set_can_default(GTK_WIDGET(bouton), TRUE); diff --git a/wmclockmon/wmclockmon-config/edit.h b/wmclockmon/wmclockmon-config/edit.h index f780aee..9b4e26a 100644 --- a/wmclockmon/wmclockmon-config/edit.h +++ b/wmclockmon/wmclockmon-config/edit.h @@ -5,8 +5,6 @@ #ifndef EDIT_H #define EDIT_H -#include - extern char *newalarm; void edit_dialog(const char *title, @@ -14,6 +12,6 @@ void edit_dialog(const char *title, const char *atime, const char *adate, const char *amesg, - void (*f_ok)(GtkWidget *, void *)); + void (*f_ok)(void)); #endif diff --git a/wmclockmon/wmclockmon-config/mainwindow.c b/wmclockmon/wmclockmon-config/mainwindow.c index 85d1fe8..295bba6 100644 --- a/wmclockmon/wmclockmon-config/mainwindow.c +++ b/wmclockmon/wmclockmon-config/mainwindow.c @@ -33,29 +33,19 @@ static GtkWidget *b_edit; static GtkWidget *b_set; static GtkWidget *b_remove; -static gint list_sel_cb (GtkCList *clist UNUSED, - gint row, - gint column UNUSED, - GdkEventButton *event UNUSED, - void *data UNUSED) { +static gint list_sel_cb (GtkCList *clist UNUSED, gint row) { selected_row = row; gtk_widget_set_sensitive(b_edit, TRUE); gtk_widget_set_sensitive(b_set, TRUE); gtk_widget_set_sensitive(b_remove, TRUE); - return TRUE; } -gint list_unsel_cb (GtkCList *clist UNUSED, - gint row UNUSED, - gint column UNUSED, - GdkEventButton *event UNUSED, - void *data UNUSED) { +void list_unsel_cb (void) { selected_row = -1; gtk_widget_set_sensitive(b_edit, FALSE); gtk_widget_set_sensitive(b_set, FALSE); gtk_widget_set_sensitive(b_remove, FALSE); - return TRUE; } @@ -78,11 +68,9 @@ void create_mainwindow() { /*** FENÊTRE PRINCIPALE ***/ application = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(application), PACKAGE" Config"); - /*-- Connexion aux signaux --*/ - gtk_signal_connect(GTK_OBJECT(application), "delete_event", - GTK_SIGNAL_FUNC(quit_app), NULL); - gtk_signal_connect(GTK_OBJECT(application), "destroy", - GTK_SIGNAL_FUNC(quit_app), "WM destroy"); + /*-- Connexion aux signaux --*/ + g_signal_connect(application, "delete_event", G_CALLBACK(quit_app), NULL); + g_signal_connect(application, "destroy", G_CALLBACK(quit_app), NULL); /*-- Taille de la fenêtre --*/ gtk_widget_set_size_request(GTK_WIDGET(application), WIN_WIDTH, WIN_HEIGHT); gtk_widget_realize(application); @@ -252,10 +240,10 @@ void create_mainwindow() { alarmlist = gtk_clist_new_with_titles(4, clist_titles); selected_row = -1; - gtk_signal_connect(GTK_OBJECT(alarmlist), "select-row", - GTK_SIGNAL_FUNC(list_sel_cb), NULL); - gtk_signal_connect(GTK_OBJECT(alarmlist), "unselect-row", - GTK_SIGNAL_FUNC(list_unsel_cb), NULL); + g_signal_connect(alarmlist, "select-row", + G_CALLBACK(list_sel_cb), NULL); + g_signal_connect(alarmlist, "unselect-row", + G_CALLBACK(list_unsel_cb), NULL); gtk_container_add(GTK_CONTAINER(scrolled_window), alarmlist); gtk_clist_set_auto_sort(GTK_CLIST(alarmlist), FALSE); gtk_widget_show(alarmlist); @@ -275,30 +263,26 @@ void create_mainwindow() { gtk_widget_show(table); bouton = gtk_button_new_with_label(" Add alarm "); - gtk_signal_connect(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(add_alarm), NULL); + g_signal_connect(bouton, "clicked", G_CALLBACK(add_alarm), NULL); gtk_table_attach_defaults(GTK_TABLE(table), bouton, 0, 1, 0, 1); gtk_widget_show(bouton); bouton = gtk_button_new_with_label(" Edit entry "); - gtk_signal_connect(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(edit_entry), NULL); + g_signal_connect(bouton, "clicked", G_CALLBACK(edit_entry), NULL); gtk_table_attach_defaults(GTK_TABLE(table), bouton, 0, 1, 1, 2); gtk_widget_set_sensitive(bouton, FALSE); gtk_widget_show(bouton); b_edit = bouton; bouton = gtk_button_new_with_label(" Switch On/Off "); - gtk_signal_connect(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(switch_onoff), NULL); + g_signal_connect(bouton, "clicked", G_CALLBACK(switch_onoff), NULL); gtk_table_attach_defaults(GTK_TABLE(table), bouton, 1, 2, 1, 2); gtk_widget_set_sensitive(bouton, FALSE); gtk_widget_show(bouton); b_set = bouton; bouton = gtk_button_new_with_label(" Remove alarm "); - gtk_signal_connect(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(remove_alarm), NULL); + g_signal_connect(bouton, "clicked", G_CALLBACK(remove_alarm), NULL); gtk_table_attach_defaults(GTK_TABLE(table), bouton, 1, 2, 0, 1); gtk_widget_set_sensitive(bouton, FALSE); gtk_widget_show(bouton); @@ -324,18 +308,15 @@ void create_mainwindow() { bouton = gtk_button_new_with_label(" Save "); - gtk_signal_connect(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(save_datas), NULL); - gtk_signal_connect(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(quit_app), NULL); + g_signal_connect(bouton, "clicked", G_CALLBACK(save_datas), NULL); + g_signal_connect(bouton, "clicked", G_CALLBACK(quit_app), NULL); gtk_box_pack_start(GTK_BOX(buttons_hbox), bouton, TRUE, TRUE, 0); gtk_widget_set_can_default(GTK_WIDGET(bouton), TRUE); gtk_widget_grab_default(GTK_WIDGET(bouton)); gtk_widget_show(bouton); bouton = gtk_button_new_with_label(" Cancel "); - gtk_signal_connect(GTK_OBJECT(bouton), "clicked", - GTK_SIGNAL_FUNC(quit_app), NULL); + g_signal_connect(bouton, "clicked", G_CALLBACK(quit_app), NULL); gtk_box_pack_start(GTK_BOX(buttons_hbox), bouton, TRUE, TRUE, 0); gtk_widget_set_can_default(GTK_WIDGET(bouton), TRUE); gtk_widget_show(bouton); diff --git a/wmclockmon/wmclockmon-config/mainwindow.h b/wmclockmon/wmclockmon-config/mainwindow.h index 2395a97..ee04655 100644 --- a/wmclockmon/wmclockmon-config/mainwindow.h +++ b/wmclockmon/wmclockmon-config/mainwindow.h @@ -26,11 +26,7 @@ extern GtkWidget *wid_calalrms; extern int selected_row; -gint list_unsel_cb (GtkCList *clist, - gint row, - gint column, - GdkEventButton *event, - void *data); +void list_unsel_cb(void); void create_mainwindow(); #endif -- 2.11.4.GIT