static int module_close(void) { cmd_unregister(cmdv); if (mod_obj.run) { gdk_threads_enter(); gtk_main_quit(); gdk_threads_leave(); } pthread_join(mod_obj.thread, NULL); mem_deref(mod_obj.mq); aufilt_unregister(&vumeter); message_close(); #ifdef USE_LIBNOTIFY if (notify_is_initted()) notify_uninit(); #endif g_slist_free(mod_obj.accounts_menu_group); g_slist_free(mod_obj.call_windows); g_slist_free(mod_obj.incoming_call_menus); uag_event_unregister(ua_event_handler); return 0; }
static int module_close(void) { uag_event_unregister(ua_event_handler); tmr_cancel(&tmr); list_flush(&mwil); return 0; }
void publisher_close(void) { struct le *le; uag_event_unregister(pub_ua_event_handler); for (le = list_head(&publ); le; le = le->next) { struct publisher *pub = le->data; ua_presence_status_set(pub->ua, PRESENCE_CLOSED); pub->expires = 0; publish(pub); } list_flush(&publ); }
static void ua_event_handler(struct ua *ua, enum ua_event ev, struct call *call, const char *prm, void *arg ) { (void)call; (void)prm; if (ua != (struct ua *)arg) return; if (ev == UA_EVENT_REGISTER_OK) { uag_event_unregister(ua_event_handler); mwi_subscribe(ua); } }
static void *gtk_thread(void *arg) { struct gtk_mod *mod = arg; GtkMenuShell *app_menu; GtkWidget *item; GError *err = NULL; struct le *le; gdk_threads_init(); gtk_init(0, NULL); g_set_application_name("baresip"); mod->app = g_application_new ("com.creytiv.baresip", G_APPLICATION_FLAGS_NONE); g_application_register (G_APPLICATION (mod->app), NULL, &err); if (err != NULL) { warning ("Unable to register GApplication: %s", err->message); g_error_free (err); err = NULL; } #ifdef USE_LIBNOTIFY notify_init("baresip"); #endif mod->status_icon = gtk_status_icon_new_from_icon_name("call-start"); gtk_status_icon_set_tooltip_text (mod->status_icon, "baresip"); g_signal_connect(G_OBJECT(mod->status_icon), "button_press_event", G_CALLBACK(status_icon_on_button_press), mod); gtk_status_icon_set_visible(mod->status_icon, TRUE); mod->contacts_inited = false; mod->dial_dialog = NULL; mod->call_windows = NULL; mod->incoming_call_menus = NULL; /* App menu */ mod->app_menu = gtk_menu_new(); app_menu = GTK_MENU_SHELL(mod->app_menu); /* Account submenu */ mod->accounts_menu = gtk_menu_new(); mod->accounts_menu_group = NULL; item = gtk_menu_item_new_with_mnemonic("_Account"); gtk_menu_shell_append(app_menu, item); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), mod->accounts_menu); /* Add accounts to submenu */ for (le = list_head(uag_list()); le; le = le->next) { struct ua *ua = le->data; accounts_menu_add_item(mod, ua); } /* Status submenu */ mod->status_menu = gtk_menu_new(); item = gtk_menu_item_new_with_mnemonic("_Status"); gtk_menu_shell_append(GTK_MENU_SHELL(app_menu), item); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), mod->status_menu); /* Open */ item = gtk_radio_menu_item_new_with_label(NULL, "Open"); g_object_set_data(G_OBJECT(item), "presence", GINT_TO_POINTER(PRESENCE_OPEN)); g_signal_connect(item, "activate", G_CALLBACK(menu_on_presence_set), mod); gtk_menu_shell_append(GTK_MENU_SHELL(mod->status_menu), item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); /* Closed */ item = gtk_radio_menu_item_new_with_label_from_widget( GTK_RADIO_MENU_ITEM(item), "Closed"); g_object_set_data(G_OBJECT(item), "presence", GINT_TO_POINTER(PRESENCE_CLOSED)); g_signal_connect(item, "activate", G_CALLBACK(menu_on_presence_set), mod); gtk_menu_shell_append(GTK_MENU_SHELL(mod->status_menu), item); gtk_menu_shell_append(app_menu, gtk_separator_menu_item_new()); /* Dial */ item = gtk_menu_item_new_with_mnemonic("_Dial..."); gtk_menu_shell_append(app_menu, item); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(menu_on_dial), mod); /* Dial contact */ mod->contacts_menu = gtk_menu_new(); item = gtk_menu_item_new_with_mnemonic("Dial _contact"); gtk_menu_shell_append(app_menu, item); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), mod->contacts_menu); gtk_menu_shell_append(app_menu, gtk_separator_menu_item_new()); /* About */ item = gtk_menu_item_new_with_mnemonic("A_bout"); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(menu_on_about), mod); gtk_menu_shell_append(app_menu, item); gtk_menu_shell_append(app_menu, gtk_separator_menu_item_new()); /* Quit */ item = gtk_menu_item_new_with_mnemonic("_Quit"); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(menu_on_quit), mod); gtk_menu_shell_append(app_menu, item); g_action_map_add_action_entries(G_ACTION_MAP(mod->app), app_entries, G_N_ELEMENTS(app_entries), mod); info("gtk_menu starting\n"); uag_event_register( ua_event_handler, mod ); mod->run = true; gtk_main(); mod->run = false; uag_event_unregister(ua_event_handler); if (mod->dial_dialog) { mem_deref(mod->dial_dialog); mod->dial_dialog = NULL; } return NULL; }
void mqtt_publish_close(void) { uag_event_unregister(&ua_event_handler); }