コード例 #1
0
ファイル: draw.c プロジェクト: djandruczyk/eXtace
void draw_start()
{
	if (!paused)
	{
		/* Check to make sure its not already running */
		if (display_id)
		{
			printf("Bug detected, display already running NON-fatal\n");
			draw_stop();
		}

		if (mode == STARS)
			display_id = gtk_timeout_add(
					(int)
					((1.0/(float)refresh_rate)*1000.0),
					(GtkFunction)kt_stars_update_func,
					stars);
		else
			display_id = gtk_timeout_add(
					(int)
					((1.0/(float)refresh_rate)*1000.0),
					 (GtkFunction)draw, NULL);
	}
	else
		printf("Display in paused state,  click on \"Resume Display\" in the Options Panel\n");

}
コード例 #2
0
ファイル: main.cpp プロジェクト: puring0815/OpenKore
void
extract_files (const char *savedir, GList *files, GList *indices)
{
	GError *err = NULL;
	GList *args;
	guint watcher;

	/* Run extraction as background thread */
	args = g_list_append (NULL, (gpointer) savedir);
	args = g_list_append (args, files);
	args = g_list_append (args, indices);
	memset (&extractProgress, 0, sizeof (ExtractProgress));
	memset (&lastKnownProgress, 0, sizeof (ExtractProgress));
	extractProgress.thread = g_thread_create (extract_thread,
		args, TRUE, &err);
	if (!extractProgress.thread) {
		show_error (_("A system error occured while extracting (unable to create thread).\n%s"),
			err->message);
		g_error_free (err);
		g_list_free (args);
		memset (&extractProgress, 0, sizeof (ExtractProgress));
		return;
	}

	/* Update GUI in main thread */
	mainWin.status (_("Extracting files..."));
	gtk_widget_set_sensitive (W(open), FALSE);
	gtk_widget_set_sensitive (W(extract), FALSE);
	gtk_widget_set_sensitive (W(stop), TRUE);
	gtk_widget_show (W(progressBox));
	watcher = gtk_timeout_add (100, watch_extract_thread, NULL);
	gtk_timeout_add (10, watch_extract_thread_stop, GINT_TO_POINTER (watcher));

	return;
}
コード例 #3
0
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;
}
コード例 #4
0
ファイル: playlist_list.c プロジェクト: sedwards/xmms3
void playlist_list_motion_cb(GtkWidget * widget, GdkEventMotion * event, PlayList_List * pl)
{
	gint nr, y, off, i;

	if (pl->pl_dragging)
	{
		y = event->y - pl->pl_widget.y;
		nr = (y / pl->pl_fheight);
		if (nr < 0)
		{
			nr = 0;
			if (!pl->pl_auto_drag_up)
			{
				pl->pl_auto_drag_up = TRUE;
				pl->pl_auto_drag_up_tag = gtk_timeout_add(100, playlist_list_auto_drag_up_func, pl);
			}
		}
		else if (pl->pl_auto_drag_up)
			pl->pl_auto_drag_up = FALSE;

		if (nr >= pl->pl_num_visible)
		{
			nr = pl->pl_num_visible - 1;
			if (!pl->pl_auto_drag_down)
			{
				pl->pl_auto_drag_down = TRUE;
				pl->pl_auto_drag_down_tag = gtk_timeout_add(100, playlist_list_auto_drag_down_func, pl);
			}
		}
		else if (pl->pl_auto_drag_down)
			pl->pl_auto_drag_down = FALSE;

		off = nr - pl->pl_drag_pos;
		if (off)
		{
			for (i = 0; i < abs(off); i++)
			{
				if (off < 0)
					playlist_list_move_up(pl);
				else
					playlist_list_move_down(pl);

			}
			playlistwin_update_list();
		}
		pl->pl_drag_pos = nr;
	}
}
コード例 #5
0
ファイル: notifier-impl.c プロジェクト: lelou6666/pcmanx-gtk2
static int slow_show_win(gpointer data)
{
	Win *win = (Win *) data;
	int x_diff;
	int x, y;

	if (win->size == NHEIGHT) {
		win->handlerid =
		    g_signal_connect(G_OBJECT(win->win),
				     "enter-notify-event",
				     G_CALLBACK(mouseover_win), data);

		/* Trace animation timeout */
		win->ani_timer_id = 0;
		win->timeout_id = gtk_timeout_add(
			popup_timeout, wait_win, data);
		return FALSE;
	}

	gtk_window_get_position(GTK_WINDOW(win->win), &x, &y);
	y -= STEPS;
	win->size += STEPS;
	x_diff = width - win->win->allocation.width;
	if (x_diff < 0)
		x_diff = 0;
	gtk_window_move(GTK_WINDOW(win->win), x_diff, y);
	return TRUE;
}
コード例 #6
0
ファイル: interface.c プロジェクト: wader/gtktetris
void game_start_stop(GtkMenuItem     *widget,
		     gpointer user_data)
{
  game_play=!game_play;
  gtk_widget_set_sensitive(GTK_WIDGET(widget), FALSE);
  if(game_play)
    {
      gtk_widget_set_sensitive(menu_game_stop,TRUE);
      gtk_widget_set_sensitive(menu_game_quick,FALSE);
      gtk_widget_set_sensitive(menu_game_start,FALSE);
      gtk_widget_set_sensitive(Start_stop_button,TRUE);
      gtk_label_set(GTK_LABEL(Start_stop_button_label),start_stop_str[1]);
      gtk_widget_set_sensitive(Pause_button,TRUE);
      gtk_widget_grab_default(Pause_button);
      game_init();
      make_noise(options.noise_l,options.noise_h);
      from_virtual();
      move_block(0,0,0);
      current_level = options.level;
      update_game_values(0,current_level,0);
      timer = gtk_timeout_add(level_speeds[current_level],(GtkFunction)game_loop,NULL);
    }
  else
    game_over_init();
}
コード例 #7
0
ファイル: GTKWindow.cpp プロジェクト: pontocom/opensdrm
void GTKWindow::ModifyTimer(bool stop)
{
    if (stop)
        gtk_timeout_remove(gtkTimer);
    else
        gtkTimer = gtk_timeout_add(250, do_timeout, this);
}
コード例 #8
0
ファイル: flinn.c プロジェクト: Kasreyn/Flinn
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);
}
コード例 #9
0
ファイル: canal_lock.c プロジェクト: afenkart/gcompris-devel
/* Toggle the given lock */
static void
toggle_lock(GooCanvasItem *item)
{
  gboolean status = TRUE;
  double y1 = 0;
  gint min = 0;
  guint animate_speed = 0;

  /* If there is already an animation do nothing else set animation to avoid deadlock */
  if(animation)
    return;
  animation = TRUE;

  gc_sound_play_ogg ("sounds/bleep.wav", NULL);

  if(item == lock_left_item)
    {
      status = lock_left_up;
      lock_left_up = !lock_left_up;
      y1 = BASE_LINE - LOCK_HEIGHT_MAX;
      min = BASE_LINE - LOCK_HEIGHT_MIN;
      animate_speed = ANIMATE_SPEED;
    }
  else if(item == lock_right_item)
    {
      status = lock_right_up;
      lock_right_up = !lock_right_up;
      y1 = BASE_LINE - LOCK_HEIGHT_MAX;
      min = BASE_LINE - LOCK_RHEIGHT_MIN;
      animate_speed = ANIMATE_SPEED;
    }
  else if(item == canallock_left_item)
    {
      status = canallock_left_up;
      canallock_left_up = !canallock_left_up;
      y1 = SUBCANAL_BASE_LINE - SUBCANAL_HEIGHT;
      min = SUBCANAL_BASE_LINE - CANALLOCK_HEIGHT_MIN;
      animate_speed = ANIMATE_SPEED;
    }
  else if(item == canallock_right_item)
    {
      status = canallock_right_up;
      canallock_right_up = !canallock_right_up;
      y1 = SUBCANAL_BASE_LINE - SUBCANAL_HEIGHT;
      min = SUBCANAL_BASE_LINE - CANALLOCK_HEIGHT_MIN;
      animate_speed = ANIMATE_SPEED;
    }

  timer_item = item;
  timer_item_limit_y = (status ? min :
			y1);
  timer_step_y1 = (status ? 2 : -2);
  timer_step_x1 = 0;

  gc_item_focus_remove(tuxboat_item, NULL);

  timer_id = gtk_timeout_add (animate_speed, (GtkFunction) animate_step,
			      NULL);

}
コード例 #10
0
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);
	}
}
コード例 #11
0
ファイル: send_msg.c プロジェクト: zhousc/project_name
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);
    }
}
コード例 #12
0
ファイル: level.c プロジェクト: kwonyongguk/mine
int levelselect(GtkWidget* widget, gpointer user_data)
{
	int i = 0;
	int num = 0;
	int ran = 0;
	int *d = user_data;
	level_ = *d;
	//int *mine = user_data;
	/*if(widget == button_H)
	{
		level_ = 10;
	}
	else if (widget == button_M)
	{
		level_ = 7;
	}
	else if(widget == button_L)
	{
		level_ = 5;
	}*/
	gtk_widget_destroy((window2));
	while (1)
	{
		if (i == level_)break;
		ran = rand() % 48 + 1;
		if (mine[ran] == 0)
		{
			mine[ran] = 1;
			i++;
		}
	}
	gtk_widget_show_all(window);
	gtk_timeout_add(1000, timer, 0);
	gtk_main();
}
コード例 #13
0
ファイル: transfer.c プロジェクト: GNOME/gftp
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);
}
コード例 #14
0
ファイル: session.c プロジェクト: marschap/isdn4k-utils
/*
 * put a graceful delay into GTK main loop to prevent permanent isdn input
 * callback
 */
static void gtk_isdn_input_defer(session_t* session) {
  gtk_input_remove(session->gtk_isdn_input_tag);
  session->gtk_isdn_input_tag =
    gtk_timeout_add(DEFER_INTERVAL,
                    (GtkFunction) gtk_isdn_input_defer_timeout,
		    session);
}
コード例 #15
0
ファイル: cdaudio.c プロジェクト: sedwards/xmms3
static void stop(void)
{
	struct timeout *to_info;
	if (cdda_playing.fd < 0)
		return;

	cdda_playing.playing = FALSE;
	
	if (cdda_playing.drive.dae)
	{
		pthread_join(dae_data.thread, NULL);
		cdda_ip.output->close_audio();
	}
	else
		ioctl(cdda_playing.fd, XMMS_PAUSE, 0);

	close(cdda_playing.fd);
	cdda_playing.fd = -1;

	if (!cdda_playing.drive.dae)
	{
		to_info = g_malloc(sizeof (*to_info));
		to_info->device = g_strdup(cdda_playing.drive.device);
		to_info->id = gtk_timeout_add(STOP_DELAY * 100, stop_timeout,
					      to_info);
		timeout_list = g_list_prepend(timeout_list, to_info);
	}
}
コード例 #16
0
ファイル: xmms_osd.c プロジェクト: skripac/libxosd
/*
 * Initialize plugin.
 */
static void init(void)
{
  /* font = "-ttf-lucida console-*-r-*-*-60-*-*-*-*-*-*-*"; */
  /* font = "fixed"; */
  /* font = "-misc-fixed-*-*-*-*-40-*-*-*-*-*-*-*"; */
  /* colour = "green"; */

  DEBUG("init");

  if (osd) {
    DEBUG("uniniting osd");
    xosd_uninit(osd);
    osd=NULL;
  }

  read_config ();

  previous_repeat = previous_shuffle = previous_paused = previous_playing =
    FALSE;
  previous_volume = previous_song =
    0;
  previous_title = 0;

  osd = xosd_init (font, colour, timeout, pos, offset, shadow_offset, 2);

  if (osd)
    timeout_tag = gtk_timeout_add (100, timeout_func, NULL);
}
コード例 #17
0
ファイル: notifier-impl.c プロジェクト: lelou6666/pcmanx-gtk2
static Win* begin_animation(GtkWidget * win, GtkWidget * context)
{
	int slot, begin;
	Win *w;

	update_working_area();

	slot = get_slot(win);
	begin = working_area.y + height - slot * NHEIGHT;
	w = g_new0(Win, 1);

	w->win = win;
	w->context = context;
	w->slot = slot;
	w->size = 0;

	gtk_widget_realize(win);
	gtk_window_move(
		GTK_WINDOW(win), 
		working_area.x + width - win->allocation.width, begin);
	gtk_widget_show_all(win);

	w->ani_timer_id = gtk_timeout_add(SPEED, slow_show_win, w);
	w->timeout_id = 0;

	return w;
}
コード例 #18
0
ファイル: gimageview.c プロジェクト: ashie/gimageview
static void
show_splash ()
{
   GtkWidget *window;
   GtkWidget *pixmap;

   pixmap = gimv_icon_stock_get_widget ("gimageview");

   window = gtk_window_new (GTK_WINDOW_POPUP);
   gtk_widget_realize(window);
   gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
   gdk_window_set_decorations(window->window, 0);

   gtk_container_add(GTK_CONTAINER(window), pixmap);
   gimv_icon_stock_free_icon ("gimageview");

   gtk_widget_show(pixmap);
   gtk_widget_show(window);
   gdk_window_raise (window->window);

   while (gtk_events_pending()) gtk_main_iteration();

   splash_timer_id
      = gtk_timeout_add (1500,
                         (GtkFunction) timeout_splash,
                         (gpointer) window);
}
コード例 #19
0
ファイル: notifier-impl.c プロジェクト: lelou6666/pcmanx-gtk2
static int wait_win(gpointer data)
{
	Win *win = (Win *)data;
	win->ani_timer_id = gtk_timeout_add(SPEED, slow_hide_win, data);
	win->timeout_id = 0;
	return FALSE;
}
コード例 #20
0
static void
on_transfer_item_finish (C2TransferItem *ti, C2TransferList *tl)
{
	GtkWidget *progress;
	GSList *list;

	if (GTK_TOGGLE_BUTTON (tl->close)->active && g_slist_length (tl->list) == 1)
		gtk_timeout_add (2500, (GtkFunction) on_last_finish_timeout, tl);
	else
		tl->list = g_slist_remove (tl->list, ti);
	
	progress = ti->progress_byte;
	
	gtk_widget_hide (progress);

	progress = ti->progress_mail;
	
	gtk_progress_set_percentage (GTK_PROGRESS (progress), 1.0);
	gtk_widget_set_sensitive (ti->cancel_button, FALSE);

	if (!g_slist_length (tl->list))
	{
		gtk_signal_emit (GTK_OBJECT (tl), signals[FINISH]);
		tl->finished = 1;
	}
}
コード例 #21
0
ファイル: text_dialog.cpp プロジェクト: qmwd2006/mpeg4ip
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);
    }
}
コード例 #22
0
ファイル: studio-tv.c プロジェクト: AquaSoftGmbH/mjpeg
static void sound_init()
{
   if (mixer_id>0) mixer_fini(mixer_id);
   if (audio_src_list) g_list_free(audio_src_list);
   mixer_id = mixer_init (mixer_dev);
   if (mixer_id<=0)
   {
      g_print("**ERROR: opening mixer device (%s): %s\n",
         mixer_dev, strerror(errno));
   }
   else
   {
      int i; 
      int num_devs = mixer_num_of_devs (mixer_id);
      for (i=0;i<num_devs;i++)
      {
         audio_src_list = g_list_append(audio_src_list,
            (gpointer) mixer_get_label(mixer_id, i));
         if (i==audio_src)
         {
            volume = mixer_get_vol_left(mixer_id, i);
            gtk_timeout_add(100, (GtkFunction) get_volume, NULL);
         }
      }
   }
}
コード例 #23
0
void CTimer::CTimer(int interval_ms, CObject *object, THREAD_METHOD method, void *data) {
   this->method = method;
   this->method_object = object;
   this->method_data = data;

   this->timer_id = gtk_timeout_add(interval_ms, CTimer__LINUX_interval, this);
}/*CTimer::CTimer*/
コード例 #24
0
ファイル: song_change.c プロジェクト: xdien/my_cproject
static void init(void)
{
	read_config();

	previous_song = -1;
	timeout_tag = gtk_timeout_add(100, timeout_func, NULL);
}
コード例 #25
0
ファイル: mapview.c プロジェクト: Fyb3roptik/freeciv-web
/**************************************************************************
  This function will change the current mouse cursor.
**************************************************************************/
void update_mouse_cursor(enum cursor_type new_cursor_type)
{
  cursor_type = new_cursor_type;
  if (!cursor_timer_id) {
    cursor_timer_id = gtk_timeout_add(CURSOR_INTERVAL, anim_cursor_cb, NULL);
  }
}
コード例 #26
0
ファイル: toplevel.cpp プロジェクト: CobaltBlues/wxWidgets
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);
}
コード例 #27
0
ファイル: gui.c プロジェクト: awe00/boards
void run_gui(void)
{
	gtk_signal_connect(GTK_OBJECT(main_window), "delete_event",
		GTK_SIGNAL_FUNC(do_quit), NULL);
	gtk_signal_connect(GTK_OBJECT(quit_button), "pressed",
		GTK_SIGNAL_FUNC(do_quit), NULL);
	gtk_signal_connect(GTK_OBJECT(port_entry), "changed",
		GTK_SIGNAL_FUNC(do_new_port), NULL);
	gtk_signal_connect(GTK_OBJECT(GTK_COMBO(baud_combo)->entry), "changed",
		GTK_SIGNAL_FUNC(do_new_baud), NULL);
	gtk_signal_connect(GTK_OBJECT(firmware_entry), "changed",
		GTK_SIGNAL_FUNC(do_new_file), NULL);
	gtk_signal_connect(GTK_OBJECT(crystal_entry), "changed",
		GTK_SIGNAL_FUNC(do_new_crystal), NULL);
	gtk_signal_connect(GTK_OBJECT(program_button), "pressed",
		GTK_SIGNAL_FUNC(do_program), NULL);
	gtk_signal_connect(GTK_OBJECT(reboot_button), "pressed",
		GTK_SIGNAL_FUNC(do_reboot), NULL);
	gtk_signal_connect(GTK_OBJECT(bootloader_button), "pressed",
		GTK_SIGNAL_FUNC(do_bootloader), NULL);

	gtk_timeout_add(100, do_timer, NULL);
	gdk_input_add(term_fd, GDK_INPUT_READ, do_term_input, NULL);
	gdk_input_add(serial_port_fd(), GDK_INPUT_READ, do_port_input, NULL);

	gtk_main();
}
コード例 #28
0
ファイル: selection.c プロジェクト: fujii/ebview
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;
}
コード例 #29
0
ファイル: gwwvask.c プロジェクト: UIKit0/fontforge-1
void gwwv_post_notice(const char *title, const char *msg, ... ) {
    char buffer[400];
    va_list va;
    GtkWidget *dlg, *lab;
    int timer_id;

    va_start(va,msg);
    vsnprintf( buffer, sizeof(buffer), msg, va);
    va_end(va);

    dlg = gtk_dialog_new_with_buttons(title,NULL,0,
	    GTK_STOCK_OK,GTK_RESPONSE_ACCEPT,NULL);
    g_signal_connect_swapped(G_OBJECT(dlg),"key-press-event",
	    G_CALLBACK(Finish), G_OBJECT(dlg));
    g_signal_connect_swapped(G_OBJECT(dlg),"button-press-event",
	    G_CALLBACK(Finish), G_OBJECT(dlg));
    g_signal_connect_swapped(G_OBJECT(dlg),"response",
	    G_CALLBACK(Finish), G_OBJECT(dlg));
    timer_id = gtk_timeout_add(30*1000,TimerFinish,dlg);
    g_object_set_data(G_OBJECT(dlg),"timer",(void *) timer_id);

    lab = gtk_label_new_with_mnemonic(buffer);
    gtk_widget_show(lab);
    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dlg)->vbox),lab);

    gtk_widget_show(dlg);
    /* Don't wait for it */
}
コード例 #30
0
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);
	}
}