static DBusHandlerResult supplicant_filter(DBusConnection *conn, DBusMessage *msg, void *data) { struct supplicant_task *task; const char *member, *path; if (dbus_message_has_interface(msg, SUPPLICANT_INTF ".Interface") == FALSE) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; member = dbus_message_get_member(msg); if (member == NULL) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; path = dbus_message_get_path(msg); if (path == NULL) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; task = find_task_by_path(path); if (task == NULL) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; _DBG_SUPPLICANT("task %p member %s", task, member); if (g_str_equal(member, "ScanResultsAvailable") == TRUE) scan_results_available(task); else if (g_str_equal(member, "Scanning") == TRUE) scanning(task, msg); else if (g_str_equal(member, "StateChange") == TRUE) state_change(task, msg); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; }
static gboolean scanning_call_back(gpointer data) { #if MY_DEBUG_OUT == 2 g_print("go into scanning_call_back\n"); #endif GtkWidget *gtk_list = GTK_WIDGET(data); #if MY_PC_DEBUG == 0 int i; for(i=1;i<=10;i++) { pp[i].NET_NUMBER=0; } pp = scanning(); fill_wifi_list(gtk_list, pp); #else #if MY_DEBUG_OUT == 2 sleep(1); g_print("scanning_call_back after sleep\n"); #endif fill_wifi_list(gtk_list, pp+1); #endif gtk_widget_set_sensitive(Scan_Button, TRUE); gtk_widget_set_sensitive(Connect_Button, TRUE); gtk_widget_set_sensitive(Ok_Button, TRUE); #if MY_DEBUG_OUT == 2 g_print("go outof scanning_call_back\n"); #endif return FALSE; }
/// @brief Constructor CollectionTreeWidget::CollectionTreeWidget() { setColumnCount(1); header()->hide(); // hide headers setDragEnabled(true); setAcceptDrops(true); setSelectionMode(QAbstractItemView::ExtendedSelection); service = new CollectionService(); // Add songs that currently exist on database QSqlTableModel *artistModel = service->artistModel(); artistModel->select(); // TODO: verify if we can put fetchmore() inside the for loop. // TODO: put this task in background... URGENT while (artistModel->canFetchMore()) artistModel->fetchMore(); int total = artistModel->rowCount(); for (int i = 0; i < total; i++) { QString artist = artistModel->record(i).value(artistModel->fieldIndex("name")).toString(); unsigned int id = artistModel->record(i).value(artistModel->fieldIndex("id")).toInt(); addArtist(artist, id); } delete artistModel; /* * TODO: modify the slots in order to add only the artist, not the music. * The album and song must be shown only if the node is already expanded. */ connect(service, SIGNAL(songAdded(Music*)), this, SLOT(addMusic(Music*))); connect(service, SIGNAL(songRemoved(unsigned int)), this, SLOT(removeMusic(uint))); connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(doubleClickAt(QModelIndex))); connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(showChildrenOf(QModelIndex))); /* * We shall emit those signals to show or hide the widget that will * give the feedback that the collection is being scanned. */ connect(service, SIGNAL(scanning()), this, SIGNAL(scanning())); connect(service, SIGNAL(listUpdated()), this, SIGNAL(listUpdated())); // Start service to find new songs and remove the inexistent ones service->start(QThread::LowestPriority); }
int main() { setlocale(LC_ALL, "Russian"); double r = 0.0, proc = 0.0; r = scanning(); printf("\n %.1f %% \n", r); proc = complete_ten_words(r); printf("\n %.1f %% \n", proc); return 0; }
void main() { int k; FILE *fptr; fptr=fopen("questions.txt","w"); question q[10]; if(fptr==NULL) {printf("Error .....");} else { scanning(q,2); for(k=0;k<2;k++) fwrite(&q[k],sizeof(q[k]),1,fptr); printing(q,2); } fclose(fptr); }
gint main(gint argc, gchar *argv[]) { GtkWidget *window; GtkWidget *vbox; GtkWidget *gtk_list; GtkWidget *fixed; GtkWidget *button; gtk_init(&argc, &argv); //HildonProgram *program; //HildonWindow *window; //program = HILDON_PROGRAM(hildon_program_get_instance()); //g_set_application_name("Hello maemo!"); //window = HILDON_WINDOW(hildon_window_new()); //hildon_program_add_window(program, window); /*window*/ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); gtk_window_set_title(GTK_WINDOW(window), "test radio"); /*vbox*/ vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); /*gtklist*/ #if MY_PC_DEBUG == 0 pp = scanning(); #endif gtk_list = gtk_list_new(); fill_wifi_list(gtk_list, pp); gtk_widget_set_size_request (gtk_list, LIST_WIDTH, LIST_HEIGHT); gtk_box_pack_start(GTK_BOX(vbox), gtk_list, FALSE, FALSE, 0); /*fixed*/ fixed = gtk_fixed_new(); gtk_box_pack_start(GTK_BOX(vbox), fixed, FALSE, FALSE, 0); /*button*/ button = gtk_button_new_with_label("Scan"); Scan_Button = button; g_signal_connect (Scan_Button, "clicked", G_CALLBACK (Scan_Button_Pressed), gtk_list); gtk_widget_set_size_request (Scan_Button, CTL_BTN_WIDTH, CTL_BTN_HEIGHT); gtk_fixed_put(GTK_FIXED(fixed), Scan_Button, SCANBTN_X, SCANBTN_Y); button = gtk_button_new_with_label("Connect"); Connect_Button = button; g_signal_connect (Connect_Button, "clicked", G_CALLBACK (Connect_Button_Pressed), gtk_list); gtk_widget_set_size_request (Connect_Button, CTL_BTN_WIDTH, CTL_BTN_HEIGHT); gtk_fixed_put(GTK_FIXED(fixed), Connect_Button, CONTBTN_X, CONTBTN_Y); button = gtk_button_new_with_label("Ok"); Ok_Button = button; g_signal_connect (Ok_Button, "clicked", G_CALLBACK (Ok_Button_Pressed), gtk_list); gtk_widget_set_size_request (Ok_Button, CTL_BTN_WIDTH, CTL_BTN_HEIGHT); gtk_fixed_put(GTK_FIXED(fixed), button, OKBTN_X, OKBTN_Y); button = gtk_button_new_with_label("Cancel"); Cancel_Button = button; g_signal_connect (Cancel_Button, "clicked", G_CALLBACK (Cancel_Button_Pressed), gtk_list); gtk_widget_set_size_request (Cancel_Button, CTL_BTN_WIDTH, CTL_BTN_HEIGHT); gtk_fixed_put(GTK_FIXED(fixed), Cancel_Button, CACLBTN_X, CACLBTN_Y); gtk_widget_show_all(fixed); gtk_widget_show_all(window); gtk_main(); return 0; }