void apply_wind (wind_dialog_struct *wds) { gint t1; hf_wrapper_struct *hfw; hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **) wds->parent_data; if (!hfw->hf_struct->tmp_buf) hf_backup(hfw->hf_struct); t1 = clock(); set_watch_cursor(hfw); switch (wds->process) { case RIPPLES: hf_ripples (hfw->hf_struct, hfw->hf_options->img->ripples, hfw->hf_options->dist_matrix, hfw->hf_options->gauss_list); begin_pending_record(hfw,"Ripples",accept_fn,reset_fn); gtk_widget_set_sensitive(GTK_WIDGET(wds->accept) ,TRUE); break; case DUNES: default: hf_dunes (hfw->hf_struct, hfw->hf_options->img->dunes, hfw->hf_options->dist_matrix, hfw->hf_options->gauss_list); begin_pending_record(hfw,"Dunes",accept_fn,reset_fn); gtk_widget_set_sensitive(GTK_WIDGET(wds->accept) ,TRUE); } // printf("TEMPS D'ÉROSION PAR LE VENT: %d\n",clock() - t1); (*hfw->if_modified) = TRUE; hfw->if_calculated = TRUE; unset_watch_cursor(hfw); }
void apply_voronoi (hf_wrapper_struct *hfw) { // gint t1; if (!hfw->hf_struct->tmp_buf) hf_backup(hfw->hf_struct); if (!hfw->hf_struct->result_buf) hfw->hf_struct->result_buf = (hf_type *) x_malloc(sizeof(hf_type) * hfw->hf_struct->max_x * hfw->hf_struct->max_y, "hf_type (result_buf in apply_voronoi)"); if (!hfw->hf_struct->tmp2_buf) hfw->hf_struct->tmp2_buf = (hf_type *) x_malloc(sizeof(hf_type) * hfw->hf_struct->max_x * hfw->hf_struct->max_y, "hf_type (tmp2_buf in apply_voronoi)"); // t1 = clock(); // Convention: // 1. tmp_buf: original HF // 2. tmp2_buf: distance HF // 3. result_buf: crackled HF (base level + black lines == cracks) // 4. hf_buf: output = crackled HF + distance HF (for lifting edges) set_watch_cursor(hfw); hf_voronoi(hfw->hf_struct, hfw->hf_options->img->voronoi); voronoi_adjust_edges (hfw->hf_struct->result_buf, hfw->hf_struct->hf_buf, hfw->hf_struct->tmp2_buf, hfw->hf_options->img->voronoi->edges_level, hfw->hf_struct->max_x, hfw->hf_struct->max_y); unset_watch_cursor(hfw); // printf("TEMPS DE CRAQU�LEMENT: %d\n",clock() - t1); }
void lastfm_track_unlove_action (GtkWidget *widget, SoundmenuPlugin *soundmenu) { Mpris2Metadata *metadata = NULL; SoundmenuLastfm *lastfm = NULL; LastfmData *data = NULL; if (mpris2_client_get_playback_status (soundmenu->mpris2) == STOPPED) return; lastfm = soundmenu->clastfm; if (lastfm->status != LASTFM_STATUS_OK) { g_critical("No connection Last.fm has been established."); return; } metadata = mpris2_client_get_metadata (soundmenu->mpris2); if (g_str_empty0(mpris2_metadata_get_artist(metadata)) || g_str_empty0(mpris2_metadata_get_title(metadata))) return; data = soundmenu_lastfm_data_new (soundmenu, metadata, 0); set_watch_cursor (GTK_WIDGET(soundmenu->plugin)); soundmenu_async_launch(do_lastfm_current_song_unlove, soundmenu_async_set_idle_message, data); }
void pragha_songinfo_plugin_get_info_to_dialog (PraghaSongInfoPlugin *plugin, GLYR_GET_TYPE type, const gchar *artist, const gchar *title) { PraghaApplication *pragha; GtkWidget *window; GlyrDatabase *cache_db; glyr_struct *glyr_info; glyr_info = g_slice_new0 (glyr_struct); glyr_query_init (&glyr_info->query); glyr_opt_type (&glyr_info->query, type); switch (type) { case GLYR_GET_ARTIST_BIO: glyr_opt_artist(&glyr_info->query, artist); glyr_opt_lang (&glyr_info->query, "auto"); glyr_opt_lang_aware_only (&glyr_info->query, TRUE); break; case GLYR_GET_LYRICS: glyr_opt_artist(&glyr_info->query, artist); glyr_opt_title(&glyr_info->query, title); break; default: break; } cache_db = pragha_songinfo_plugin_get_cache (plugin); glyr_opt_lookup_db (&glyr_info->query, cache_db); glyr_opt_db_autowrite (&glyr_info->query, TRUE); glyr_info->plugin = plugin; pragha = pragha_songinfo_plugin_get_application (plugin); window = pragha_application_get_window (pragha); set_watch_cursor (window); pragha_async_launch (get_related_info_idle_func, glyr_finished_thread_update, glyr_info); }
void pragha_application_append_entery_libary (PraghaApplication *pragha) { PraghaPlaylist *playlist; PraghaDatabase *cdbase; GList *list = NULL; PraghaMusicobject *mobj; /* Query and insert entries */ set_watch_cursor (pragha_application_get_window(pragha)); cdbase = pragha_application_get_database (pragha); const gchar *sql = "SELECT id FROM LOCATION"; PraghaPreparedStatement *statement = pragha_database_create_statement (cdbase, sql); while (pragha_prepared_statement_step (statement)) { gint location_id = pragha_prepared_statement_get_int (statement, 0); mobj = new_musicobject_from_db (cdbase, location_id); if (G_LIKELY(mobj)) list = g_list_prepend (list, mobj); else g_warning ("Unable to retrieve details for" " location_id : %d", location_id); pragha_process_gtk_events (); } pragha_prepared_statement_free (statement); remove_watch_cursor (pragha_application_get_window(pragha)); if (list) { list = g_list_reverse(list); playlist = pragha_application_get_playlist (pragha); pragha_playlist_append_mobj_list (playlist, list); g_list_free(list); } }
static gboolean pragha_scanner_worker_finished (gpointer data) { GtkWidget *msg_dialog; gchar *last_scan_time = NULL; PraghaPreferences *preferences; PraghaDatabase *database; GSList *list; PraghaScanner *scanner = data; /* Stop updates */ g_source_remove(scanner->update_timeout); /* Ensure that the other thread has finished */ g_thread_join (scanner->no_files_thread); /* If not cancelled, update database and show a dialog */ if(!g_cancellable_is_cancelled (scanner->cancellable)) { /* Hide the scanner and show the dialog */ gtk_widget_hide(scanner->hbox); msg_dialog = gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(scanner->hbox))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", _("Library scan complete")); g_signal_connect(G_OBJECT(msg_dialog), "response", G_CALLBACK(pragha_scanner_finished_dialog_response_cb), scanner); g_signal_connect(G_OBJECT(msg_dialog), "delete-event", G_CALLBACK(pragha_scanner_finished_dialog_delete), scanner); gtk_widget_show_all(msg_dialog); /* Save new database and update the library view */ set_watch_cursor(msg_dialog); set_watch_cursor(scanner->hbox); database = pragha_database_get(); pragha_database_begin_transaction (database); pragha_database_flush (database); g_hash_table_foreach (scanner->tracks_table, pragha_scanner_add_track_db, database); /* Import playlist detected. */ for (list = scanner->playlists ; list != NULL; list = list->next) pragha_scanner_import_playlist(database, list->data); pragha_database_commit_transaction (database); pragha_database_change_tracks_done (database); g_object_unref(database); remove_watch_cursor(scanner->hbox); remove_watch_cursor(msg_dialog); /* Save finished time and folders scanned. */ g_get_current_time(&scanner->last_update); last_scan_time = g_time_val_to_iso8601(&scanner->last_update); preferences = pragha_preferences_get(); pragha_preferences_set_string(preferences, GROUP_LIBRARY, KEY_LIBRARY_LAST_SCANNED, last_scan_time); g_free(last_scan_time); pragha_preferences_set_filename_list(preferences, GROUP_LIBRARY, KEY_LIBRARY_SCANNED, scanner->folder_list); g_object_unref(G_OBJECT(preferences)); } else { gtk_widget_hide(scanner->hbox); } gtk_progress_bar_set_text(GTK_PROGRESS_BAR(scanner->progress_bar), NULL); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(scanner->progress_bar), 0.0); /* Clean memory */ g_hash_table_remove_all(scanner->tracks_table); free_str_list(scanner->folder_list); scanner->folder_list = NULL; free_str_list(scanner->folder_scanned); scanner->folder_scanned = NULL; free_str_list(scanner->playlists); scanner->playlists = NULL; scanner->no_files = 0; scanner->files_scanned = 0; g_cancellable_reset (scanner->cancellable); scanner->update_timeout = 0; return FALSE; }