您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ G_THEMED_ICON函数代码示例

51自学网 2021-06-01 21:02:06
  C++
这篇教程C++ G_THEMED_ICON函数代码示例写得很实用,希望能帮到您。

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

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

示例1: _g_icon_get_pixbuf

GdkPixbuf *_g_icon_get_pixbuf (GIcon        *icon,		    int           size,		    GtkIconTheme *theme){	GdkPixbuf *pixbuf;	int        w, h;	if (icon == NULL)		return NULL;	pixbuf = NULL;	if (G_IS_THEMED_ICON (icon))		pixbuf = get_themed_icon_pixbuf (G_THEMED_ICON (icon), size, theme);	if (G_IS_FILE_ICON (icon))		pixbuf = get_file_icon_pixbuf (G_FILE_ICON (icon), size);	if (pixbuf == NULL)		return NULL;	w = gdk_pixbuf_get_width (pixbuf);	h = gdk_pixbuf_get_height (pixbuf);	if (scale_keeping_ratio (&w, &h, size, size, FALSE)) {		GdkPixbuf *scaled;		scaled = gdk_pixbuf_scale_simple (pixbuf, w, h, GDK_INTERP_BILINEAR);		g_object_unref (pixbuf);		pixbuf = scaled;	}	return pixbuf;}
开发者ID:Peliadia,项目名称:gthumb,代码行数:32,


示例2: ignore_drive

static gbooleanignore_drive (GDrive *drive){  GIcon *icon;  if (g_drive_can_eject (drive) == FALSE ||      g_drive_has_media (drive) == FALSE) {    GRL_DEBUG ("%s: Not adding %s as cannot eject or has no media", __FUNCTION__,               g_drive_get_name (drive));    return TRUE;  }  /* Hack to avoid USB devices showing up   * https://bugzilla.gnome.org/show_bug.cgi?id=679624 */  icon = g_drive_get_icon (drive);  if (icon && G_IS_THEMED_ICON (icon)) {    const gchar * const * names;    names = g_themed_icon_get_names (G_THEMED_ICON (icon));    if (names && names[0] && !g_str_has_prefix (names[0], "drive-optical")) {      g_object_unref (icon);      GRL_DEBUG ("%s: Not adding drive %s as is not optical drive", __FUNCTION__,                 g_drive_get_name (drive));      return TRUE;    }  }  g_clear_object (&icon);  return FALSE;}
开发者ID:victortoso,项目名称:grilo-plugins,代码行数:29,


示例3: get_file_pixbuf

GdkPixbuf *get_file_pixbuf (GSearchWindow * gsearch,                 GFileInfo * file_info){	GdkPixbuf * pixbuf;	GIcon * icon = NULL;	const gchar * thumbnail_path = NULL;	if (file_info == NULL) {		return NULL;	}	icon = g_file_info_get_icon (file_info);	if (gsearch->show_thumbnails == TRUE) {		thumbnail_path = g_file_info_get_attribute_byte_string (file_info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH);	}	if (thumbnail_path != NULL) {		pixbuf = gsearchtool_get_thumbnail_image (thumbnail_path);	}	else {		gchar * icon_string;		icon_string = g_icon_to_string (icon);				pixbuf = (GdkPixbuf *) g_hash_table_lookup (gsearch->search_results_filename_hash_table, icon_string);		if (pixbuf == NULL) {			pixbuf = get_themed_icon_pixbuf (G_THEMED_ICON (icon), ICON_SIZE, gtk_icon_theme_get_default ());			g_hash_table_insert (gsearch->search_results_filename_hash_table, g_strdup (icon_string), pixbuf);		}		g_free (icon_string);	}	return pixbuf;}
开发者ID:kenvandine,项目名称:gnome-utils,代码行数:35,


示例4: getPixBuf

GdkPixbuf* getPixBuf(char* name){	GFile*				file=g_file_new_for_path(name);	GFileInfo*			file_info=g_file_query_info(file,"standard::*",G_FILE_QUERY_INFO_NONE,NULL,NULL);	GIcon*				icon=g_file_info_get_icon(file_info);	GdkPixbuf*			pix=NULL;	gchar*				path;	gchar const* const*	names;	GFile*				icon_file;	char*				newname;	if(G_IS_THEMED_ICON(icon))		{			names=g_themed_icon_get_names(G_THEMED_ICON(icon));			pix=gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),*names,16,(GtkIconLookupFlags)(GTK_ICON_LOOKUP_USE_BUILTIN|GTK_ICON_LOOKUP_FORCE_SVG|GTK_ICON_LOOKUP_GENERIC_FALLBACK|GTK_ICON_LOOKUP_FORCE_SIZE),NULL);			if(pix==NULL)				{					asprintf(&newname,"gnome-mime-%s",*names);					pix=gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),(const gchar*)newname,16,(GtkIconLookupFlags)(GTK_ICON_LOOKUP_USE_BUILTIN|GTK_ICON_LOOKUP_FORCE_SVG|GTK_ICON_LOOKUP_GENERIC_FALLBACK|GTK_ICON_LOOKUP_FORCE_SIZE),NULL);					debugFree(&newname);				}		}	else if(G_IS_FILE_ICON(icon))		{			icon_file=g_file_icon_get_file(G_FILE_ICON(icon));			path=g_file_get_path(icon_file);			pix=gdk_pixbuf_new_from_file_at_size(path,16,16,NULL);			debugFree(&path);			g_object_unref(G_OBJECT(icon_file));		}	g_object_unref(G_OBJECT(file));	g_object_unref(G_OBJECT(file_info));   return(pix);}
开发者ID:KeithDHedger,项目名称:KKEditPlugins,代码行数:35,


示例5: gicon_to_string

static char *gicon_to_string (GIcon *icon){  GFile *file;  const char *const *names;  if (G_IS_FILE_ICON (icon))    {      file = g_file_icon_get_file (G_FILE_ICON (icon));      if (file)	return g_file_get_path (file);    }  else if (G_IS_THEMED_ICON (icon))    {      names = g_themed_icon_get_names (G_THEMED_ICON (icon));      if (names)	return g_strdup (names[0]);    }  else if (G_IS_EMBLEMED_ICON (icon))    {      GIcon *base;      base = g_emblemed_icon_get_icon (G_EMBLEMED_ICON (icon));      return gicon_to_string (base);    }  return NULL;}
开发者ID:Cordia,项目名称:dawati-shell,代码行数:29,


示例6: get_icon_pixbuf_for_content_type

static GdkPixbuf*get_icon_pixbuf_for_content_type (const char *ctype, size_t size){	GIcon *icon;	GdkPixbuf *pixbuf;		icon = g_content_type_get_icon (ctype);	pixbuf = NULL;			/* based on a snippet from http://www.gtkforums.com/about4721.html */	if (G_IS_THEMED_ICON(icon)) {		gchar const * const *names;		names = g_themed_icon_get_names (G_THEMED_ICON(icon));		pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(),						   *names, size, 0, NULL);	} else if (G_IS_FILE_ICON(icon)) {		GFile *icon_file;		gchar *path;			icon_file = g_file_icon_get_file (G_FILE_ICON(icon));		path = g_file_get_path (icon_file);		pixbuf = gdk_pixbuf_new_from_file_at_size (path, size, size, NULL);		g_free (path);		g_object_unref(icon_file);	}	g_object_unref(icon);		return pixbuf;}
开发者ID:DarwinAwardWinner,项目名称:mu,代码行数:28,


示例7: _gtk_icon_helper_get_icon_name

const gchar *_gtk_icon_helper_get_icon_name (GtkIconHelper *self){  if (self->priv->storage_type != GTK_IMAGE_ICON_NAME)    return NULL;  return g_themed_icon_get_names (G_THEMED_ICON (self->priv->gicon))[0];}
开发者ID:Distrotech,项目名称:gtk,代码行数:8,


示例8: mx_icon_theme_get_icons

static GList *mx_icon_theme_get_icons (MxIconTheme *theme,                         const gchar *icon_name){  gint i;  GIcon *icon;  GList *data;  const gchar * const *names = NULL;  MxIconThemePrivate *priv = theme->priv;  /* Load the icon, or a fallback */  icon = g_themed_icon_new_with_default_fallbacks (icon_name);  names = g_themed_icon_get_names (G_THEMED_ICON (icon));  if (!names)    {      g_object_unref (icon);      return NULL;    }  data = NULL;  for (i = 0; names[i]; i++)    {      /* See if we've loaded this before */      GIcon *single_icon = g_themed_icon_new (names[i]);      gboolean success = g_hash_table_lookup_extended (priv->icon_hash,                                                       single_icon,                                                       NULL,                                                       (gpointer *)&data);      g_object_unref (single_icon);      /* Found in cache on first hit, break */      if (success && (i == 0))        break;      /* Found in cache after searching the disk, store again as a new icon */      if (success)        {          /* If we found this as a fallback, store it so we don't look on           * disk again.           */          if (data)            data = mx_icon_theme_copy_data_list (data);          g_hash_table_insert (priv->icon_hash, g_object_ref (icon), data);          break;        }      /* Try to load from disk */      if ((data = mx_icon_theme_load_icon (theme, names[i], icon)))        break;    }  g_object_unref (icon);  return data;}
开发者ID:3v1n0,项目名称:mx,代码行数:58,


示例9: list_drives

static voidlist_drives (GList *drives,	     int indent){  GList *volumes, *l;  int c, i;  GDrive *drive;  char *name;  char **ids;  GIcon *icon;    for (c = 0, l = drives; l != NULL; l = l->next, c++)    {      drive = (GDrive *) l->data;      name = g_drive_get_name (drive);            g_print ("%*sDrive(%d): %s/n", indent, "", c, name);      g_free (name);            if (mount_list_info)	{	  ids = g_drive_enumerate_identifiers (drive);	  if (ids && ids[0] != NULL)	    {	      g_print ("%*sids:/n", indent+2, "");	      for (i = 0; ids[i] != NULL; i++)		{		  char *id = g_drive_get_identifier (drive,						     ids[i]);		  g_print ("%*s %s: '%s'/n", indent+2, "", ids[i], id);		  g_free (id);		}	    }	  g_strfreev (ids);          icon = g_drive_get_icon (drive);          if (icon)          {                  if (G_IS_THEMED_ICON (icon))                          show_themed_icon_names (G_THEMED_ICON (icon), indent + 2);                  g_object_unref (icon);          }	  g_print ("%*sis_media_removable=%d/n", indent + 2, "", g_drive_is_media_removable (drive));	  g_print ("%*shas_media=%d/n", indent + 2, "", g_drive_has_media (drive));	  g_print ("%*sis_media_check_automatic=%d/n", indent + 2, "", g_drive_is_media_check_automatic (drive));	  g_print ("%*scan_poll_for_media=%d/n", indent + 2, "", g_drive_can_poll_for_media (drive));	  g_print ("%*scan_eject=%d/n", indent + 2, "", g_drive_can_eject (drive));	}            volumes = g_drive_get_volumes (drive);      list_volumes (volumes, indent + 2, FALSE);      g_list_foreach (volumes, (GFunc)g_object_unref, NULL);      g_list_free (volumes);    }}
开发者ID:afilmore,项目名称:libfmcore,代码行数:56,


示例10: st_icon_get_icon_name

const gchar *st_icon_get_icon_name (StIcon *icon){  StIconPrivate *priv;  g_return_val_if_fail (ST_IS_ICON (icon), NULL);  priv = icon->priv;  if (priv->gicon && G_IS_THEMED_ICON (priv->gicon))    return g_themed_icon_get_names (G_THEMED_ICON (priv->gicon)) [0];  else    return NULL;}
开发者ID:fanpenggogo,项目名称:gnome-shel,代码行数:14,


示例11: set_icon

static voidset_icon(GtkWindow *window, const gchar *uri){    GFile *file;    GIcon *icon;    GFileInfo *info;    GdkScreen *screen;    GtkIconTheme *icon_theme;    const gchar *icon_name = NULL, *content_type;    screen = gtk_widget_get_screen (GTK_WIDGET (window));    icon_theme = gtk_icon_theme_get_for_screen (screen);    file = g_file_new_for_uri (uri);    info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,                              G_FILE_QUERY_INFO_NONE, NULL, NULL);    g_object_unref (file);    if (! info)	return;    content_type = g_file_info_get_content_type (info);    icon = g_content_type_get_icon (content_type);    if (G_IS_THEMED_ICON (icon)) {       const gchar * const *names = NULL;       names = g_themed_icon_get_names (G_THEMED_ICON (icon));       if (names) {          gint i;          for (i = 0; names[i]; i++) {	      if (gtk_icon_theme_has_icon (icon_theme, names[i])) {		  icon_name = names[i];		  break;	      }          }       }    }    if (icon_name) {        gtk_window_set_icon_name (window, icon_name);    }    g_object_unref (icon);}
开发者ID:City-busz,项目名称:mate-control-center,代码行数:46,


示例12: render_icon

static GdkPixbuf *render_icon (GIcon *icon, gint icon_size){	GdkPixbuf *pixbuf;	GtkIconInfo *info;	pixbuf = NULL;	if (G_IS_THEMED_ICON (icon)) {		gchar const * const *names;		info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),				                       icon,				                       icon_size,				                       0);		if (info) {			pixbuf = gtk_icon_info_load_icon (info, NULL);		        gtk_icon_info_free (info);		}		if (pixbuf == NULL) {			names = g_themed_icon_get_names (G_THEMED_ICON (icon));			pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),							   *names,							   icon_size,							   0, NULL);		}	}	else	if (G_IS_FILE_ICON (icon)) {		GFile *icon_file;		gchar *path;		icon_file = g_file_icon_get_file (G_FILE_ICON (icon));		path = g_file_get_path (icon_file);		pixbuf = gdk_pixbuf_new_from_file_at_size (path,							   icon_size, icon_size, 							   NULL);		g_free (path);		g_object_unref (G_OBJECT (icon_file));	}	return pixbuf;}
开发者ID:RavetcoFX,项目名称:cinnamon-settings-daemon,代码行数:45,


示例13: panel_util_get_icon_name_from_g_icon

char *panel_util_get_icon_name_from_g_icon (GIcon *gicon){	const char * const *names;	GtkIconTheme *icon_theme;	int i;	if (!G_IS_THEMED_ICON (gicon))		return NULL;	names = g_themed_icon_get_names (G_THEMED_ICON (gicon));	icon_theme = gtk_icon_theme_get_default ();	for (i = 0; names[i] != NULL; i++) {		if (gtk_icon_theme_has_icon (icon_theme, names[i]))			return g_strdup (names[i]);	}	return NULL;}
开发者ID:mitya57,项目名称:gnome-panel,代码行数:20,


示例14: _gtk_icon_helper_set_use_fallback

gboolean_gtk_icon_helper_set_use_fallback (GtkIconHelper *self,                                   gboolean       use_fallback){  if (self->priv->use_fallback != use_fallback)    {      self->priv->use_fallback = use_fallback;      _gtk_icon_helper_invalidate (self);      if (self->priv->storage_type == GTK_IMAGE_ICON_NAME)        {          GIcon *old_icon = self->priv->gicon;          const char *icon_name = g_themed_icon_get_names (G_THEMED_ICON (self->priv->gicon))[0];          if (self->priv->use_fallback)            self->priv->gicon = g_themed_icon_new_with_default_fallbacks (icon_name);          else            self->priv->gicon = g_themed_icon_new (icon_name);          g_object_unref (old_icon);        }      return TRUE;    }  return FALSE;}
开发者ID:danysan2000,项目名称:gtk,代码行数:22,


示例15: add_drive

static GList *add_drive (GList *media_list,           GDrive *drive,           GrlOpticalMediaSource *source){  GList *volumes, *i;  GIcon *icon;  if (g_drive_can_eject (drive) == FALSE ||      g_drive_has_media (drive) == FALSE) {    return media_list;  }  /* Hack to avoid USB devices showing up   * https://bugzilla.gnome.org/show_bug.cgi?id=679624 */  icon = g_drive_get_icon (drive);  if (icon && G_IS_THEMED_ICON (icon)) {    const gchar * const * names;    names = g_themed_icon_get_names (G_THEMED_ICON (icon));    if (names && names[0] && !g_str_has_prefix (names[0], "drive-optical")) {      g_object_unref (icon);      return media_list;    }  }  g_clear_object (&icon);  /* Repeat for all the drive's volumes */  volumes = g_drive_get_volumes (drive);  for (i = volumes; i != NULL; i = i->next) {    GVolume *volume = i->data;    media_list = add_volume (media_list, volume, drive, source);    g_object_unref (volume);  }  g_list_free (volumes);  return media_list;}
开发者ID:kyoushuu,项目名称:grilo-plugins,代码行数:39,


示例16: iconstore_get_pixbuf

GdkPixbuf *iconstore_get_pixbuf (GFileInfo * file_info){    // create new hash table    if (pixbuf_hash_table == NULL) {        pixbuf_hash_table = g_hash_table_new_full (g_str_hash,                                                   g_str_equal,                                                   g_free,                                                   g_object_unref);    }    GIcon *icon = NULL;    gboolean icon_needs_free = FALSE;    if (file_info) {        icon = g_file_info_get_icon (file_info);    }    else {        icon = g_icon_new_for_string ("image-missing", NULL);        icon_needs_free = TRUE;    }    gchar *icon_string = g_icon_to_string (icon);    GdkPixbuf *pixbuf = (GdkPixbuf *) g_hash_table_lookup (pixbuf_hash_table,                                                           icon_string);    if (pixbuf == NULL) {        pixbuf = get_themed_icon_pixbuf (G_THEMED_ICON (icon),                                         ICON_SIZE,                                         gtk_icon_theme_get_default ());        g_hash_table_insert (pixbuf_hash_table,                             g_strdup (icon_string),                             pixbuf);    }    if (icon_needs_free) {        g_object_unref (icon);    }    g_free (icon_string);    return pixbuf;}
开发者ID:cboxdoerfer,项目名称:fsearch,代码行数:38,


示例17: g_themed_icon_get_names

static gchar *_cd_get_icon_path (GIcon *pIcon){	gchar *cIconPath = NULL;	if (G_IS_THEMED_ICON (pIcon))	{		const gchar * const *cFileNames = g_themed_icon_get_names (G_THEMED_ICON (pIcon));		//cd_message ("icones possibles : %s/n", g_strjoinv (":", (gchar **) cFileNames));		int i;		for (i = 0; cFileNames[i] != NULL && cIconPath == NULL; i ++)		{			//cd_message (" une icone possible est : %s/n", cFileNames[i]);			cIconPath = cairo_dock_search_icon_s_path (cFileNames[i]);			//cd_message ("  chemin trouve : %s/n", cIconPath);		}	}	else if (G_IS_FILE_ICON (pIcon))	{		GFile *pFile = g_file_icon_get_file (G_FILE_ICON (pIcon));		cIconPath = g_file_get_basename (pFile);		//cd_message (" file_icon => %s/n", cIconPath);	}	return cIconPath;}
开发者ID:BackupTheBerlios,项目名称:cairo-dock-svn,代码行数:23,


示例18: ephy_web_application_setup_from_desktop_file

voidephy_web_application_setup_from_desktop_file (GDesktopAppInfo *desktop_info){  GAppInfo *app_info;  const char *wm_class;  GIcon *icon;  g_assert (G_IS_DESKTOP_APP_INFO (desktop_info));  app_info = G_APP_INFO (desktop_info);  g_set_prgname (g_app_info_get_name (app_info));  g_set_application_name (g_app_info_get_display_name (app_info));  icon = g_app_info_get_icon (app_info);  if (G_IS_FILE_ICON (icon)) {    GFile *file = g_file_icon_get_file (G_FILE_ICON (icon));    char *path = file ? g_file_get_path (file) : NULL;    if (path) {      gtk_window_set_default_icon_from_file (path, NULL);      g_free (path);    }    g_clear_object (&file);  } else if (G_IS_THEMED_ICON (icon)) {    const char * const *names = g_themed_icon_get_names (G_THEMED_ICON (icon));    if (names)      gtk_window_set_default_icon_name (names[0]);  }  g_clear_object (&icon);  /* We need to re-set this because we have already parsed the   * options, which inits GTK+ and sets this as a side effect.   */  wm_class = g_desktop_app_info_get_startup_wm_class (desktop_info);  if (wm_class)    gdk_set_program_class (wm_class);}
开发者ID:GNOME,项目名称:epiphany,代码行数:37,


示例19: on_xdg_volume_info_loaded

static voidon_xdg_volume_info_loaded (GObject      *source_object,                           GAsyncResult *res,                           gpointer      user_data){  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);  GFile *xdg_volume_info_file;  gchar *content;  gsize content_length;  GError *error;  GKeyFile *key_file;  gchar *name;  gchar *icon_name;  gchar *icon_file;  GIcon *icon;  content = NULL;  key_file = NULL;  name = NULL;  icon_name = NULL;  icon_file = NULL;  xdg_volume_info_file = G_FILE (source_object);  error = NULL;  if (g_file_load_contents_finish (xdg_volume_info_file,                                   res,                                   &content,                                   &content_length,                                   NULL,                                   &error))    {      key_file = g_key_file_new ();      if (!g_key_file_load_from_data (key_file,                                      content,                                      content_length,                                      G_KEY_FILE_NONE,                                      &error))        goto out;      name = g_key_file_get_locale_string (key_file,                                           VOLUME_INFO_GROUP,                                           "Name",                                           NULL,                                           NULL);      icon_name = g_key_file_get_string (key_file,                                         VOLUME_INFO_GROUP,                                         "Icon",                                         NULL);            icon_file = g_key_file_get_string (key_file,                                         VOLUME_INFO_GROUP,                                         "IconFile",                                         NULL);      icon = NULL;            if (icon_file != NULL)        {          GFile *dir, *f;          dir = g_file_get_parent (xdg_volume_info_file);          if (dir)            {              f = g_file_resolve_relative_path (dir, icon_file);              if (f)                {                  icon = g_file_icon_new (f);                  g_object_unref (f);                }                            g_object_unref (dir);            }        }                  if (icon == NULL && icon_name != NULL)        {          icon = g_themed_icon_new (icon_name);          g_themed_icon_append_name (G_THEMED_ICON (icon), "drive-removable-media");          g_themed_icon_append_name (G_THEMED_ICON (icon), "drive-removable");          g_themed_icon_append_name (G_THEMED_ICON (icon), "drive");        }      g_simple_async_result_set_op_res_gpointer (simple, icon, NULL);      g_object_set_data_full (G_OBJECT (simple), "name", name, g_free);      name = NULL; /* steals name */      g_simple_async_result_complete_in_idle (simple);      g_object_unref (simple);    } out:  if (key_file != NULL)    g_key_file_free (key_file);  if (error != NULL)    {      g_simple_async_result_set_from_error (simple, error);//.........这里部分代码省略.........
开发者ID:DarkProfit,项目名称:gvfs,代码行数:101,


示例20: thunar_notify_unmount

voidthunar_notify_unmount (GMount *mount){  const gchar * const *icon_names;  NotifyNotification  *notification = NULL;  const gchar         *summary;  GFileInfo           *info;  gboolean             read_only = FALSE;  GFile               *icon_file;  GFile               *mount_point;  GIcon               *icon;  gchar               *icon_name = NULL;  gchar               *message;  gchar               *name;  g_return_if_fail (G_IS_MOUNT (mount));  if (!thunar_notify_init ())    return;  mount_point = g_mount_get_root (mount);    info = g_file_query_info (mount_point, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,                             G_FILE_QUERY_INFO_NONE, NULL, NULL);  if (info != NULL)    {      read_only = !g_file_info_get_attribute_boolean (info,                                                       G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);      g_object_unref (info);    }  g_object_unref (mount_point);  name = g_mount_get_name (mount);  icon = g_mount_get_icon (mount);  if (G_IS_THEMED_ICON (icon))    {      icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon));      if (icon_names != NULL)        icon_name = g_strdup (icon_names[0]);    }  else if (G_IS_FILE_ICON (icon))    {      icon_file = g_file_icon_get_file (G_FILE_ICON (icon));      if (icon_file != NULL)        {          icon_name = g_file_get_path (icon_file);          g_object_unref (icon_file);        }    }  g_object_unref (icon);  if (icon_name == NULL)    icon_name = g_strdup ("drive-removable-media");  if (read_only)    {      summary = _("Unmounting device");      message = g_strdup_printf (_("The device /"%s/" is being unmounted by the system. "                                   "Please do not remove the media or disconnect the "                                   "drive"), name);    }  else    {      summary = _("Writing data to device");      message = g_strdup_printf (_("There is data that needs to be written to the "                                   "device /"%s/" before it can be removed. Please "                                   "do not remove the media or disconnect the drive"),                                   name);    }#ifdef NOTIFY_CHECK_VERSION#if NOTIFY_CHECK_VERSION (0, 7, 0)  notification = notify_notification_new (summary, message, icon_name);#else  notification = notify_notification_new (summary, message, icon_name, NULL);#endif#else  notification = notify_notification_new (summary, message, icon_name, NULL);#endif  notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL);  notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER);  notify_notification_show (notification, NULL);  g_object_set_data_full (G_OBJECT (mount), "thunar-notification", notification,                           g_object_unref);  g_free (message);  g_free (icon_name);  g_free (name);}
开发者ID:flipcoder,项目名称:thunar,代码行数:94,


示例21: list_volumes

static voidlist_volumes (GList *volumes,              int indent,              gboolean only_with_no_drive){  GList *l, *mounts;  int c, i;  GMount *mount;  GVolume *volume;  GDrive *drive;  char *name;  char *uuid;  GFile *activation_root;  char **ids;  GIcon *icon;  char *type_name;  const gchar *sort_key;  for (c = 0, l = volumes; l != NULL; l = l->next, c++)    {      volume = (GVolume *) l->data;      if (only_with_no_drive)        {          drive = g_volume_get_drive (volume);          if (drive != NULL)            {              g_object_unref (drive);              continue;            }        }      name = g_volume_get_name (volume);      g_print ("%*sVolume(%d): %s/n", indent, "", c, name);      g_free (name);      type_name = get_type_name (volume);      g_print ("%*sType: %s/n", indent+2, "", type_name);      g_free (type_name);      if (extra_detail)        {          ids = g_volume_enumerate_identifiers (volume);          if (ids && ids[0] != NULL)            {              g_print ("%*sids:/n", indent+2, "");              for (i = 0; ids[i] != NULL; i++)                {                  char *id = g_volume_get_identifier (volume,                                                      ids[i]);                  g_print ("%*s %s: '%s'/n", indent+2, "", ids[i], id);                  g_free (id);                }            }          g_strfreev (ids);          uuid = g_volume_get_uuid (volume);          if (uuid)            g_print ("%*suuid=%s/n", indent + 2, "", uuid);          activation_root = g_volume_get_activation_root (volume);          if (activation_root)            {              char *uri;              uri = g_file_get_uri (activation_root);              g_print ("%*sactivation_root=%s/n", indent + 2, "", uri);              g_free (uri);              g_object_unref (activation_root);            }          icon = g_volume_get_icon (volume);          if (icon)            {              if (G_IS_THEMED_ICON (icon))                show_themed_icon_names (G_THEMED_ICON (icon), indent + 2);              g_object_unref (icon);            }          g_print ("%*scan_mount=%d/n", indent + 2, "", g_volume_can_mount (volume));          g_print ("%*scan_eject=%d/n", indent + 2, "", g_volume_can_eject (volume));          g_print ("%*sshould_automount=%d/n", indent + 2, "", g_volume_should_automount (volume));          sort_key = g_volume_get_sort_key (volume);          if (sort_key != NULL)            g_print ("%*ssort_key=%s/n", indent + 2, "", sort_key);          g_free (uuid);        }      mount = g_volume_get_mount (volume);      if (mount)        {          mounts = g_list_prepend (NULL, mount);          list_mounts (mounts, indent + 2, FALSE);          g_list_free (mounts);          g_object_unref (mount);        }    }}
开发者ID:Amerekanets,项目名称:gvfs,代码行数:97,


示例22: list_drives

static voidlist_drives (GList *drives,             int indent){  GList *volumes, *l;  int c, i;  GDrive *drive;  char *name;  char **ids;  GIcon *icon;  char *type_name;  const gchar *sort_key;  for (c = 0, l = drives; l != NULL; l = l->next, c++)    {      drive = (GDrive *) l->data;      name = g_drive_get_name (drive);      g_print ("%*sDrive(%d): %s/n", indent, "", c, name);      g_free (name);      type_name = get_type_name (drive);      g_print ("%*sType: %s/n", indent+2, "", type_name);      g_free (type_name);      if (extra_detail)        {          GEnumValue *enum_value;          gpointer klass;          ids = g_drive_enumerate_identifiers (drive);          if (ids && ids[0] != NULL)            {              g_print ("%*sids:/n", indent+2, "");              for (i = 0; ids[i] != NULL; i++)                {                  char *id = g_drive_get_identifier (drive,                                                     ids[i]);                  g_print ("%*s %s: '%s'/n", indent+2, "", ids[i], id);                  g_free (id);                }            }          g_strfreev (ids);          icon = g_drive_get_icon (drive);          if (icon)          {                  if (G_IS_THEMED_ICON (icon))                          show_themed_icon_names (G_THEMED_ICON (icon), indent + 2);                  g_object_unref (icon);          }          g_print ("%*sis_media_removable=%d/n", indent + 2, "", g_drive_is_media_removable (drive));          g_print ("%*shas_media=%d/n", indent + 2, "", g_drive_has_media (drive));          g_print ("%*sis_media_check_automatic=%d/n", indent + 2, "", g_drive_is_media_check_automatic (drive));          g_print ("%*scan_poll_for_media=%d/n", indent + 2, "", g_drive_can_poll_for_media (drive));          g_print ("%*scan_eject=%d/n", indent + 2, "", g_drive_can_eject (drive));          g_print ("%*scan_start=%d/n", indent + 2, "", g_drive_can_start (drive));          g_print ("%*scan_stop=%d/n", indent + 2, "", g_drive_can_stop (drive));          enum_value = NULL;          klass = g_type_class_ref (G_TYPE_DRIVE_START_STOP_TYPE);          if (klass != NULL)            {              enum_value = g_enum_get_value (klass, g_drive_get_start_stop_type (drive));              g_print ("%*sstart_stop_type=%s/n", indent + 2, "",                       enum_value != NULL ? enum_value->value_nick : "UNKNOWN");              g_type_class_unref (klass);            }          sort_key = g_drive_get_sort_key (drive);          if (sort_key != NULL)            g_print ("%*ssort_key=%s/n", indent + 2, "", sort_key);        }      volumes = g_drive_get_volumes (drive);      list_volumes (volumes, indent + 2, FALSE);      g_list_foreach (volumes, (GFunc)g_object_unref, NULL);      g_list_free (volumes);    }}
开发者ID:Amerekanets,项目名称:gvfs,代码行数:80,


示例23: get_menu_icon_for_file

static GdkPixbuf *get_menu_icon_for_file (TreeNode *node,                        NemoFile *file,			NemoFileIconFlags flags){	NemoIconInfo *info;	GIcon *gicon, *emblem_icon, *emblemed_icon;	GEmblem *emblem;	GdkPixbuf *pixbuf, *retval;	gboolean highlight;	int size;	FMTreeModel *model;	GList *emblem_icons, *l;	char *emblems_to_ignore[3];	int i;	size = nemo_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);	gicon = G_ICON (nemo_file_get_icon_pixbuf (file, size, TRUE, flags));	i = 0;	emblems_to_ignore[i++] = NEMO_FILE_EMBLEM_NAME_TRASH;	if (node->parent && node->parent->file) {		if (!nemo_file_can_write (node->parent->file)) {			emblems_to_ignore[i++] = NEMO_FILE_EMBLEM_NAME_CANT_WRITE;		}	}		emblems_to_ignore[i++] = NULL;	emblem = NULL;	emblem_icons = nemo_file_get_emblem_icons (node->file,						       emblems_to_ignore);	/* pick only the first emblem we can render for the tree view */	for (l = emblem_icons; l != NULL; l = l->next) {		emblem_icon = l->data;		if (nemo_icon_theme_can_render (G_THEMED_ICON (emblem_icon))) {			emblem = g_emblem_new (emblem_icon);			emblemed_icon = g_emblemed_icon_new (gicon, emblem);			g_object_unref (gicon);			g_object_unref (emblem);			gicon = emblemed_icon;			break;		}	}	g_list_free_full (emblem_icons, g_object_unref);	info = nemo_icon_info_lookup (gicon, size);	retval = nemo_icon_info_get_pixbuf_nodefault_at_size (info, size);	model = node->root->model;	g_object_unref (gicon);	highlight = (g_list_find_custom (model->details->highlighted_files,	                                 file, (GCompareFunc) nemo_file_compare_location) != NULL);	if (highlight) {		pixbuf = eel_create_spotlight_pixbuf (retval);		if (pixbuf != NULL) {			g_object_unref (retval);			retval = pixbuf;		}	}	g_object_unref (info);	return retval;}
开发者ID:glebihan,项目名称:nemo,代码行数:73,


示例24: list_mounts

static voidlist_mounts (GList *mounts,             int indent,             gboolean only_with_no_volume){  GList *l;  int c;  GMount *mount;  GVolume *volume;  char *name, *uuid, *uri;  GFile *root, *default_location;  GIcon *icon;  char **x_content_types;  char *type_name;  const gchar *sort_key;  for (c = 0, l = mounts; l != NULL; l = l->next, c++)    {      mount = (GMount *) l->data;      if (only_with_no_volume)        {          volume = g_mount_get_volume (mount);          if (volume != NULL)            {              g_object_unref (volume);              continue;            }        }      name = g_mount_get_name (mount);      root = g_mount_get_root (mount);      uri = g_file_get_uri (root);      g_print ("%*sMount(%d): %s -> %s/n", indent, "", c, name, uri);      type_name = get_type_name (mount);      g_print ("%*sType: %s/n", indent+2, "", type_name);      g_free (type_name);      if (extra_detail)        {          uuid = g_mount_get_uuid (mount);          if (uuid)            g_print ("%*suuid=%s/n", indent + 2, "", uuid);          default_location = g_mount_get_default_location (mount);          if (default_location)            {              char *loc_uri = g_file_get_uri (default_location);              g_print ("%*sdefault_location=%s/n", indent + 2, "", loc_uri);              g_free (loc_uri);              g_object_unref (default_location);            }          icon = g_mount_get_icon (mount);          if (icon)            {              if (G_IS_THEMED_ICON (icon))                show_themed_icon_names (G_THEMED_ICON (icon), indent + 2);              g_object_unref (icon);            }          x_content_types = g_mount_guess_content_type_sync (mount, FALSE, NULL, NULL);          if (x_content_types != NULL && g_strv_length (x_content_types) > 0)            {              int n;              g_print ("%*sx_content_types:", indent + 2, "");              for (n = 0; x_content_types[n] != NULL; n++)                  g_print (" %s", x_content_types[n]);              g_print ("/n");            }          g_strfreev (x_content_types);          g_print ("%*scan_unmount=%d/n", indent + 2, "", g_mount_can_unmount (mount));          g_print ("%*scan_eject=%d/n", indent + 2, "", g_mount_can_eject (mount));          g_print ("%*sis_shadowed=%d/n", indent + 2, "", g_mount_is_shadowed (mount));          sort_key = g_mount_get_sort_key (mount);          if (sort_key != NULL)            g_print ("%*ssort_key=%s/n", indent + 2, "", sort_key);          g_free (uuid);        }      g_object_unref (root);      g_free (name);      g_free (uri);    }}
开发者ID:Amerekanets,项目名称:gvfs,代码行数:89,


示例25: ConvertAndFree

void GioLister::DeviceInfo::ReadMountInfo(GMount* mount) {  // Get basic information  this->mount.reset_without_add(mount);  if (!mount)    return;  mount_name = ConvertAndFree(g_mount_get_name(mount));  // Get the icon name(s)  mount_icon_names.clear();  GIcon* icon = g_mount_get_icon(mount);  if (G_IS_THEMED_ICON(icon)) {    const char* const * icons = g_themed_icon_get_names(G_THEMED_ICON(icon));    for (const char* const * p = icons ; *p ; ++p) {      mount_icon_names << QString::fromUtf8(*p);    }  }  g_object_unref(icon);  GFile* root = g_mount_get_root(mount);  // Get the mount path  mount_path = ConvertAndFree(g_file_get_path(root));  mount_uri = ConvertAndFree(g_file_get_uri(root));  // Do a sanity check to make sure the root is actually this mount - when a  // device is unmounted GIO sends a changed signal before the removed signal,  // and we end up reading information about the / filesystem by mistake.  GError* error = NULL;  GMount* actual_mount = g_file_find_enclosing_mount(root, NULL, &error);  if (error || !actual_mount) {    g_error_free(error);    invalid_enclosing_mount = true;  } else if (actual_mount) {    g_object_unref(actual_mount);  }  // Query the filesystem info for size, free space, and type  error = NULL;  GFileInfo* info = g_file_query_filesystem_info(root,      G_FILE_ATTRIBUTE_FILESYSTEM_SIZE "," G_FILE_ATTRIBUTE_FILESYSTEM_FREE ","      G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, NULL, &error);  if (error) {    qLog(Warning) << error->message;    g_error_free(error);  } else {    filesystem_size = g_file_info_get_attribute_uint64(        info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE);    filesystem_free = g_file_info_get_attribute_uint64(        info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE);    filesystem_type = QString::fromUtf8(g_file_info_get_attribute_string(        info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE));    g_object_unref(info);  }  // Query the file's info for a filesystem ID  // Only afc devices (that I know of) give reliably unique IDs  if (filesystem_type == "afc") {    error = NULL;    info = g_file_query_info(root, G_FILE_ATTRIBUTE_ID_FILESYSTEM,                             G_FILE_QUERY_INFO_NONE, NULL, &error);    if (error) {      qLog(Warning) << error->message;      g_error_free(error);    } else {      mount_uuid = QString::fromUtf8(g_file_info_get_attribute_string(          info, G_FILE_ATTRIBUTE_ID_FILESYSTEM));      g_object_unref(info);    }  }  g_object_unref(root);}
开发者ID:BrummbQ,项目名称:Clementine,代码行数:73,


示例26: main

intmain (int argc, char **argv){  GtkWidget *window;  GtkWidget *table;  GtkWidget *label;  GtkWidget *entry;  GtkWidget *button;  GIcon *icon;  GtkTargetList *tlist;  gtk_init (&argc, &argv);  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);  gtk_window_set_title (GTK_WINDOW (window), "Gtk Entry Icons Test");  gtk_container_set_border_width (GTK_CONTAINER (window), 12);  g_signal_connect (G_OBJECT (window), "destroy",		    G_CALLBACK (gtk_main_quit), NULL);  table = gtk_table_new (2, 4, FALSE);  gtk_container_add (GTK_CONTAINER (window), table);  gtk_table_set_row_spacings (GTK_TABLE (table), 6);  gtk_table_set_col_spacings (GTK_TABLE (table), 6);  /*   * Open File - Sets the icon using a GIcon   */  label = gtk_label_new ("Open File:");  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,		    GTK_FILL, GTK_FILL, 0, 0);  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);  entry = gtk_entry_new ();  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,		    GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);  icon = g_themed_icon_new ("folder");  g_themed_icon_append_name (G_THEMED_ICON (icon), "gtk-directory");  gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry),				 GTK_ENTRY_ICON_PRIMARY,				 icon);  gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),			        GTK_ENTRY_ICON_PRIMARY,				FALSE);  gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),				   GTK_ENTRY_ICON_PRIMARY,				   "Open a file");  button = gtk_button_new_with_label ("Properties");  gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,		    GTK_FILL, GTK_FILL, 0, 0);  g_signal_connect (button, "clicked",                     G_CALLBACK (properties_cb), entry);                        /*   * Save File - sets the icon using a stock id.   */  label = gtk_label_new ("Save File:");  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,		    GTK_FILL, GTK_FILL, 0, 0);  gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);  entry = gtk_entry_new ();  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2,		    GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);  gtk_entry_set_text (GTK_ENTRY (entry), "
C++ G_THROW函数代码示例
C++ G_SpawnInt函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。