当前位置: 首页>>代码示例>>C++>>正文


C++ G_APP_INFO函数代码示例

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


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

示例1: load_apps_thread

static void
load_apps_thread (GTask        *task,
                  gpointer      panel,
                  gpointer      task_data,
                  GCancellable *cancellable)
{
  GList *iter, *apps;

  apps = g_app_info_get_all ();

  for (iter = apps; iter && !g_cancellable_is_cancelled (cancellable); iter = iter->next)
    {
      GDesktopAppInfo *app;

      app = iter->data;
      if (g_desktop_app_info_get_boolean (app, "X-GNOME-UsesNotifications")) {
        process_app_info (panel, task, G_APP_INFO (app));
        g_debug ("Processing app '%s'", g_app_info_get_id (G_APP_INFO (app)));
      } else {
        g_debug ("Skipped app '%s', doesn't use notifications", g_app_info_get_id (G_APP_INFO (app)));
      }
    }

  g_list_free_full (apps, g_object_unref);
}
开发者ID:ChrisCummins,项目名称:gnome-control-center,代码行数:25,代码来源:cc-notifications-panel.c

示例2: ephy_web_application_for_profile_directory

EphyWebApplication *
ephy_web_application_for_profile_directory (const char *profile_dir)
{
  EphyWebApplication *app;
  char *desktop_file_path;
  const char *id;
  GDesktopAppInfo *desktop_info;
  const char *exec;
  int argc;
  char **argv;
  GFile *file;
  GFileInfo *file_info;
  guint64 created;
  GDate *date;

  id = get_app_id_from_profile_directory (profile_dir);
  if (!id)
    return NULL;

  app = g_new0 (EphyWebApplication, 1);
  app->id = g_strdup (id);

  app->desktop_file = get_app_desktop_filename (id);
  desktop_file_path = g_build_filename (profile_dir, app->desktop_file, NULL);
  desktop_info = g_desktop_app_info_new_from_filename (desktop_file_path);
  if (!desktop_info) {
    ephy_web_application_free (app);
    g_free (desktop_file_path);
    return NULL;
  }

  app->name = g_strdup (g_app_info_get_name (G_APP_INFO (desktop_info)));
  app->icon_url = g_desktop_app_info_get_string (desktop_info, "Icon");
  exec = g_app_info_get_commandline (G_APP_INFO (desktop_info));
  if (g_shell_parse_argv (exec, &argc, &argv, NULL)) {
    app->url = g_strdup (argv[argc - 1]);
    g_strfreev (argv);
  }

  g_object_unref (desktop_info);

  file = g_file_new_for_path (desktop_file_path);

  /* FIXME: this should use TIME_CREATED but it does not seem to be working. */
  file_info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, 0, NULL, NULL);
  created = g_file_info_get_attribute_uint64 (file_info, G_FILE_ATTRIBUTE_TIME_MODIFIED);

  date = g_date_new ();
  g_date_set_time_t (date, (time_t)created);
  g_date_strftime (app->install_date, 127, "%x", date);

  g_date_free (date);
  g_object_unref (file);
  g_object_unref (file_info);
  g_free (desktop_file_path);

  return app;
}
开发者ID:GNOME,项目名称:epiphany,代码行数:58,代码来源:ephy-web-app-utils.c

示例3: xde_entry

static GList *
xde_entry(MenuContext *ctx, GMenuTreeEntry *ent)
{
	GDesktopAppInfo *info;
	GList *text = NULL, *acts;
	const char *name;
	char *esc1, *esc2, *cmd, *p;
	char *s, *icon = NULL;
	GIcon *gicon = NULL;
	char *appid;

	if (!(info = gmenu_tree_entry_get_app_info(ent)) || g_desktop_app_info_get_is_hidden(info)
	    || g_desktop_app_info_get_nodisplay(info) || !g_desktop_app_info_get_show_in(info, NULL)
	    || !g_app_info_should_show(G_APP_INFO(info)))
		return (text);
	name = g_app_info_get_name(G_APP_INFO(info));
	esc1 = xde_character_escape(name, ')');

	if ((appid = strdup(gmenu_tree_entry_get_desktop_file_id(ent)))
	    && (p = strstr(appid, ".desktop")))
		*p = '\0';

	if (ctx->stack)
		gicon = gmenu_tree_directory_get_icon(ctx->stack->data);
	icon = xde_get_app_icon(ctx, info, gicon, "exec", "unknown",
				GET_ENTRY_ICON_FLAG_XPM | GET_ENTRY_ICON_FLAG_PNG |
				GET_ENTRY_ICON_FLAG_JPG | GET_ENTRY_ICON_FLAG_SVG);

	if (options.launch) {
		cmd = g_strdup_printf("xdg-launch --pointer %s", appid);
	} else {
		cmd = xde_get_command(info, appid, icon);
	}
	esc2 = xde_character_escape(cmd, '}');
	icon = ctx->wmm.wrap(ctx, icon);
	if (options.actions && (acts = ctx->wmm.ops.actions(ctx, ent, info))) {
		xde_increase_indent(ctx);
		s = g_strdup_printf("%s[exec] (%s) {%s}%s\n", ctx->indent, esc1, esc2, icon);
		xde_decrease_indent(ctx);
		acts = g_list_prepend(acts, s);
		s = g_strdup_printf("%s[submenu] (%s) {%s}%s\n", ctx->indent, esc1, esc1, icon);
		acts = g_list_prepend(acts, s);
		s = g_strdup_printf("%s[end]\n", ctx->indent);
		acts = g_list_append(acts, s);
		text = g_list_concat(text, acts);
	} else {
		s = g_strdup_printf("%s[exec] (%s) {%s}%s\n", ctx->indent, esc1, esc2, icon);
		text = g_list_append(text, s);
	}
	free(icon);
	free(appid);
	free(esc1);
	free(esc2);
	free(cmd);
	return (text);
}
开发者ID:bbidulock,项目名称:xde-menu,代码行数:56,代码来源:xde_openboxold.c

示例4: menu_iterate_begin

/* Now we implement a set of iterator functions that will handle item lookup hell for us. */
void menu_iterate_begin(pqi inst, menu_iter *it, int showfirst)
{
	it->reverse = FALSE;
	it->showfirst = showfirst;
	it->si = (inst->items->next? showfirst? inst->items : inst->items->next : inst->items);
	it->valid = (it->si != NULL);
	
	if (it->valid)
		it->text = g_app_info_get_display_name(G_APP_INFO(it->si->dfile)),
		it->icon = g_app_info_get_icon(G_APP_INFO(it->si->dfile));
}
开发者ID:JoshDreamland,项目名称:MATE-QuickDrawer,代码行数:12,代码来源:stored.c

示例5: menu_iterate_rbegin

void menu_iterate_rbegin(pqi inst, menu_iter *it, int showfirst)
{
	it->reverse = TRUE;
	it->showfirst = showfirst;
	it->si = inst->lastitem;
	it->valid = (it->si != NULL); /* Wehther or not we show the first item, whether or not this is the first item, if it exists, we return it. */
	
	if (it->valid)
		it->text = g_app_info_get_display_name(G_APP_INFO(it->si->dfile)),
		it->icon = g_app_info_get_icon(G_APP_INFO(it->si->dfile));
}
开发者ID:JoshDreamland,项目名称:MATE-QuickDrawer,代码行数:11,代码来源:stored.c

示例6: menu_iter_next

void menu_iter_next(menu_iter* it)
{
	if (it->reverse)
		it->si = it->si->prev,
		it->valid = (it->si != NULL && (it->showfirst || it->si->prev));
	else
		it->si = it->si->next,
		it->valid = (it->si != NULL);
	
	if (it->valid)
		it->text = g_app_info_get_display_name(G_APP_INFO(it->si->dfile)),
		it->icon = g_app_info_get_icon(G_APP_INFO(it->si->dfile));
}
开发者ID:JoshDreamland,项目名称:MATE-QuickDrawer,代码行数:13,代码来源:stored.c

示例7: notification_cb

static void
notification_cb (NotifyNotification *notification,
                 gchar              *action,
                 gpointer            user_data)
{
  GAppLaunchContext *ctx;
  GDesktopAppInfo *app;
  GError *error;

  /* TODO: Hmm, would be nice to set the screen, timestamp etc etc */
  ctx = g_app_launch_context_new ();

  app = g_desktop_app_info_new ("gnome-online-accounts-panel.desktop");

  error = NULL;
  if (!g_app_info_launch (G_APP_INFO (app),
                          NULL, /* files */
                          ctx,
                          &error))
    {
      goa_warning ("Error launching: %s (%s, %d)",
                   error->message, g_quark_to_string (error->domain), error->code);
      g_error_free (error);
    }
  g_object_unref (app);
  g_object_unref (ctx);
}
开发者ID:wvengen,项目名称:gnome-online-accounts,代码行数:27,代码来源:goadaemon.c

示例8: egg_compare_app_infos

static gint
egg_compare_app_infos (gconstpointer a,
                       gconstpointer b,
                       gpointer      user_data)
{
  return strcmp (g_app_info_get_display_name (G_APP_INFO (a)), g_app_info_get_display_name (G_APP_INFO (b)));
}
开发者ID:dardevelin,项目名称:egglistmodel,代码行数:7,代码来源:egg-app-info-model.c

示例9: on_open_with_easytag

static void
on_open_with_easytag (NautilusMenuItem *item,
                      gpointer data)
{
    GList *files;
    GDesktopAppInfo *appinfo;

    files = g_object_get_data (G_OBJECT (item), "files");

    appinfo = g_desktop_app_info_new ("easytag.desktop");

    if (appinfo)
    {
        GdkAppLaunchContext *context;
        GList *l;
        GList *uris = NULL;

        for (l = files; l != NULL; l = g_list_next (l))
        {
            uris = g_list_append (uris,
                                  nautilus_file_info_get_uri (l->data));
        }

        context = gdk_display_get_app_launch_context (gdk_display_get_default ());

        g_app_info_launch_uris (G_APP_INFO (appinfo), uris,
                                G_APP_LAUNCH_CONTEXT (context), NULL);
    }
}
开发者ID:GNOME,项目名称:easytag,代码行数:29,代码来源:nautilus-easytag.c

示例10: cinnamon_app_create_icon_texture

/**
 * cinnamon_app_create_icon_texture:
 *
 * Look up the icon for this application, and create a #ClutterTexture
 * for it at the given size.
 *
 * Return value: (transfer none): A floating #ClutterActor
 */
ClutterActor *
cinnamon_app_create_icon_texture (CinnamonApp   *app,
                               int         size)
{
  GIcon *icon;
  ClutterActor *ret;

  ret = NULL;

  if (app->entry == NULL)
    return window_backed_app_get_icon (app, size);

  icon = g_app_info_get_icon (G_APP_INFO (gmenu_tree_entry_get_app_info (app->entry)));
  if (icon != NULL)
    ret = st_texture_cache_load_gicon (st_texture_cache_get_default (), NULL, icon, size);

  if (ret == NULL)
    {
      icon = g_themed_icon_new ("application-x-executable");
      ret = st_texture_cache_load_gicon (st_texture_cache_get_default (), NULL, icon, size);
      g_object_unref (icon);
    }

  return ret;
}
开发者ID:City-busz,项目名称:Cinnamon,代码行数:33,代码来源:cinnamon-app.c

示例11: gtk_application_window_get_app_desktop_name

static gchar *
gtk_application_window_get_app_desktop_name (void)
{
  gchar *retval = NULL;

#ifdef HAVE_GIO_UNIX
  GDesktopAppInfo *app_info;
  const gchar *app_name = NULL;
  gchar *desktop_file;

  desktop_file = g_strconcat (g_get_prgname (), ".desktop", NULL);
  app_info = g_desktop_app_info_new (desktop_file);
  g_free (desktop_file);

  if (app_info != NULL)
    app_name = g_app_info_get_name (G_APP_INFO (app_info));

  if (app_name != NULL)
    retval = g_strdup (app_name);

  g_clear_object (&app_info);
#endif /* HAVE_GIO_UNIX */

  return retval;
}
开发者ID:RavikumarTulugu,项目名称:antkorp,代码行数:25,代码来源:gtkapplicationwindow.c

示例12: panel_launch_key_file

gboolean
panel_launch_key_file (GKeyFile   *keyfile,
		       GList      *uri_list,
		       GdkScreen  *screen,
		       GError    **error)
{
	GDesktopAppInfo *appinfo;
	gboolean         retval;

	g_return_val_if_fail (keyfile != NULL, FALSE);
	g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);

	appinfo = g_desktop_app_info_new_from_keyfile (keyfile);

	if (appinfo == NULL)
		return FALSE;

	retval = panel_app_info_launch_uris (G_APP_INFO (appinfo),
					     uri_list, screen,
					     gtk_get_current_event_time (),
					     error);

	g_object_unref (appinfo);

	return retval;
}
开发者ID:Lyude,项目名称:mate-panel,代码行数:27,代码来源:panel-launch.c

示例13: maybe_add_app_id

static void
maybe_add_app_id (CcNotificationsPanel *panel,
                  const char *canonical_app_id)
{
  Application *app;
  gchar *path;
  gchar *full_app_id;
  GSettings *settings;
  GAppInfo *app_info;

  if (g_hash_table_contains (panel->known_applications,
                             canonical_app_id))
    return;

  path = g_strconcat (APP_PREFIX, canonical_app_id, "/", NULL);
  settings = g_settings_new_with_path (APP_SCHEMA, path);

  full_app_id = g_settings_get_string (settings, "application-id");
  app_info = G_APP_INFO (g_desktop_app_info_new (full_app_id));

  if (app_info == NULL) {
    /* The application cannot be found, probably it was uninstalled */
    g_object_unref (settings);
  } else {
    app = g_slice_new (Application);
    app->canonical_app_id = g_strdup (canonical_app_id);
    app->settings = settings;
    app->app_info = app_info;

    add_application (panel, app);
  }

  g_free (path);
  g_free (full_app_id);
}
开发者ID:ChrisCummins,项目名称:gnome-control-center,代码行数:35,代码来源:cc-notifications-panel.c

示例14: _settings_launcher_button_clicked_cb

static void
_settings_launcher_button_clicked_cb (MxButton *button,
                                      gpointer  userdata)
{
  MnbPeoplePanelPrivate *priv = GET_PRIVATE (userdata);
  GDesktopAppInfo *app_info;
  GError *error = NULL;
  const gchar *args[2] = { NULL, };

  app_info = g_desktop_app_info_new ("empathy-accounts.desktop");
  args[0] = g_app_info_get_commandline (G_APP_INFO (app_info));
  args[1] = NULL;

  if (!g_spawn_async (NULL,
                      (gchar **)args,
                      NULL,
                      G_SPAWN_SEARCH_PATH,
                      NULL,
                      NULL,
                      NULL,
                      &error))
  {
    g_warning (G_STRLOC ": Error starting empathy-accounts: %s",
               error->message);
    g_clear_error (&error);
  } else {
    if (priv->panel_client)
      mpl_panel_client_hide (priv->panel_client);
  }

  g_object_unref (app_info);
}
开发者ID:Cordia,项目名称:dawati-shell,代码行数:32,代码来源:mnb-people-panel.c

示例15: _action_new_from_desktop_file

static MxAction *
_action_new_from_desktop_file (const gchar *desktop_file_id)
{
  GDesktopAppInfo *dai;

  dai = g_desktop_app_info_new (desktop_file_id);

  if (dai)
    {
      MxAction *action;
      GAppInfo *ai;
      GIcon *icon;

      ai = G_APP_INFO (dai);

      action = mx_action_new_full (g_app_info_get_name (ai),
                                   g_app_info_get_display_name (ai),
                                   G_CALLBACK (_app_launcher_cb),
                                   (gpointer)g_app_info_get_commandline (ai));

     icon = g_app_info_get_icon (ai);
     if (icon)
       {
         gchar *icon_name;
         icon_name =  g_icon_to_string (icon);

         mx_action_set_icon (action, icon_name);

         g_free (icon_name);
       }

      return action;
    }
  return NULL;
}
开发者ID:tthef,项目名称:media-explorer,代码行数:35,代码来源:mex-info-bar.c


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