• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ G_MOUNT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中G_MOUNT函数的典型用法代码示例。如果您正苦于以下问题:C++ G_MOUNT函数的具体用法?C++ G_MOUNT怎么用?C++ G_MOUNT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了G_MOUNT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: eject_done_cb

static void
eject_done_cb (GObject *object,
               GAsyncResult *res,
               gpointer user_data)
{
  gboolean succeeded;
  GError *error = NULL;
  GFile *file = G_FILE (user_data);

  succeeded = g_mount_eject_with_operation_finish (G_MOUNT (object), res, &error);

  g_object_unref (G_MOUNT (object));

  if (!succeeded)
    {
      print_file_error (file, error->message);
      success = FALSE;
      g_error_free (error);
    }

  g_object_unref (file);

  outstanding_mounts--;

  if (outstanding_mounts == 0)
    g_main_loop_quit (main_loop);
}
开发者ID:ImageMagick,项目名称:glib,代码行数:27,代码来源:gio-tool-mount.c


示例2: _vfs_backend_mount_callback

static void _vfs_backend_mount_callback (gpointer pObject, GAsyncResult *res, gpointer *data)
//static void _vfs_backend_mount_callback (gboolean succeeded, char *error, char *detailed_error, gpointer *data)
{
	cd_message ("%s (%d)", __func__, GPOINTER_TO_INT (data[1]));
	
	CairoDockFMMountCallback pCallback = data[0];
	
	GError *erreur = NULL;
	gboolean bSuccess;
	if (GPOINTER_TO_INT (data[1]) == 1)
		bSuccess = (g_file_mount_mountable_finish (G_FILE (pObject), res, &erreur) != NULL);
		//bSuccess = (g_volume_mount_finish (G_VOLUME (pObject), res, &erreur));
	else if (GPOINTER_TO_INT (data[1]) == 0)
		bSuccess = g_mount_unmount_finish (G_MOUNT (pObject), res, &erreur);
	else
		bSuccess = g_mount_eject_finish (G_MOUNT (pObject), res, &erreur);
	if (erreur != NULL)
	{
		cd_warning ("Attention : %s", erreur->message);
		g_error_free (erreur);
	}
	
	cd_message ("(un)mount fini -> %d", bSuccess);
	pCallback (GPOINTER_TO_INT (data[1]) == 1, bSuccess, data[2], data[3], data[4]);
	//g_free (data[2]);
	//g_object_unref (pObject);
	//g_free (data);
}
开发者ID:BackupTheBerlios,项目名称:cairo-dock-svn,代码行数:28,代码来源:applet-gvfs.c


示例3: unmount_mount_callback

static void
unmount_mount_callback (GObject *source_object,
			GAsyncResult *res,
			gpointer user_data)
{
	GError *error;
	char *primary;
	gboolean unmounted;
	gboolean should_eject;
	GtkWidget *dialog;


	should_eject = user_data != NULL;

	error = NULL;
	if (should_eject) {
		unmounted = g_mount_eject_with_operation_finish (G_MOUNT (source_object),
								 res, &error);
	} else {
		unmounted = g_mount_unmount_with_operation_finish (G_MOUNT (source_object),
								   res, &error);
	}
	
	if (! unmounted) {
		if (error->code != G_IO_ERROR_FAILED_HANDLED) {
			if (should_eject) {
				primary = g_strdup_printf (_("Unable to eject %p"), source_object);
			} else {
				primary = g_strdup_printf (_("Unable to unmount %p"), source_object);
			}

			dialog = gtk_message_dialog_new (NULL,
							 0,
							 GTK_MESSAGE_INFO,
							 GTK_BUTTONS_OK,
							 "%s",
							 primary);
			gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
								    "%s",
								    error->message);
			
			gtk_widget_show (GTK_WIDGET (dialog));
			g_signal_connect (dialog, "response",
					  G_CALLBACK (gtk_widget_destroy), NULL);
			g_free (primary);
		}
	}

	if (error != NULL) {
		g_error_free (error);
	}
}
开发者ID:RavetcoFX,项目名称:cinnamon-settings-daemon,代码行数:52,代码来源:csd-autorun.c


示例4: brasero_gio_operation_umount_finish

static void
brasero_gio_operation_umount_finish (GObject *source,
				     GAsyncResult *result,
				     gpointer user_data)
{
	BraseroGioOperation *op = user_data;

	if (!op->loop)
		return;

	op->result = g_mount_unmount_with_operation_finish (G_MOUNT (source),
					     		    result,
					     		    &op->error);

	BRASERO_MEDIA_LOG ("Umount operation completed (result = %d)", op->result);

	if (op->error) {
		if (op->error->code == G_IO_ERROR_NOT_MOUNTED) {
			/* That can happen sometimes */
			g_error_free (op->error);
			op->error = NULL;
			op->result = TRUE;
		}

		/* Since there was an error. The "unmounted" signal won't be 
		 * emitted by GVolumeMonitor and therefore we'd get stuck if
		 * we didn't get out of the loop. */
		brasero_gio_operation_end (op);
	}
	else if (!op->result)
		brasero_gio_operation_end (op);
}
开发者ID:Fedosiy,项目名称:brasero,代码行数:32,代码来源:brasero-gio-operation.c


示例5: shell_util_get_file_display_name_if_mount

static char *
shell_util_get_file_display_name_if_mount (GFile *file)
{
  GFile *compare;
  GVolumeMonitor *monitor;
  GList *mounts, *l;
  char *ret;

  ret = NULL;

  /* compare with all mounts */
  monitor = g_volume_monitor_get ();
  mounts = g_volume_monitor_get_mounts (monitor);
  for (l = mounts; l != NULL; l = l->next)
    {
      GMount *mount;
      mount = G_MOUNT(l->data);
      compare = g_mount_get_root (mount);
      if (!ret && g_file_equal (file, compare))
        ret = g_mount_get_name (mount);
      g_object_unref (mount);
    }
  g_list_free (mounts);
  g_object_unref (monitor);

  return ret;
}
开发者ID:MarkieMark,项目名称:gnome-shell,代码行数:27,代码来源:shell-uri-util.c


示例6: eject_cb

static void
eject_cb (GObject *object, GAsyncResult *result, gpointer nothing)
{
	GError *error = NULL;

	if (G_IS_VOLUME (object)) {
		GVolume *volume = G_VOLUME (object);

		rb_debug ("finishing ejection of volume");
		g_volume_eject_with_operation_finish (volume, result, &error);
	} else if (G_IS_MOUNT (object)) {
		GMount *mount = G_MOUNT (object);

		rb_debug ("finishing ejection of mount");
		g_mount_eject_with_operation_finish (mount, result, &error);
	}

	if (error != NULL) {
		if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED_HANDLED)) {
			rb_error_dialog (NULL, _("Unable to eject"), "%s", error->message);
		} else {
			rb_debug ("eject failure has already been handled");
		}
		g_error_free (error);
	}
}
开发者ID:bilboed,项目名称:rhythmbox,代码行数:26,代码来源:rb-device-source.c


示例7: unmount_done_cb

static void
unmount_done_cb (GObject *object, GAsyncResult *result, gpointer psource)
{
	GMount *mount;
	RBMtpSource *source;
	gboolean ok;
	GError *error = NULL;
	RBMtpSourcePrivate *priv;

	mount = G_MOUNT (object);
	source = RB_MTP_SOURCE (psource);
	priv = MTP_SOURCE_GET_PRIVATE (source);

	ok = g_mount_unmount_with_operation_finish (mount, result, &error);
	if (ok) {
		rb_debug ("successfully unmounted mtp device");
		priv->remount_volume = g_mount_get_volume (mount);

		open_device (source);
	} else {
		g_warning ("Unable to unmount MTP device: %s", error->message);
		g_error_free (error);
	}

	g_object_unref (mount);
	g_object_unref (source);
}
开发者ID:dignan,项目名称:control,代码行数:27,代码来源:rb-mtp-source.c


示例8: bookmark_location_mounted_callback

static gboolean
bookmark_location_mounted_callback (NemoBookmark *bookmark,
                                    GFile *location,
                                    NemoBookmarkList *bookmarks)
{
    gboolean ret = FALSE;

    GList *volumes = g_volume_monitor_get_mounts (bookmarks->volume_monitor);
    GList *iter = volumes;

    while (iter != NULL) {
        GMount *mount = G_MOUNT (iter->data);
        GFile *mount_location = g_mount_get_root (mount);

        gchar *mount_root_uri = g_file_get_uri (mount_location);
        gchar *location_uri = g_file_get_uri (location);

        ret = g_str_has_prefix (location_uri, mount_root_uri);

        g_free (mount_root_uri);
        g_free (location_uri);

        g_object_unref (mount_location);

        if (ret == TRUE)
            break;

        iter = iter->next;
    }

    g_list_free_full (volumes, (GDestroyNotify) g_object_unref);

    return ret;
}
开发者ID:City-busz,项目名称:nemo,代码行数:34,代码来源:nemo-bookmark-list.c


示例9: unmount_all_with_scheme

static void
unmount_all_with_scheme (const char *scheme)
{
  GVolumeMonitor *volume_monitor;
  GList *mounts;
  GList *l;

  volume_monitor = g_volume_monitor_get();

  /* populate gvfs network mounts */
  iterate_gmain();

  mounts = g_volume_monitor_get_mounts (volume_monitor);
  for (l = mounts; l != NULL; l = l->next) {
    GMount *mount = G_MOUNT (l->data);
    GFile *root;

    root = g_mount_get_root (mount);
    if (g_file_has_uri_scheme (root, scheme)) {
            unmount (root);
    }
    g_object_unref (root);
  }
  g_list_foreach (mounts, (GFunc)g_object_unref, NULL);
  g_list_free (mounts);

  g_object_unref (volume_monitor);
}
开发者ID:Amerekanets,项目名称:gvfs,代码行数:28,代码来源:gvfs-mount.c


示例10: on_unmounted

static void on_unmounted(GObject* mnt, GAsyncResult* res, gpointer input_data)
{
#define data ((EjectData*)input_data)
    GError* err = NULL;
    /* FIXME: with this approach, we could have racing condition.
     * Someone may mount other volumes before we finishing unmounting them all. */
    gboolean success = g_mount_unmount_finish(G_MOUNT(mnt), res, &err);
    if(success)
    {
        if(data->mounts) /* we still have some volumes on this drive mounted */
            unmount_before_eject(data);
        else /* all unmounted, do the eject. */
            do_eject(data);
    }
    else
    {
        GSimpleAsyncResult* res;
        GError* error = g_udisks_error_to_gio_error(err);
        g_error_free(err);
        res = g_simple_async_result_new_from_error(G_OBJECT(data->drv),
                                                   data->callback,
                                                   data->user_data,
                                                   err);
        finish_eject(res, data);
        g_error_free(error);
    }
#undef data
}
开发者ID:geekless,项目名称:libsmfm-core,代码行数:28,代码来源:g-udisks-drive.c


示例11: find_mount_for_device

static GMount *
find_mount_for_device (GUdevDevice *device)
{
	GMount *mount = NULL;
	const char *device_file;
	GVolumeMonitor *volmon;
	GList *mounts;
	GList *i;

	device_file = g_udev_device_get_device_file (device);
	if (device_file == NULL) {
		return NULL;
	}

	volmon = g_volume_monitor_get ();
	mounts = g_volume_monitor_get_mounts (volmon);
	g_object_unref (volmon);

	for (i = mounts; i != NULL; i = i->next) {
		GVolume *v;

		v = g_mount_get_volume (G_MOUNT (i->data));
		if (v != NULL) {
			char *devname = NULL;
			gboolean match;

			devname = g_volume_get_identifier (v, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
			g_object_unref (v);
			if (devname == NULL)
				continue;

			match = g_str_equal (devname, device_file);
			g_free (devname);

			if (match) {
				mount = G_MOUNT (i->data);
				g_object_ref (G_OBJECT (mount));
				break;
			}
		}
	}
	g_list_foreach (mounts, (GFunc)g_object_unref, NULL);
	g_list_free (mounts);
	return mount;
}
开发者ID:dignan,项目名称:control,代码行数:45,代码来源:rb-mtp-source.c


示例12: on_content_type_finished

static void on_content_type_finished(GObject* src_obj, GAsyncResult* res, gpointer user_data)
{
    AutoRun* data = (AutoRun*)user_data;
    GMount* mount = G_MOUNT(src_obj);
    char** types;
    char* desc = NULL;

    types = g_mount_guess_content_type_finish(mount, res, NULL);
    if(types)
    {
        GtkTreeIter it;
        GList* apps = NULL, *l;
        char** type;
        if(types[0])
        {
            for(type=types;*type;++type)
            {
                l = g_app_info_get_all_for_type(*type);
                if(l)
                    apps = g_list_concat(apps, l);
            }
            desc = g_content_type_get_description(types[0]);
        }
        g_strfreev(types);

        if(apps)
        {
            int pos = 0;
            GtkTreePath* tp;
            for(l = apps; l; l=l->next, ++pos)
            {
                GAppInfo* app = G_APP_INFO(l->data);
                gtk_list_store_insert_with_values(data->store, &it, pos,
                                   0, g_app_info_get_icon(app),
                                   1, g_app_info_get_name(app),
                                   2, app, -1);
                g_object_unref(app);
            }
            g_list_free(apps);

            gtk_tree_model_get_iter_first(GTK_TREE_MODEL(data->store), &it);
            gtk_tree_selection_select_iter(gtk_tree_view_get_selection(data->view), &it);
            tp = gtk_tree_path_new_first();
            gtk_tree_view_set_cursor(data->view, tp, NULL, FALSE);
            gtk_tree_path_free(tp);
        }
    }

    if(desc)
    {
        gtk_label_set_text(data->type, desc);
        g_free(desc);
    }
    else
        gtk_label_set_text(data->type, _("Removable Disk"));

}
开发者ID:Mic92,项目名称:stuurman,代码行数:57,代码来源:volume-manager.c


示例13: autorun_guessed_content_type_callback

static void
autorun_guessed_content_type_callback (GObject *source_object,
                                       GAsyncResult *res,
                                       gpointer user_data)
{
    GError *error;
    char **guessed_content_type;
    AutorunData *data = user_data;
    gboolean open_folder;

    open_folder = FALSE;

    error = NULL;
    guessed_content_type = g_mount_guess_content_type_finish (G_MOUNT (source_object), res, &error);
    g_object_set_data_full (source_object,
                            "caja-content-type-cache",
                            g_strdupv (guessed_content_type),
                            (GDestroyNotify)g_strfreev);
    if (error != NULL)
    {
        g_warning ("Unabled to guess content type for mount: %s", error->message);
        g_error_free (error);
    }
    else
    {
        if (guessed_content_type != NULL && g_strv_length (guessed_content_type) > 0)
        {
            int n;
            for (n = 0; guessed_content_type[n] != NULL; n++)
            {
                if (do_autorun_for_content_type (data->mount, guessed_content_type[n],
                                                 data->open_window_func, data->user_data))
                {
                    open_folder = TRUE;
                }
            }
            g_strfreev (guessed_content_type);
        }
        else
        {
            if (g_settings_get_boolean (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTOMOUNT_OPEN))
                open_folder = TRUE;
        }
    }

    /* only open the folder once.. */
    if (open_folder && data->open_window_func != NULL)
    {
        data->open_window_func (data->mount, data->user_data);
    }

    g_object_unref (data->mount);
    g_free (data);
}
开发者ID:dmashal,项目名称:mate-file-manager,代码行数:54,代码来源:caja-autorun.c


示例14: unmount_before_eject

static void unmount_before_eject(EjectData* data)
{
    GMount* mnt = G_MOUNT(data->mounts->data);
    data->mounts = g_list_delete_link(data->mounts, data->mounts);
    /* pop the first GMount in the list. */
    g_mount_unmount_with_operation(mnt, data->flags, data->op,
                                 data->cancellable,
                                 on_unmounted, data);
    /* FIXME: Notify volume monitor!! */
    g_object_unref(mnt);
}
开发者ID:geekless,项目名称:libsmfm-core,代码行数:11,代码来源:g-udisks-drive.c


示例15: eject_done_cb

static void
eject_done_cb (GObject *object,
               GAsyncResult *res,
               gpointer user_data)
{
  gboolean succeeded;
  GError *error = NULL;

  succeeded = g_mount_eject_with_operation_finish (G_MOUNT (object), res, &error);

  g_object_unref (G_MOUNT (object));

  if (!succeeded)
    g_printerr (_("Error ejecting mount: %s\n"), error->message);

  outstanding_mounts--;

  if (outstanding_mounts == 0)
    g_main_loop_quit (main_loop);
}
开发者ID:Amerekanets,项目名称:gvfs,代码行数:20,代码来源:gvfs-mount.c


示例16: get_mount_for_mount_path

static GMount *
get_mount_for_mount_path (const char *mount_path,
                          GCancellable *cancellable)
{
  GWin32Mount *mount;

  /* TODO: Set mountable volume? */
  mount = _g_win32_mount_new (NULL, mount_path, NULL);

  return G_MOUNT (mount);
}
开发者ID:183amir,项目名称:glib,代码行数:11,代码来源:gwin32volumemonitor.c


示例17: unmount_cb

static void
unmount_cb (GObject      *source_object,
            GAsyncResult *res,
            gpointer      user_data)
{
        GMount *mount = G_MOUNT (source_object);
        UnmountData *data = user_data;

        g_mount_unmount_with_operation_finish (mount, res, &data->error);

        g_main_loop_quit (data->loop);
}
开发者ID:raveit65,项目名称:mate-disk-utility,代码行数:12,代码来源:mdu-format-tool.c


示例18: dt_camera_import_backup_job_run

int32_t dt_camera_import_backup_job_run(dt_job_t *job)
{
  // copy sourcefile to each found destination
  dt_camera_import_backup_t *t = (dt_camera_import_backup_t *)job->param;
  GVolumeMonitor *vmgr= g_volume_monitor_get();
  GList *mounts=g_volume_monitor_get_mounts(vmgr);
  GMount *mount=NULL;
  GFile *root=NULL;
  if( mounts !=NULL )
    do
    {
      mount=G_MOUNT(mounts->data);
      if( ( root=g_mount_get_root( mount ) ) != NULL )
      {
        // Got the mount point lets check for backup folder
        gchar *backuppath=NULL;
        gchar *rootpath=g_file_get_path(root);
        backuppath=g_build_path(G_DIR_SEPARATOR_S,rootpath,dt_conf_get_string("plugins/capture/backup/foldername"),(char *)NULL);
        g_free(rootpath);

        if( g_file_test(backuppath,G_FILE_TEST_EXISTS)==TRUE)
        {
          // Found a backup storage, lets copy file here..
          gchar *destinationfile=g_build_filename(G_DIR_SEPARATOR_S,backuppath,t->destinationfile,(char *)NULL);
          if( g_mkdir_with_parents(g_path_get_dirname(destinationfile),0755) >= 0 )
          {
            gchar *content;
            gsize size;
            if( g_file_get_contents(t->sourcefile,&content,&size,NULL) == TRUE )
            {
              GError *err=NULL;
              if( g_file_set_contents(destinationfile,content,size,&err) != TRUE)
              {
                fprintf(stderr,"Failed to set content of file with reason: %s\n",err->message);
                g_error_free(err);
              }
              g_free(content);
            }
          }
          g_free(destinationfile);
        }

        g_free(backuppath);
      }
    }
    while( (mounts=g_list_next(mounts)) !=NULL);

  // Release volume manager
  g_object_unref(vmgr);
  return 0;
}
开发者ID:AntonSh,项目名称:darktable,代码行数:51,代码来源:camera_jobs.c


示例19: get_tracker_volume_name

static gchar *
get_tracker_volume_name (const gchar *uri,
			 const gchar *datasource)
{
  gchar *source_name = NULL;
  GVolumeMonitor *volume_monitor;
  GList *mounts, *mount;
  GFile *file;

  if (uri != NULL && *uri != '\0') {
    volume_monitor = g_volume_monitor_get ();
    mounts = g_volume_monitor_get_mounts (volume_monitor);
    file = g_file_new_for_uri (uri);

    mount = mounts;
    while (mount != NULL) {
      GFile *m_file = g_mount_get_root (G_MOUNT (mount->data));

      if (g_file_equal (m_file, file)) {
        gchar *m_name = g_mount_get_name (G_MOUNT (mount->data));
        g_object_unref (G_OBJECT (m_file));
        source_name = g_strdup_printf (_("Removable - %s"), m_name);
        g_free (m_name);
        break;
      }
      g_object_unref (G_OBJECT (m_file));

      mount = mount->next;
    }
    g_list_free_full (mounts, g_object_unref);
    g_object_unref (G_OBJECT (file));
    g_object_unref (G_OBJECT (volume_monitor));
  } else {
    source_name = g_strdup (_("Local files"));
  }

  return source_name;
}
开发者ID:guyou,项目名称:grilo-plugins,代码行数:38,代码来源:grl-tracker-utils.c


示例20: on_mount_action_finished

static void on_mount_action_finished(GObject* src, GAsyncResult *res, gpointer user_data)
{
    struct MountData* data = user_data;

    switch(data->action)
    {
    case MOUNT_VOLUME:
        data->ret = g_volume_mount_finish(G_VOLUME(src), res, &data->err);
        break;
    case MOUNT_GFILE:
        data->ret = g_file_mount_enclosing_volume_finish(G_FILE(src), res, &data->err);
        break;
    case UMOUNT_MOUNT:
        data->ret = g_mount_unmount_with_operation_finish(G_MOUNT(src), res, &data->err);
        break;
    case EJECT_MOUNT:
        data->ret = g_mount_eject_with_operation_finish(G_MOUNT(src), res, &data->err);
        break;
    case EJECT_VOLUME:
        data->ret = g_volume_eject_with_operation_finish(G_VOLUME(src), res, &data->err);
        break;
    }
    g_main_loop_quit(data->loop);
}
开发者ID:lxde,项目名称:libfm,代码行数:24,代码来源:fm-gtk-utils.c



注:本文中的G_MOUNT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ G_ModelIndex函数代码示例发布时间:2022-05-30
下一篇:
C++ G_LogPrintf函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap