void klientr_v_knopka(GtkWidget *widget,class klientr_v_data *data) { //char bros[300]; int knop=GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(widget))); switch ((gint)knop) { case FK2: data->read_rek(); if(klientr_zap(data) == 0) { if(data->timer != 0) gtk_timeout_remove(data->timer); gtk_widget_destroy(data->window); data->window=NULL; } return; case FK10: if(data->timer != 0) gtk_timeout_remove(data->timer); gtk_widget_destroy(data->window); data->window=NULL; return; } }
bool partMover::sequence_iterator(partMover* currP) { //fprintf(stderr, "calling sequence iterator \n"); IPositionControl *ipos = currP->pos; IEncoders *iiencs = currP->iencs; IAmplifierControl *iamp = currP->amp; IPidControl *ipid = currP->pid; int *SEQUENCE_TMP = currP->SEQUENCE; double *TIMING_TMP = currP->TIMING; double **STORED_POS_TMP = currP->STORED_POS; double **STORED_VEL_TMP = currP->STORED_VEL; int *INV_SEQUENCE_TMP = currP->INV_SEQUENCE; GtkWidget **sliderAry = currP->sliderArray; GtkWidget **sliderVelAry = currP->sliderVelArray; GtkWidget *tree_view = currP->treeview; guint32* timeout_seqeunce_rate_tmp = currP->timeout_seqeunce_rate; guint* timeout_seqeunce_id_tmp = currP->timeout_seqeunce_id; int *SEQUENCE_ITERATOR_TMP = currP->SEQUENCE_ITERATOR; int j = (*SEQUENCE_ITERATOR_TMP); int NUMBER_OF_JOINTS; ipos->getAxes(&NUMBER_OF_JOINTS); if (INV_SEQUENCE_TMP[j]!=-1) { ipos->setRefSpeeds(STORED_VEL_TMP[INV_SEQUENCE_TMP[j]]); ipos->positionMove(STORED_POS_TMP[INV_SEQUENCE_TMP[j]]); for (int k =0; k < NUMBER_OF_JOINTS; k++) { gtk_range_set_value ((GtkRange *) (sliderAry[k]), STORED_POS_TMP[INV_SEQUENCE_TMP[j]][k]); gtk_range_set_value ((GtkRange *) (sliderVelAry[k]), STORED_VEL_TMP[INV_SEQUENCE_TMP[j]][k]); } (*SEQUENCE_ITERATOR_TMP)++; *timeout_seqeunce_rate_tmp = (unsigned int) (TIMING_TMP[j]*1000); gtk_timeout_remove(*timeout_seqeunce_id_tmp); *timeout_seqeunce_id_tmp = gtk_timeout_add(*timeout_seqeunce_rate_tmp, (GtkFunction) sequence_iterator, currP); } else { //restart the sequence if finished *SEQUENCE_ITERATOR_TMP = 0; j = 0; ipos->setRefSpeeds(STORED_VEL_TMP[INV_SEQUENCE_TMP[j]]); ipos->positionMove(STORED_POS_TMP[INV_SEQUENCE_TMP[j]]); for (int k =0; k < NUMBER_OF_JOINTS; k++) { gtk_range_set_value ((GtkRange *) (sliderAry[k]), STORED_POS_TMP[INV_SEQUENCE_TMP[j]][k]); gtk_range_set_value ((GtkRange *) (sliderVelAry[k]), STORED_VEL_TMP[INV_SEQUENCE_TMP[j]][k]); } (*SEQUENCE_ITERATOR_TMP)++; *timeout_seqeunce_rate_tmp = (unsigned int) (TIMING_TMP[j]*1000); gtk_timeout_remove(*timeout_seqeunce_id_tmp); *timeout_seqeunce_id_tmp = gtk_timeout_add(*timeout_seqeunce_rate_tmp, (GtkFunction) sequence_iterator, currP); } return false; }
/* ==================================== */ static gboolean animate_step() { if(!gcomprisBoard) return FALSE; GooCanvasBounds bounds; goo_canvas_item_get_bounds(timer_item, &bounds); if(GOO_IS_CANVAS_SVG(timer_item)) goo_canvas_item_translate(timer_item, timer_step_x1, timer_step_y1); else if(GOO_IS_CANVAS_RECT(timer_item)) g_object_set(timer_item, "x", bounds.x1 + timer_step_x1, "y", bounds.y1 + timer_step_y1, "height", bounds.y2 - bounds.y1 - timer_step_y1, NULL); /* Special case for raising/lowering the boat */ if(boat_position==BOAT_POS_MIDDLE && timer_item==canal_middle_item) { goo_canvas_item_translate(tuxboat_item, 0, timer_step_y1); gc_item_focus_remove(tuxboat_item, NULL); } if((bounds.y1 >= timer_item_limit_y && timer_step_y1 > 0) || (bounds.y1 <= timer_item_limit_y && timer_step_y1 < 0)) { gtk_timeout_remove (timer_id); timer_id = 0; animation = FALSE; update_water(); gc_item_focus_init(tuxboat_item, NULL); g_object_set (tuxboat_item, "svg-id", "#BOAT_NO_SAIL", NULL); } else if((bounds.x1 >= timer_item_limit_x && timer_step_x1 > 0) || (bounds.x1 <= timer_item_limit_x && timer_step_x1 < 0)) { gtk_timeout_remove (timer_id); timer_id = 0; animation = FALSE; update_water(); if (gamewon) { gc_bonus_display(TRUE, GC_BONUS_FLOWER); gamewon = FALSE; } gc_item_focus_init(tuxboat_item, NULL); g_object_set (tuxboat_item, "svg-id", "#BOAT_NO_SAIL", NULL); } return TRUE; }
static gboolean watch_extract_thread_stop (gpointer user_data) { guint watcher; gboolean result = TRUE; g_static_mutex_lock (&extractProgressM); if (extractProgress.status == STATUS_DONE) { char *msg; watcher = GPOINTER_TO_INT (user_data); gtk_timeout_remove (watcher); result = FALSE; if (extractProgress.failed == 0) msg = g_strdup_printf (_("%ld files extracted."), extractProgress.current); else msg = g_strdup_printf (_("%ld files extracted (%ld failed)."), extractProgress.current, extractProgress.failed); mainWin.status (msg); g_free (msg); gtk_widget_hide (W(progressBox)); gtk_widget_set_sensitive (W(open), TRUE); gtk_widget_set_sensitive (W(extract), TRUE); } g_static_mutex_unlock (&extractProgressM); if (!result) { g_thread_join (extractProgress.thread); memset (&lastKnownProgress, 0, sizeof (ExtractProgress)); } return result; }
int gftp_gtk_get_subdirs (gftp_transfer * transfer) { gftpui_callback_data * cdata; long numfiles, numdirs; guint timeout_num; int ret; cdata = g_malloc0 (sizeof (*cdata)); cdata->user_data = transfer; cdata->uidata = transfer->fromwdata; cdata->request = ((gftp_window_data *) transfer->fromwdata)->request; cdata->run_function = _gftp_getdir_thread; cdata->connect_function = gftpui_gtk_tdata_connect; cdata->disconnect_function = gftpui_gtk_tdata_disconnect; cdata->dont_check_connection = 1; cdata->dont_refresh = 1; timeout_num = gtk_timeout_add (100, progress_timeout, transfer); ret = gftpui_common_run_callback_function (cdata); gtk_timeout_remove (timeout_num); numfiles = transfer->numfiles; numdirs = transfer->numdirs; transfer->numfiles = transfer->numdirs = -1; update_directory_download_progress (transfer); transfer->numfiles = numfiles; transfer->numdirs = numdirs; g_free (cdata); return (ret); }
static void wavelan_free(Control *ctrl) { t_wavelan *wavelan; int n; g_return_if_fail(ctrl != NULL); g_return_if_fail(ctrl->data != NULL); wavelan = (t_wavelan *)ctrl->data; /* free tooltips */ g_object_unref(G_OBJECT(wavelan->tooltips)); /* free pixbufs */ for (n = 0; n < 7; ++n) if (wavelan->pb[n] != NULL) g_object_unref(G_OBJECT(wavelan->pb[n])); /* unregister the timer */ if (wavelan->timer_id != 0) gtk_timeout_remove(wavelan->timer_id); /* free the device info */ if (wavelan->device != NULL) wi_close(wavelan->device); if (wavelan->interface != NULL) g_free(wavelan->interface); g_free(wavelan); }
void wxGTKTimerImpl::Stop() { wxASSERT_MSG( m_tag != -1, wxT("should be running") ); gtk_timeout_remove( m_tag ); m_tag = -1; }
void l_klientr_vg_knopka(GtkWidget *widget,class l_klientr_vg_data *data) { int knop=GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(widget))); switch ((gint)knop) { case GFK2: data->read_rek(); if(l_klient_vg_zap(data) != 0) { data->kodkl.new_plus(""); gtk_entry_set_text(GTK_ENTRY(data->entry[E_KODKL]),data->kodkl.ravno_toutf()); } else { klientr_create_list(data->data_sp_kl); gdk_window_set_cursor(data->data_sp_kl->window->window,gdk_cursor_new(ICEB_CURSOR_GDITE)); gtk_widget_grab_focus(data->entry[1]); } return; case GFK10: if(data->timer != 0) gtk_timeout_remove(data->timer); gtk_widget_destroy(data->window); data->window=NULL; return; } }
void destroy_screen_context(struct ScreenContext *screenContext) { region_free_func(screenContext->region); region_free_func(screenContext->vRegion); duallist_destroy(&screenContext->roads, NULL); duallist_destroy(&screenContext->crosses, NULL); duallist_destroy(&screenContext->links, NULL); duallist_destroy(&screenContext->rsus, NULL); duallist_destroy(&screenContext->districts, NULL); duallist_destroy(&screenContext->rivers, NULL); duallist_destroy(&screenContext->surroundings, NULL); hashtable_destroy(&screenContext->routeTable, (void(*)(void*))route_free_func); duallist_destroy(&screenContext->selectedRoutes, NULL); hashtable_destroy(&screenContext->nodeTable, (void(*)(void*))node_free_func); hashtable_destroy(&screenContext->traceTable, (void(*)(void*))trace_free_func); duallist_destroy(&screenContext->selectedTraces, NULL); if(screenContext->contactTableMode == PAIRWISE_TABLE) hashtable_destroy(&screenContext->contactTable, (void(*)(void*))pair_free_func); else hashtable_destroy(&screenContext->contactTable, (void(*)(void*))ego_free_func); duallist_destroy(&screenContext->selected, NULL); hashtable_destroy(&screenContext->cellTable, NULL); free_colormap(screenContext->colormap); gdk_gc_unref(screenContext->gc); if(screenContext->canvas) { g_object_unref(screenContext->canvas); cairo_destroy(screenContext->cr_on_canvas); cairo_destroy(screenContext->cr_on_screen); } if(screenContext->timeout != 0) gtk_timeout_remove(screenContext->timeout); free(screenContext); }
void linphone_gtk_start_record_sound(GtkWidget *w, gpointer data){ LinphoneCore *lc = linphone_gtk_get_core(); AudioStream *stream = NULL; MSSndCardManager *manager = ms_snd_card_manager_get(); gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); if(active){ gchar *path = get_record_file(); stream=audio_stream_new(8888, 8889, FALSE); if(stream != NULL){ audio_stream_start_full(stream,&av_profile,"127.0.0.1",8888,"127.0.0.1",8889,0,0,NULL, path,NULL,ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE); g_object_set_data(G_OBJECT(audio_assistant),"record_stream",stream); } gint timeout_id = gtk_timeout_add(6000,(GtkFunction)linphone_gtk_stop_record,NULL); g_object_set_data(G_OBJECT(audio_assistant),"timeout_id",GINT_TO_POINTER(timeout_id)); g_object_set_data(G_OBJECT(audio_assistant),"path",path); } else { stream = (AudioStream *)g_object_get_data(G_OBJECT(audio_assistant),"record_stream"); gint timeout_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(audio_assistant),"timeout_id")); gtk_timeout_remove(timeout_id); if(stream != NULL){ audio_stream_stop(stream); g_object_set_data(G_OBJECT(audio_assistant),"record_stream",NULL); } update_record_button(FALSE); update_play_button(TRUE); } }
static void select_delete_profiles_stop(gboolean restore_toolbar) { GtkProfileGroup* profileGroup; CN_LOGPRINTF("entry"); profileGroup = GTK_PROFILE_GROUP(g_known_profiles); // set the delete mode gtk_profile_group_set_mode(profileGroup, editMode_e); if (g_select.active) { // stop time-out gtk_timeout_remove(g_select.timerID); g_select.active = FALSE; // unselect all profiles unselect_delete_profiles(); if (restore_toolbar) { // update toolbar toolbar_disableUpdate(); edit_show_trashcan(); toolbar_enableUpdate(); toolbar_synchronise(); } } }
void TonerReplacementDlgCancel(UIStatusWnd *wnd) { if(g_timer_tag != 0){ gtk_timeout_remove(g_timer_tag); } if(wnd == NULL){ goto error; } if(wnd->pAlertCode != NULL){ if((strcmp(wnd->pAlertCode, "CNRotateTonerClose")) && (wnd->toner_replacement_dlg->isModeChanged == TRUE)){ if(cnsktSetReqLong(wnd->pCnskt, DATA_LENGTH_LONG) < 0){ goto error; } if(cnsktSetReqLong(wnd->pCnskt, DREQ_CHG_CARTRIDGEMODE_OFF) < 0){ goto error; } if(SendRequest(wnd, CCPD_DEVICE_REQUEST) < 0){ goto error; } } } HideTonerReplacementDlg(wnd); return; error: ShowMsgDlg(wnd, MSG_TYPE_COMMUNICATION_ERR_SET); HideTonerReplacementDlg(wnd); return; }
void GTKWindow::ModifyTimer(bool stop) { if (stop) gtk_timeout_remove(gtkTimer); else gtkTimer = gtk_timeout_add(250, do_timeout, this); }
static void __verboser(const char *stuff, int opos, int replacelast, int complete) { char *s2[2]; struct timeval tv; int ms; s2[0] = (char *)stuff; s2[1] = NULL; gtk_clist_freeze(GTK_CLIST(verb)); if (replacelast) gtk_clist_remove(GTK_CLIST(verb), GTK_CLIST(verb)->rows - 1); gtk_clist_append(GTK_CLIST(verb), s2); if (!ast_tvzero(last)) { gdk_threads_leave(); gettimeofday(&tv, NULL); if (cleanupid > -1) gtk_timeout_remove(cleanupid); ms = ast_tvdiff_ms(tv, last); if (ms < 100) { /* We just got a message within 100ms, so just schedule an update in the near future */ cleanupid = gtk_timeout_add(200, cleanup, NULL); } else { cleanup(&cleanupid); } last = tv; } else { gettimeofday(&last, NULL); } }
/* * in : boolean TRUE = PAUSE : FALSE = CONTINUE * */ static void pause_board (gboolean pause) { if(gcomprisBoard==NULL) return; if(gamewon == TRUE && pause == FALSE) /* the game is won */ { game_won(); } if(pause) { if (animate_id) { gtk_timeout_remove (animate_id); animate_id = 0; } } else { if(animate_item) { animate_id = gtk_timeout_add (200, (GtkFunction) animate_items, NULL); } } board_paused = pause; }
void auto_lookup_start() { if(selection_mode == SELECTION_DO_NOTHING) return; #ifdef __WIN32__ if(registered == FALSE) { if(OrgWndProc == NULL){ hidden_hwnd = GDK_WINDOW_HWND (hidden_window->window); OrgWndProc = (WNDPROC)GetWindowLong(hidden_hwnd, GWL_WNDPROC); SetWindowLong(hidden_hwnd, GWL_WNDPROC, (LONG)HiddenWndProc); } next_hwnd = SetClipboardViewer(hidden_hwnd); } registered = TRUE; #else if(tag_timeout != 0) gtk_timeout_remove(tag_timeout); tag_timeout = gtk_timeout_add(auto_interval, copy_clipboard_x, NULL); #endif auto_lookup_suspended = FALSE; }
static VALUE rg_m_timeout_remove(VALUE self, VALUE id) { gtk_timeout_remove(NUM2UINT(id)); G_REMOVE_RELATIVE(self, id__timeout_callbacks__, id); return Qnil; }
int gnome_close_panel (GtkWidget *widget, WPanel *panel) { Dlg_head *h = panel->widget.parent; if (panel->timer_id){ gtk_timeout_remove (panel->timer_id); panel->timer_id = -1; } /* Remove the widgets from the dialog head */ remove_widget (h, panel->current_dir); remove_widget (h, panel->filter_w); remove_widget (h, panel); /* Kill them */ destroy_widget (panel->current_dir); destroy_widget (panel->filter_w); destroy_widget ((void *)panel); layout_panel_gone (panel); mc_chdir ("/"); return TRUE; }
static void wireless_applet_destroy (WirelessApplet *applet, gpointer horse) { int i; g_free (applet->device); g_list_foreach (applet->devices, (GFunc)g_free, NULL); g_list_free (applet->devices); if (applet->timeout_handler_id > 0) { gtk_timeout_remove (applet->timeout_handler_id); applet->timeout_handler_id = 0; } for (i = 0; i < PIX_NUMBER; i++) g_object_unref (applet->pixmaps[i]); if (applet->about_dialog) { gtk_widget_destroy (applet->about_dialog); applet->about_dialog = NULL; } if (applet->prefs) { gtk_widget_destroy (applet->prefs); applet->prefs = NULL; } if (applet->tips) g_object_unref (applet->tips); }
void button_clicked(GtkWidget *widget, gpointer data) { const gchar *entry_text; char buffer[64]={0}; char buf[1024]={0}; char buf1[1024]={0}; int i = gtk_combo_box_get_active((GtkComboBox *)combo); GtkTextBuffer *buffer_text; GtkTextIter start, end; buffer_text = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)); gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (buffer_text), &start, &end); entry_text = gtk_text_buffer_get_text(buffer_text,&start,&end,TRUE); snprintf(buf,1024,"%s", g_convert(entry_text,-1,"GBK", "UTF-8", NULL, NULL, NULL)); if(strlen(buf) > 0) { printf ("Entry contents: [%d]%s\n",strlen(buf),buf); g_print ("==>> active %d [%s]\n",i,g_context[i].id); snprintf(buf1,128,"PCCMDYJ01001%s%s",g_context[i].id,buf); printf("===>>>[%s]\n",buf1); send_cmd(buf1,strlen(buf1)); loop++; snprintf(buffer,64,"信息已经送出[%d]",loop); gtk_label_set_text((GtkLabel *)lable14,buffer); if(tag) { gtk_timeout_remove(tag); tag = 0; } tag = gtk_timeout_add(5000,timeout_callback,NULL); } }
void wxTopLevelWindowGTK::RequestUserAttention(int flags) { bool new_hint_value = false; // FIXME: This is a workaround to focus handling problem // If RequestUserAttention is called for example right after a wxSleep, OnInternalIdle hasn't // yet been processed, and the internal focus system is not up to date yet. // wxYieldIfNeeded ensures the processing of it, but can have unwanted side effects - MR ::wxYieldIfNeeded(); if(m_urgency_hint >= 0) gtk_timeout_remove(m_urgency_hint); m_urgency_hint = -2; if( GTK_WIDGET_REALIZED(m_widget) && !IsActive() ) { new_hint_value = true; if (flags & wxUSER_ATTENTION_INFO) { m_urgency_hint = gtk_timeout_add(5000, (GtkFunction)gtk_frame_urgency_timer_callback, this); } else { m_urgency_hint = -1; } } wxgtk_window_set_urgency_hint(GTK_WINDOW( m_widget ), new_hint_value); }
void timeout_restart(void) { idle_restart(); if (timeout_id != 0) { gtk_timeout_remove(timeout_id); } timeout_id = gtk_timeout_add(IDLE_MSECS,timeout_trigger,NULL); }
static void cancel_thread(GtkWidget *widget, gpointer *data) { LOG(LOG_DEBUG, "IN : cancel_thread()"); gtk_timeout_remove(tag_timeout); gtk_grab_remove(cancel_dialog); gtk_widget_destroy(cancel_dialog); pthread_cancel(tid); thread_running = 0; cancel_dialog=NULL; label_cancel=NULL; show_result_tree(); push_message("\n"); push_message(_("Canceled")); push_message("\n"); if(search_result == NULL) push_message(_("No hit.")); LOG(LOG_DEBUG, "OUT : cancel_thread()"); }
/* * Procedure to deallocate all resources of the given jc structure * and the structure itself. The given jc should not be referenced * again after this call. */ void JCDelete(jc_struct *jc) { if(jc == NULL) return; /* Delete joystick properties dialog. */ JCJSPropsDelete(jc->jsprops); jc->jsprops = NULL; /* Remove timeout id (as needed). */ if(jc->manage_toid != (guint)-1) { gtk_timeout_remove(jc->manage_toid); jc->manage_toid = (guint)-1; } /* Close joystick. */ JCDoCloseJoystick(jc); /* Destroy all widgets. */ JCDestroyWidgets(jc); /* Deallocate memory. */ g_free(jc->calib_file); jc->calib_file = NULL; /* Deallocate structure itself. */ g_free(jc); }
static void on_SendButton_clicked (GtkButton *button, gpointer user_data) { GtkWidget *dialog = GTK_WIDGET(user_data); GtkWidget *wid = lookup_widget(dialog, "LineEntry"); const char *line = gtk_entry_get_text(GTK_ENTRY(wid)); if (AVFlow->GetTextSource() == NULL) { error_message("no text source"); return; } AVFlow->GetTextSource()->SourceString(line); char buffer[60]; snprintf(buffer, sizeof(buffer),"Wrote: %.25s...", line); wid = lookup_widget(dialog, "statusbar2"); gtk_statusbar_pop(GTK_STATUSBAR(wid), 0); gtk_statusbar_push(GTK_STATUSBAR(wid), 0, buffer); if (timer_id != 0) { gtk_timeout_remove(timer_id); } timer_id = gtk_timeout_add(3 * 1000, on_TextDialog_timeout, user_data); text_file_data_t *tptr = GetTextFileDataFromUserData(user_data); if (tptr != NULL) { ReadNextLine(tptr); DisplayLineInBuffer(user_data, tptr); } }
void wxTimer::Stop() { if (m_tag != -1) { gtk_timeout_remove( m_tag ); m_tag = -1; } }
void window_destroy(GtkWidget* _window, gpointer data) { struct OsecpuWindow* window = data; gtk_widget_destroy(GTK_WIDGET(window->window)); g_async_queue_unref(window->queue); gtk_timeout_remove(window->queue_timer); gtk_main_quit(); }
static void disable_timeout () { if (ball_timeout_id != -1){ gtk_timeout_remove (ball_timeout_id); ball_timeout_id = -1; } }
static void gtkui_stop_stats(void) { DEBUG_MSG("gtk_stop_stats"); gtk_timeout_remove(stats_idle); gtk_widget_destroy(stats_window); stats_window = NULL; }
void partMover::disable_entry_update(partMover* currentPartMover) { guint* entry_label = currentPartMover->entry_id; if (*entry_label!=-1) gtk_timeout_remove(*entry_label); return; }