mirror of
https://github.com/raphnet/gc_n64_usb-v3
synced 2024-12-22 07:18:52 -05:00
Poll for connected controller type (updates live)
This commit is contained in:
parent
9c43932abe
commit
d22640c234
@ -400,6 +400,19 @@ static void updateGuiFromAdapter(struct application *app)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean periodic_updater(gpointer data)
|
||||||
|
{
|
||||||
|
struct application *app = data;
|
||||||
|
GET_UI_ELEMENT(GtkLabel, label_controller_type);
|
||||||
|
int controller_type;
|
||||||
|
|
||||||
|
if (app->current_adapter_handle) {
|
||||||
|
controller_type = gcn64lib_getControllerType(app->current_adapter_handle, 0);
|
||||||
|
gtk_label_set_text(label_controller_type, gcn64lib_controllerName(controller_type));
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
G_MODULE_EXPORT void pollIntervalChanged(GtkWidget *win, gpointer data)
|
G_MODULE_EXPORT void pollIntervalChanged(GtkWidget *win, gpointer data)
|
||||||
{
|
{
|
||||||
struct application *app = data;
|
struct application *app = data;
|
||||||
@ -655,6 +668,8 @@ main( int argc,
|
|||||||
/* Connect signals */
|
/* Connect signals */
|
||||||
gtk_builder_connect_signals( app.builder, &app );
|
gtk_builder_connect_signals( app.builder, &app );
|
||||||
|
|
||||||
|
g_timeout_add_seconds(1, periodic_updater, &app);
|
||||||
|
|
||||||
/* Show window. All other widgets are automatically shown by GtkBuilder */
|
/* Show window. All other widgets are automatically shown by GtkBuilder */
|
||||||
gtk_widget_show( GTK_WIDGET(window) );
|
gtk_widget_show( GTK_WIDGET(window) );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user