Exemple #1
0
static void on_realize(GritsOpenGL *opengl, gpointer _)
{
	g_debug("GritsOpenGL: on_realize");
	gtk_gl_begin(GTK_WIDGET(opengl));

	/* Connect signals and idle functions now that opengl is fully initialized */
	gtk_widget_add_events(GTK_WIDGET(opengl), GDK_KEY_PRESS_MASK);
	g_signal_connect(opengl, "configure-event",  G_CALLBACK(on_configure),    NULL);
	g_signal_connect(opengl, "expose-event",     G_CALLBACK(on_expose),       NULL);

	g_signal_connect(opengl, "key-press-event",  G_CALLBACK(on_key_press),    NULL);

	g_signal_connect(opengl, "location-changed", G_CALLBACK(on_view_changed), NULL);
	g_signal_connect(opengl, "rotation-changed", G_CALLBACK(on_view_changed), NULL);

	g_signal_connect(opengl, "motion-notify-event", G_CALLBACK(on_motion_notify), NULL);
	g_signal_connect_after(opengl, "key-press-event",      G_CALLBACK(on_chained_event), NULL);
	g_signal_connect_after(opengl, "key-release-event",    G_CALLBACK(on_chained_event), NULL);
	g_signal_connect_after(opengl, "button-press-event",   G_CALLBACK(on_chained_event), NULL);
	g_signal_connect_after(opengl, "button-release-event", G_CALLBACK(on_chained_event), NULL);
	g_signal_connect_after(opengl, "motion-notify-event",  G_CALLBACK(on_chained_event), NULL);

#ifndef ROAM_DEBUG
	opengl->sm_source[0] = g_timeout_add_full(G_PRIORITY_HIGH_IDLE+30, 33,  (GSourceFunc)on_idle, opengl, NULL);
	opengl->sm_source[1] = g_timeout_add_full(G_PRIORITY_HIGH_IDLE+10, 500, (GSourceFunc)on_idle, opengl, NULL);
#else
	(void)on_idle;
	(void)_update_errors_cb;
#endif

	/* Re-queue resize incase configure was triggered before realize */
	gtk_widget_queue_resize(GTK_WIDGET(opengl));
}
Exemple #2
0
static gboolean vibrator_timed_outputclass_onToggleTimeout (VibratorTimedOutputClass* self) {
	gboolean result = FALSE;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->on;
	if (!_tmp0_) {
		guint _tmp1_;
		guint _tmp2_;
		guint _tmp3_ = 0U;
		_tmp1_ = self->priv->don;
		vibrator_timed_outputclass_set_enable (self, (gint) _tmp1_);
		_tmp2_ = self->priv->don;
		_tmp3_ = g_timeout_add_full (G_PRIORITY_DEFAULT, _tmp2_, _vibrator_timed_outputclass_onToggleTimeout_gsource_func, g_object_ref (self), g_object_unref);
		self->priv->smalltimeoutwatch = _tmp3_;
	} else {
		guint _tmp4_;
		guint _tmp5_;
		_tmp4_ = self->priv->pulses;
		self->priv->pulses = _tmp4_ - 1;
		_tmp5_ = self->priv->pulses;
		if (_tmp5_ > ((guint) 0)) {
			guint _tmp6_;
			guint _tmp7_ = 0U;
			self->priv->on = FALSE;
			_tmp6_ = self->priv->doff;
			_tmp7_ = g_timeout_add_full (G_PRIORITY_DEFAULT, _tmp6_, _vibrator_timed_outputclass_onToggleTimeout_gsource_func, g_object_ref (self), g_object_unref);
			self->priv->smalltimeoutwatch = _tmp7_;
		}
	}
	result = FALSE;
	return result;
}
Exemple #3
0
static void
scan_start (unsigned int timestamp)
{
  ScanState *state = scan_state();
  switch (state->timer_state)
    {
    case SCAN_IDLE:
      state->timer_state = SCAN_LINES;
      state->scan_column = 0;
      state->scan_row = 0;
      g_timeout_add_full (G_PRIORITY_HIGH_IDLE, 600, increment_scan, state, NULL);
      select_line (state->scan_row);
      break;
    case SCAN_LINES_DONE:
      state->timer_state = SCAN_KEYS;
      g_timeout_add_full (G_PRIORITY_HIGH_IDLE, 600, increment_scan, state, NULL);
      deselect_line (state->scan_row);
      select_key (state->scan_row, state->scan_column);
      break;
    case SCAN_KEYS_DONE:
      gtk_button_clicked (buttons[state->scan_row][state->scan_column]);
      deselect_key (state->scan_row, state->scan_column);
      state->timer_state = SCAN_IDLE;
      break;
    default:
      g_print("unexpected state for 'scan start'\n");
    }
}
Exemple #4
0
void	ug_app_cmd_run (UgAppCmd* app)
{
	ug_app_cmd_load (app);

	if (app->category_list == NULL) {
		app->category_list = g_list_append (app->category_list, ug_category_new_with_cmd());
		app->category_list = g_list_append (app->category_list, ug_category_new_with_cmd());
	}

	ug_running_init (&app->running);

	app->main_loop = g_main_loop_new (NULL, FALSE);

	// 0.5 seconds
	g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 500,
						(GSourceFunc) ug_app_cmd_timer_ipc, app, NULL);
	// 0.5 seconds
	g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 500,
						(GSourceFunc) ug_running_dispatch, &app->running, NULL);
	// 1 seconds
	g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 1000,
						(GSourceFunc) ug_app_cmd_timer_queuing, app, NULL);

	g_main_loop_run (app->main_loop);
}
gint
aosd_osd_display ( gchar * markup_string , aosd_cfg_osd_t * cfg_osd , gboolean copy_cfg )
{
  if ( osd != NULL )
  {
    if ( osd_status == AOSD_STATUS_HIDDEN )
    {
      aosd_osd_data_alloc( markup_string , cfg_osd , copy_cfg );
      aosd_osd_create();
      osd_status = AOSD_STATUS_FADEIN;
      osd_source_id = g_timeout_add_full( G_PRIORITY_DEFAULT_IDLE , AOSD_TIMING ,
                                          aosd_timer_func , NULL , NULL );
    }
    else
    {
      g_source_remove( osd_source_id ); /* remove timer */
      osd_source_id = 0;
      aosd_osd_hide();
      aosd_osd_data_free();
      osd_status = AOSD_STATUS_HIDDEN;
      /* now display new OSD */
      aosd_osd_data_alloc( markup_string , cfg_osd , copy_cfg );
      aosd_osd_create();
      osd_status = AOSD_STATUS_FADEIN;
      osd_source_id = g_timeout_add_full( G_PRIORITY_DEFAULT_IDLE , AOSD_TIMING ,
                                          aosd_timer_func , NULL , NULL );
    }
    return 0;
  }
  else
  {
    g_warning( "OSD display requested, but no osd object is loaded!\n" );
  }
  return 1;
}
Exemple #6
0
void vfs_dir_emit_file_changed( VFSDir* dir, const char* file_name,
                                        VFSFileInfo* file, gboolean force )
{
    GList* l;
//printf("vfs_dir_emit_file_changed dir=%s file_name=%s avoid=%s\n", dir->path, file_name, dir->avoid_changes ? "TRUE" : "FALSE" );

    if ( !force && dir->avoid_changes )
        return;

    if ( G_UNLIKELY( 0 == strcmp(file_name, dir->path) ) )
    {
        // Special Case: The directory itself was changed
        g_signal_emit( dir, signals[ FILE_CHANGED_SIGNAL ], 0, NULL );
        return;
    }

    g_mutex_lock( dir->mutex );

    l = vfs_dir_find_file( dir, file_name, file );
    if ( G_LIKELY( l ) )
    {
        file = vfs_file_info_ref( ( VFSFileInfo* ) l->data );
        if( !g_slist_find( dir->changed_files, file ) )
        {
            if ( force )
            {
                dir->changed_files = g_slist_prepend( dir->changed_files, file );
                if ( 0 == change_notify_timeout )
                {
                    change_notify_timeout = g_timeout_add_full( G_PRIORITY_LOW,
                                                                100,
                                                                notify_file_change,
                                                                NULL, NULL );
                }
            }
            else if( G_LIKELY( update_file_info( dir, file ) ) ) // update file info the first time
            {
                dir->changed_files = g_slist_prepend( dir->changed_files, file );
                if ( 0 == change_notify_timeout )
                {
                    change_notify_timeout = g_timeout_add_full( G_PRIORITY_LOW,
                                                                500,
                                                                notify_file_change,
                                                                NULL, NULL );
                }
                g_signal_emit( dir, signals[ FILE_CHANGED_SIGNAL ], 0, file );
            }
        }
        else
            vfs_file_info_unref( file );
    }

    g_mutex_unlock( dir->mutex );
}
static void
xfdesktop_volume_icon_changed(GVolume *volume,
                              XfdesktopVolumeIcon *volume_icon)
{
    g_return_if_fail(G_IS_VOLUME(volume));
    g_return_if_fail(XFDESKTOP_IS_VOLUME_ICON(volume_icon));

    DBG("VOLUME CHANGED");

    /**
     * NOTE: We use a timeout here to check if the volume is 
     * now mounted (or has been unmounted). This timeout seems
     * to be needed because when the "changed" signal is emitted,
     * the GMount is always NULL. In a 500ms timeout we check
     * at most 5 times for a valid mount until we give up. This
     * hopefully is a suitable workaround for most machines and
     * drives. 
     */

    /* abort an existing timeout, we may have to run it a few times
     * once again for the new event */
    if(volume_icon->priv->changed_timeout_id > 0) {
        g_source_remove(volume_icon->priv->changed_timeout_id);
        volume_icon->priv->changed_timeout_id = 0;
    }

    /* reset timeout information and start a timeout */
    volume_icon->priv->changed_timeout_count = 0;
    volume_icon->priv->changed_timeout_id =
        g_timeout_add_full(G_PRIORITY_LOW, 500, 
                           (GSourceFunc) volume_icon_changed_timeout, 
                           g_object_ref(volume_icon),
                           g_object_unref);
}
Exemple #8
0
static void
ide_editor_spell_widget__dict_word_entry_changed_cb (IdeEditorSpellWidget *self,
                                                     GtkEntry             *dict_word_entry)
{
  g_assert (IDE_IS_EDITOR_SPELL_WIDGET (self));
  g_assert (GTK_IS_ENTRY (dict_word_entry));

  if (self->dict_check_word_state == CHECK_WORD_CHECKING)
    {
      self->is_dict_check_word_invalid = TRUE;
      return;
    }

  if (self->dict_check_word_state == CHECK_WORD_IDLE)
    {
      g_source_remove (self->dict_check_word_timeout_id);
      self->dict_check_word_timeout_id = 0;
    }

  self->dict_check_word_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT,
                                                         CHECK_WORD_INTERVAL_MIN,
                                                         (GSourceFunc)dict_check_word_timeout_cb,
                                                         self,
                                                         NULL);
  self->dict_check_word_state = CHECK_WORD_IDLE;
}
static gboolean
connect_output (gpointer pipeline)
{
  GstElement *agnosticbin =
      gst_bin_get_by_name (GST_BIN (pipeline), "agnosticbin");
  GstElement *appsink = gst_element_factory_make ("appsink", NULL);
  GstElement *valve = gst_element_factory_make ("valve", NULL);
  GstCaps *caps = gst_caps_from_string ("audio/x-vorbis");

  gst_bin_add_many (GST_BIN (pipeline), appsink, valve, NULL);
  gst_element_sync_state_with_parent (valve);
  gst_element_sync_state_with_parent (appsink);
  g_object_set (G_OBJECT (appsink), "emit-signals", TRUE, "caps", caps, "sync",
      FALSE, NULL);
  g_object_set (G_OBJECT (valve), "drop", TRUE, NULL);
  gst_caps_unref (caps);

  g_signal_connect (G_OBJECT (appsink), "new-sample",
      G_CALLBACK (appsink_handle_many), NULL);

  if (!gst_element_link (valve, appsink)) {
    GST_ERROR ("Error linking elements");
  }

  if (!gst_element_link (agnosticbin, valve)) {
    GST_ERROR ("Error linking elements");
  }

  g_timeout_add_full (G_PRIORITY_DEFAULT, 500, open_valve, g_object_ref (valve),
      g_object_unref);

  g_object_unref (agnosticbin);

  return FALSE;
}
Exemple #10
0
int
e_canvas_item_grab (ECanvas *canvas,
		    GnomeCanvasItem *item,
		    guint event_mask,
		    GdkCursor *cursor,
		    guint32 etime,
		    ECanvasItemGrabCancelled cancelled_cb,
		    gpointer cancelled_data)
{
	if (gtk_grab_get_current ()) {
		return GDK_GRAB_ALREADY_GRABBED;
	} else {
		int ret_val = gnome_canvas_item_grab (item, event_mask, cursor, etime);
		if (ret_val == GDK_GRAB_SUCCESS) {
			canvas->grab_cancelled_cb = cancelled_cb;
			canvas->grab_cancelled_check_id =
				g_timeout_add_full (G_PRIORITY_LOW,
						    100,
						    grab_cancelled_check,
						    canvas,
						    NULL);
			canvas->grab_cancelled_time = etime;
			canvas->grab_cancelled_data = cancelled_data;
		}

		return ret_val;
	}
}
static gui *
gui_new ()
{
    gui *plugin;
    tooltips = gtk_tooltips_new ();
    plugin = g_new(gui, 1);
    plugin->ebox = gtk_event_box_new();
    gtk_widget_show (plugin->ebox);

    plugin->hbox = gtk_hbox_new(FALSE, 0);
    gtk_widget_show (plugin->hbox);

    plugin->vbox = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (plugin->vbox);

    plugin->size = ICONSIZETINY;
    plugin->lab = NULL;
    plugin->label = NULL;
    plugin->mnt = NULL;
    plugin->yellow = 0;
    plugin->red = 0;
    plugin->timeout = 0;
    plugin->filemanager = "xffm";
    plugin->fs = xfce_iconbutton_new ();
    g_signal_connect (G_OBJECT(plugin->fs), "clicked", G_CALLBACK(plugin_open_mnt), plugin);
    gtk_button_set_relief (GTK_BUTTON(plugin->fs), GTK_RELIEF_NONE);
    gtk_container_add (GTK_CONTAINER(plugin->hbox), plugin->vbox);
    gtk_container_add (GTK_CONTAINER(plugin->hbox), plugin->fs);
    gtk_container_add (GTK_CONTAINER(plugin->ebox), plugin->hbox);
    gtk_widget_show_all (plugin->ebox);

    plugin_check_fs (plugin);
    plugin->timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, 8192, (GSourceFunc) plugin_check_fs, plugin, NULL);
    return(plugin);
}
void RemoteRepositoryAssistant::on_entry_repository ()
{
  if (ignore_entry_repository_changed)
    return;
  gw_destroy_source(event_id_entry_repository);
  event_id_entry_repository = g_timeout_add_full(G_PRIORITY_DEFAULT, 1000, GSourceFunc(on_entry_changed_timeout), gpointer(this), NULL);
}
Exemple #13
0
void
bst_play_back_handle_pcm_notify (BstPlayBackHandle *handle,
				 guint		    timeout,
				 BstPlayBackNotify  notify,
				 gpointer           data)
{
  if (!bse_project_is_playing (handle->project))
    {
      notify = NULL;
      data = NULL;
    }
  handle->pcm_notify = notify;
  handle->pcm_data = data;
  if (handle->pcm_timeout)
    {
      g_source_remove (handle->pcm_timeout);
      handle->pcm_timeout = 0;
      if (handle->waiting_for_notify)
	handle->discard_next_notify = TRUE;
    }
  if (handle->pcm_notify)
    {
      handle->current_delay = timeout;
      handle->pcm_timeout = g_timeout_add_full (GTK_PRIORITY_HIGH, handle->current_delay,
						pcm_timer, handle, NULL);
    }
}
void WindowCheckKeyterms::text_changed (Editor2 * editor)
// To be called when the text in any of the USFM editors changed.
{
  gw_destroy_source (text_changed_event_id);
  text_changed_event_id = g_timeout_add_full (G_PRIORITY_DEFAULT, 500, GSourceFunc (on_text_changed_timeout), gpointer (this), NULL);
  my_editor = editor;
}
Exemple #15
0
static void
run_main_loop_until_eos (void)
{
  GstElement *bin =
      (GstElement *) check_gobject_get_object_property (song, "bin");
  GMainLoop *main_loop = g_main_loop_new (NULL, FALSE);
  GstBus *bus = gst_element_get_bus (bin);
  gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
  g_signal_connect (bus, "message::error", G_CALLBACK (message_received),
      (gpointer) main_loop);
  g_signal_connect (bus, "message::eos", G_CALLBACK (message_received),
      (gpointer) main_loop);
  gst_object_unref (bus);
  gst_object_unref (bin);
  // workaround for some muxers not accepting the seek and thus not going to eos
  // poll playback position 10 times a second
  // TODO(ensonic): fixed in 1.0?
  // basesrc elements do post EOS
  old_pos = -1;
  old_playing = FALSE;
  g_signal_connect (song, "notify::play-pos",
      G_CALLBACK (on_song_play_pos_notify), (gpointer) main_loop);
  g_signal_connect (song, "notify::is-playing",
      G_CALLBACK (on_song_is_playing_notify), (gpointer) main_loop);
  guint update_id =
      g_timeout_add_full (G_PRIORITY_HIGH, 1000 / 10, on_song_playback_update,
      NULL, NULL);

  bt_song_update_playback_position (song);
  GST_INFO ("running main_loop");
  g_main_loop_run (main_loop);
  GST_INFO ("finished main_loop");
  g_source_remove (update_id);
}
Exemple #16
0
static void leave_client(struct wm_client *client)
{
	g_assert(config_focus_follow);
	if(is_enter_focus_event_ignored(event_curserial)) {
		wm_debug_type(WM_DEBUG_FOCUS, "Ignoring leave event with serial %lu\n on client 0x%x", event_curserial,
			client->window);
		return;
	}
	if(client == focus_client) {
		if(config_focus_delay) {
			struct focus_delay_data *data;
			if(unfocus_delay_timeout_id)
				g_source_remove(unfocus_delay_timeout_id);
			data = g_slice_new(struct focus_delay_data);
			data->client = client;
			data->time = event_time();
			data->serial = event_curserial;
			unfocus_delay_timeout_id =
				g_timeout_add_full(G_PRIORITY_DEFAULT, config_focus_delay, unfocus_delay_func, data, unfocus_delay_dest);
			unfocus_delay_timeout_client = client;
		} else {
			struct focus_delay_data data;
			data.client = client;
			data.time = event_time();
			data.serial = event_curserial;
			unfocus_delay_func(&data);
		}
	}
Exemple #17
0
static unsigned int schedule_timer_event(char *id, unsigned int delay)
{
    gpointer      data;
    unsigned int  srcid;

    if (id == NULL) 
        srcid = 0;
    else {
        data = strdup(id);

        if (!delay)
            srcid = g_idle_add_full(G_PRIORITY_HIGH, timer_event_cb,data,free);
        else {
            srcid = g_timeout_add_full(G_PRIORITY_HIGH, delay,
                                       timer_event_cb, data, free);
        }
    }

    if (srcid) {
        OHM_DEBUG(DBG_EVENT, "sheduled event with %s=%u (id=%s)",
                  TIMER_SRCID, srcid, id);
    }
    else {
        OHM_DEBUG(DBG_EVENT, "failed to schedule event (id=%s)", id);
    }

    return srcid;
}
Exemple #18
0
static void
player_av_play (Player *self)
{
    PlayerAVPrivate *priv = PLAYER_AV (self)->priv;

    if (priv->stop_time != -1) {
        priv->start_time += av_gettime () - priv->stop_time;
        priv->stop_time = -1;
    } else {
        priv->start_time = av_gettime ();
    }

    priv->athread = g_thread_create ((GThreadFunc) player_av_audio_loop, self, TRUE, NULL);

    if (priv->vctx) {
        priv->frame_ready = FALSE;
        priv->vt_id = g_timeout_add_full (
            G_PRIORITY_HIGH,
            10,
            (GSourceFunc) on_timeout,
            self,
            NULL);
    }

    player_av_set_state (PLAYER_AV (self), PLAYER_STATE_PLAYING);

    player_set_video_destination (self, priv->video_dest);

    entry_set_state (priv->entry, ENTRY_STATE_PLAYING);

    g_timeout_add (500, (GSourceFunc) position_update, self);
}
Exemple #19
0
static void
set_floating_bar_status (NemoWindowSlot *slot,
			 const gchar *status)
{
	GtkSettings *settings;
	gint double_click_time;
	SetStatusData *status_data;

	if (slot->set_status_timeout_id != 0) {
		g_source_remove (slot->set_status_timeout_id);
		slot->set_status_timeout_id = 0;
	}

	settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (slot->content_view)));
	g_object_get (settings,
		      "gtk-double-click-time", &double_click_time,
		      NULL);

	status_data = g_slice_new0 (SetStatusData);
	status_data->status = g_strdup (status);
	status_data->slot = slot;

	/* waiting for half of the double-click-time before setting
	 * the status seems to be a good approximation of not setting it
	 * too often and not delaying the statusbar too much.
	 */
	slot->set_status_timeout_id =
		g_timeout_add_full (G_PRIORITY_DEFAULT,
				    (guint) (double_click_time / 2),
				    set_status_timeout_cb,
				    status_data,
				    set_status_data_free);
}
Exemple #20
0
static int
start_timer(os_handler_t      *handler, 
	    os_hnd_timer_id_t *id,
	    struct timeval    *timeout,
	    os_timed_out_t    timed_out,
	    void              *cb_data)
{
    g_os_hnd_data_t *info = handler->internal_data;
    guint           interval;

    if (id->running)
	return EBUSY;

    id->running = 1;
    id->cb_data = cb_data;
    id->timed_out = timed_out;

    interval = (timeout->tv_sec * 1000) | ((timeout->tv_usec + 999) / 1000);
    id->ev_id = g_timeout_add_full(info->priority,
				   interval,
				   timer_handler,
				   id,
				   NULL);
    return 0;
}
Exemple #21
0
gboolean
sawmill_logger_update(gpointer data)
{
    if (sIsAwake) {
        double rc , c;
        get_battery_coulomb_reading(&rc, &c);
        sTimeOnPrint = time_now_ms();
        long unsigned int diff_awake = sTimeOnPrint - sTimeOnWake;
        g_message("%s: raw_coulomb: %f coulomb: %f time_awake_ms: %lu time_asleep_ms: %lu time_screen_on_ms: %lu time_screen_off_ms: %lu",
                  __func__,
                  rc, c,
                  sTotalMSAwake + diff_awake,
                  sTotalMSAsleep,
                  sTotalMSScreenOn + ( sScreenIsOn ? (time_now_ms() - sTimeScreenOn): 0),
                  sTotalMSScreenOff + ( sScreenIsOn ? 0 : (time_now_ms() - sTimeScreenOff))
                 );
        read_proc_loadavg();
        read_proc_stat();
        read_proc_diskstats();
        read_proc_meminfo();
        read_proc_net_dev();

    }
    //TODO: use g_timer_source_set_interval(GTimerSource *tsource, guint interval_ms, gboolean from_poll)
    g_source_remove(sTimerEventSource);
    sTimerEventSource = g_timeout_add_full(G_PRIORITY_DEFAULT, PRINT_INTERVAL_MS, sawmill_logger_update, GINT_TO_POINTER(TRUE), NULL);
    return FALSE;
}
/**
 *      \fn jogChange
 *      \brief Handler for wheel value changed event
 * */
gint jogChange(void)
{
  int32_t v;
   uint32_t r;
   if(nbTimer) return FALSE; // Already armed
   
   // Process First move
      v=UI_readJog()/10;
      r=abs(v);
      if(!r)
      {
        return FALSE;
      }
      if(!jogLock)
      {
        jogLock++;
        if(v>0) 
          gtk_signal_emit_by_name (GTK_OBJECT (lookup_widget(guiRootWindow,"next_intra_frame1")), "activate" );
          
        else  
          gtk_signal_emit_by_name (GTK_OBJECT (lookup_widget(guiRootWindow,"previous_intra_frame1")), "activate" );
        jogLock--;
        nbTimer=1;
        count=0;//tickToTime(r);
        g_timeout_add_full(G_PRIORITY_DEFAULT,10,(GCALL *)jogTimer,NULL,jogDel);

      }      
   // Armed!
   return FALSE;
}
Exemple #23
0
guint
modem_tones_start_full(ModemTones *self,
  int event,
  int volume,
  unsigned duration,
  ModemTonesStoppedNotify *notify,
  gpointer data)
{
  ModemTonesPrivate *priv = self->priv;

  g_return_val_if_fail(!priv->dispose_has_run, 0);

  volume += priv->volume;

  if (volume > 0)
    volume = 0;
  else if (volume < -63)
    volume = -63;

  if (event == TONES_EVENT_DROPPED) {
    if (duration > 1200)
      duration = 1200;
  }

  modem_tones_stop(self, 0);

  if (event < 0)
    return 0;

  if (priv->source == 0)
    priv->source++;

  priv->playing = priv->source++;
  priv->event = event;
  priv->evolume = volume;
  priv->duration = duration;

  if (duration) {
    priv->timeout = g_timeout_add_full(G_PRIORITY_DEFAULT, duration,
                    modem_tones_timeout, self, modem_tones_timeout_removed);
  }

  priv->data = data;
  priv->notify = notify;

  g_timer_start(priv->timer);

  DEBUG("calling StartEventTone(%u, %d, %u) with %u",
    priv->event, priv->evolume, priv->duration, priv->playing);

  dbus_g_proxy_call_no_reply(priv->proxy,
    "StartEventTone",
    G_TYPE_UINT, priv->event,
    G_TYPE_INT, priv->evolume,
    G_TYPE_UINT, priv->duration,
    G_TYPE_INVALID);

  return priv->playing;
}
guint 
g_timeout_add (guint32        interval,
	       GSourceFunc    function,
	       gpointer       data)
{
  return g_timeout_add_full (G_PRIORITY_DEFAULT, 
			     interval, function, data, NULL);
}
Exemple #25
0
static VALUE watch_timer(VALUE self, VALUE delay)
{
	set_callback(&timer_handler, "timer_handler");
	if (timer_timeout != 0)
		g_source_remove(timer_timeout);
	timer_timeout = g_timeout_add_full( G_PRIORITY_HIGH, delay, do_timeout, timer_handler, NULL );
	return delay;
}
Exemple #26
0
//TODO: need to call this from erase API's aswell
void
reset_lifetime_timer()
{
    g_debug("%s called", __func__);
    disable_lifetime_timer();
    sTimerEventSource = g_timeout_add_full(G_PRIORITY_DEFAULT, DYNAMIC_LIFETIME_MS, timeout_handler, NULL, NULL);
    g_debug("%s: timeout set", __func__);
}
Exemple #27
0
static gboolean
start_search_feedback (gpointer data)
{
  search_progress_id = g_timeout_add_full (G_PRIORITY_DEFAULT, 100,
                                           (GSourceFunc)search_progress, data,
                                           (GDestroyNotify)search_progress_done);
  return G_SOURCE_REMOVE;
}
Exemple #28
0
/**
 * Makes a frame flash and then return to normal shortly afterwards.
 * This is done by setting a flag so that the theme
 * code will temporarily draw the frame as focussed if it's unfocussed and
 * vice versa, and then queueing a redraw. Lastly, we create a timeout so
 * that the flag can be unset and the frame re-redrawn.
 *
 * If the configure script found we had no XKB, this does not exist.
 *
 * \param window  The window to flash
 */
static void
bell_flash_window_frame (MetaWindow *window)
{
  g_assert (window->frame != NULL);
  window->frame->is_flashing = 1;
  meta_frame_queue_draw (window->frame);
  g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 100, 
      bell_unflash_frame, window->frame, NULL);
}
void setSharedTimerFireInterval(double interval)
{
    ASSERT(sharedTimerFiredFunction);

    guint intervalInMS = static_cast<guint>(interval * 1000);

    stopSharedTimer();
    sharedTimer = g_timeout_add_full(GDK_PRIORITY_REDRAW, intervalInMS, timeout_cb, 0, 0);
}
/*---------------------------------------------------------------------*/
guint
bglk_timeout_add( guint interval, obj_t proc ) {
   bglk_register_proc( proc );
   return g_timeout_add_full( G_PRIORITY_DEFAULT,
			      interval,
			      bglk_timeout_func,
			      proc,
			      (GDestroyNotify)bglk_unregister_proc );
}