コード例 #1
0
static gboolean
drive_is_cd_device (GDrive *gdrive)
{
        BraseroMediumMonitor *monitor;
        BraseroDrive         *drive;
        gchar                *device;

        device = g_drive_get_identifier (gdrive, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
        if (!device)
                return FALSE;

        DEBUG_PRINT ("Got device: %s\n", device);

	/* FIXME: since we call the monitor, the library should be initialized.
	 * To avoid all the initializing we'll be able to use the new GIO API
	 * (#594649 -  Have a way to detect optical drives) */
	ensure_initialized();

	monitor = brasero_medium_monitor_get_default ();
        drive = brasero_medium_monitor_get_drive (monitor, device);
        g_object_unref (monitor);
        g_free (device);

        if (drive == NULL)
                return FALSE;
        
        g_object_unref (drive);
        return TRUE;
}
コード例 #2
0
static void
copy_disc_activate_cb (NautilusMenuItem *item,
                       gpointer          user_data)
{
        char            	*device_path;
	BraseroMediumMonitor	*monitor;
	BraseroTrackDisc	*track;
	BraseroDrive		*drive;

	ensure_initialized();

        device_path = g_object_get_data (G_OBJECT (item), "drive_device_path");
	monitor = brasero_medium_monitor_get_default ();
	drive = brasero_medium_monitor_get_drive (monitor, device_path);
	g_object_unref (monitor);

	track = brasero_track_disc_new ();
	brasero_track_disc_set_drive (track, drive);
	g_object_unref (drive);

	launch_brasero_on_window_track (BRASERO_TRACK (track),
	                                _("Copy Disc"),
	                                NULL,
	                                GTK_WINDOW (user_data));
	g_object_unref (track);
}
コード例 #3
0
ファイル: SafeEnv.cpp プロジェクト: SAPikachu/MP_Pipeline
PVideoFrame SafeNewVideoFrame(IScriptEnvironment* env, const VideoInfo& vi, int align)
{
    ensure_initialized();
    {
        CSLockAcquire lock(*_lock);
        PVideoFrame frame = env->NewVideoFrame(vi, align);
        assert(frame->IsWritable());
        return frame;
    }
}
コード例 #4
0
ファイル: SafeEnv.cpp プロジェクト: SAPikachu/MP_Pipeline
bool SafeMakeWritable(IScriptEnvironment* env, PVideoFrame* pvf)
{
    ensure_initialized();
    {
        CSLockAcquire lock(*_lock);
        bool result = env->MakeWritable(pvf);
        assert(pvf->operator->()->IsWritable());
        return result;
    }
}
コード例 #5
0
ファイル: SDLInputDevice.cpp プロジェクト: krazylegz/sirikata
Input::KeyButton keyButtonFromStrings(std::vector<String>& parts) {
    ensure_initialized();

    assert(!parts.empty());
    const String& part = *parts.begin();
    Input::KeyButton result = 0;
    if (StringsToScancodes.find(part) != StringsToScancodes.end()) {
        result = StringsToScancodes[part];
        parts.erase(parts.begin());
    }
    return result;
}
コード例 #6
0
static void
check_disc_activate_cb (NautilusMenuItem *item,
                        gpointer          user_data)
{
	BraseroSumDialog *dialog;

	ensure_initialized ();

	dialog = brasero_sum_dialog_new ();
	tool_dialog_run (BRASERO_TOOL_DIALOG (dialog),
			 GTK_WINDOW (user_data),
			 item);
}
コード例 #7
0
ファイル: readdir-rand.c プロジェクト: stb-tester/ostree
int
closedir (DIR *dirp)
{
  int (*real_closedir)(DIR *dirp) = dlsym (RTLD_NEXT, "closedir");

  ensure_initialized ();

  g_mutex_lock (&direntcache_lock);
  g_hash_table_remove (direntcache, dirp);
  g_mutex_unlock (&direntcache_lock);

  return real_closedir (dirp);
}
コード例 #8
0
ファイル: readdir-rand.c プロジェクト: stb-tester/ostree
void
seekdir (DIR *dirp, long loc)
{
  void (*real_seekdir)(DIR *dirp, long loc) = dlsym (RTLD_NEXT, "seekdir");

  ensure_initialized ();

  /* For now, crash if seekdir is called when we have cached entries.
   * If some app wants to use this and seekdir() we can implement it.
   */
  assert_no_cached_entries (dirp);

  real_seekdir (dirp, loc);
}
コード例 #9
0
ファイル: Journal.cpp プロジェクト: hirokitaoka/ecell4
void Journal::logv(enum level lv, char const* format, va_list ap)
{
    ensure_initialized();

    if (lv < level_)
        return;

    char buf[1024];
    std::vsnprintf(buf, sizeof(buf), format, ap);

    std::fprintf(stderr, "%s: %-8s ", name_.c_str(), stringize_error_level(lv));
    std::fwrite(buf, sizeof(char), std::strlen(buf), stderr);
    std::fputc('\n', stderr);
}
コード例 #10
0
ファイル: readdir-rand.c プロジェクト: stb-tester/ostree
void
rewinddir (DIR *dirp)
{
  void (*real_rewinddir)(DIR *dirp) = dlsym (RTLD_NEXT, "rewinddir");

  ensure_initialized ();

  /* Blow away the cache */
  g_mutex_lock (&direntcache_lock);
  g_hash_table_remove (direntcache, dirp);
  g_mutex_unlock (&direntcache_lock);

  real_rewinddir (dirp);
}
コード例 #11
0
ファイル: readdir-rand.c プロジェクト: stb-tester/ostree
int
readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
{
  int (*real_readdir_r)(DIR *dirp, struct dirent *entry, struct dirent **result) = dlsym (RTLD_NEXT, READDIR_R);

  ensure_initialized ();

  /* For now, assert that no one is mixing readdir_r() with readdir().
   * It'd be broken to do so, and very few programs use readdir_r()
   * anyways. */
  assert_no_cached_entries (dirp);

  return real_readdir_r (dirp, entry, result);
}
コード例 #12
0
static void
write_iso_activate_cb (NautilusMenuItem *item,
                       gpointer          user_data)
{
	BraseroTrackImageCfg	*track;
        NautilusFileInfo	*file_info;
        char			*uri;

	ensure_initialized();

        file_info = g_object_get_data (G_OBJECT (item), "file_info");
        uri = nautilus_file_info_get_uri (file_info);

	track = brasero_track_image_cfg_new ();
	brasero_track_image_cfg_set_source (track, uri);

	g_signal_connect (track, "changed",
			  G_CALLBACK (brasero_nautilus_track_changed_cb), user_data);
}
コード例 #13
0
static void
write_activate (NautilusDiscBurn *burn,
                GtkWindow *toplevel)
{
	BraseroTrackDataCfg	*track;
	BraseroSessionCfg	*session;

	if (nautilus_disc_burn_is_empty (toplevel))
		return;

	ensure_initialized ();

	track = brasero_track_data_cfg_new ();
	brasero_track_data_cfg_add (track, BURN_URI, NULL);

	if (burn->priv->icon)
		brasero_track_data_cfg_set_icon (BRASERO_TRACK_DATA_CFG (track),
		                                 burn->priv->icon,
		                                 NULL);

	session = brasero_session_cfg_new ();
	brasero_burn_session_add_track (BRASERO_BURN_SESSION (session),
					BRASERO_TRACK (track),
					NULL);
	g_object_unref (track);

	if (burn->priv->title)
		brasero_burn_session_set_label (BRASERO_BURN_SESSION (session),
		                                burn->priv->title);

	/* NOTE: set the disc we're handling */
	launch_brasero_on_window_session (session,
	                                  _("CD/DVD Creator"),
	                                  NULL,
	                                  toplevel);

	/* cleanup */
	g_object_unref (session);
}
コード例 #14
0
ファイル: Journal.cpp プロジェクト: hirokitaoka/ecell4
void Journal::level(enum Journal::level level)
{
    ensure_initialized();
    level_ = level;
}
コード例 #15
0
ファイル: lazy_ptr.hpp プロジェクト: bunsanorg/common
 T *operator->() const {
   ensure_initialized();
   return m_ptr;
 }
コード例 #16
0
ファイル: readdir-rand.c プロジェクト: stb-tester/ostree
struct dirent *
readdir (DIR *dirp)
{
  struct dirent *(*real_readdir)(DIR *dirp) = dlsym (RTLD_NEXT, READDIR);
  struct dirent *ret;
  gboolean cache_another = TRUE;

  ensure_initialized ();

  /* The core idea here is that each time through the loop, we read a
   * directory entry.  If there is one, we choose whether to cache it
   * or to return it.  Because multiple entries can be cached,
   * ordering is randomized.  Statistically, the order will still be
   * *weighted* towards the ordering returned from the
   * kernel/filesystem, but the goal here is just to provide some
   * randomness in order to trigger bugs, not to be perfectly random.
   */
  while (cache_another)
    {
      DirEntries *de;

      errno = 0;
      ret = real_readdir (dirp);
      if (ret == NULL && errno != 0)
        goto out;

      g_mutex_lock (&direntcache_lock);
      de = g_hash_table_lookup (direntcache, dirp);
      if (ret)
        {
          if (g_random_boolean ())
            {
              struct dirent *copy;
              if (!de)
                {
                  de = dir_entries_new ();
                  g_hash_table_insert (direntcache, dirp, de);
                }
              copy = g_memdup (ret, sizeof (struct dirent));
              g_ptr_array_add (de->entries, copy);
            }
          else
            {
              cache_another = FALSE;
            }
        }
      else
        {
          if (de && de->offset < de->entries->len)
            {
              ret = de->entries->pdata[de->offset];
              de->offset++;
            }
          cache_another = FALSE;
        }
      g_mutex_unlock (&direntcache_lock);
    }

 out:
  return ret;
}
コード例 #17
0
ファイル: lazy_ptr.hpp プロジェクト: bunsanorg/common
 T *get() const {
   ensure_initialized();
   return m_ptr;
 }
コード例 #18
0
ファイル: SDLInputDevice.cpp プロジェクト: krazylegz/sirikata
String keyButtonString(Input::KeyButton b) {
    ensure_initialized();
    if (ScancodesToStrings.find(b) != ScancodesToStrings.end())
        return ScancodesToStrings[b];
    return "";
}
コード例 #19
0
ファイル: Journal.cpp プロジェクト: hirokitaoka/ecell4
void Journal::flush()
{
    ensure_initialized();

    std::fflush(stderr);
}