本文整理汇总了C++中G_APP_INFO函数的典型用法代码示例。如果您正苦于以下问题:C++ G_APP_INFO函数的具体用法?C++ G_APP_INFO怎么用?C++ G_APP_INFO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_APP_INFO函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: get_hotkey_info_from_key_file
static GtkHotkeyInfo*
get_hotkey_info_from_key_file (GKeyFile *keyfile,
const gchar *app_id,
const gchar *key_id,
GError **error)
{
GtkHotkeyInfo *info = NULL;
gchar *group, *description, *app_info_id, *signature;
GAppInfo *app_info = NULL;
g_return_val_if_fail (keyfile != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
g_return_val_if_fail (app_id != NULL, NULL);
g_return_val_if_fail (key_id != NULL, NULL);
group = g_strconcat (HOTKEY_GROUP, key_id, NULL);
description = g_key_file_get_string (keyfile, group, "Description", NULL);
app_info_id = g_key_file_get_string (keyfile, group, "AppInfo", NULL);
signature = g_key_file_get_string (keyfile, group, "Signature", NULL);
if (!g_key_file_has_group (keyfile, group)) {
g_set_error (error, GTK_HOTKEY_REGISTRY_ERROR,
GTK_HOTKEY_REGISTRY_ERROR_UNKNOWN_KEY,
"Keyfile has no group "HOTKEY_GROUP"%s", key_id);
goto clean_up;
}
if (!signature) {
g_set_error (error, GTK_HOTKEY_REGISTRY_ERROR,
GTK_HOTKEY_REGISTRY_ERROR_BAD_SIGNATURE,
"No 'Signature' defined for hotkey '%s' for application '%s'",
key_id, app_id);
goto clean_up;
}
if (app_info_id) {
app_info = G_APP_INFO(g_desktop_app_info_new (app_info_id));
if (!G_IS_APP_INFO(app_info)) {
g_set_error (error, GTK_HOTKEY_REGISTRY_ERROR,
GTK_HOTKEY_REGISTRY_ERROR_MISSING_APP,
"Keyfile refering to 'AppInfo = %s', but no application"
"by that id is registered on the system", app_info_id);
goto clean_up;
}
}
info = gtk_hotkey_info_new (app_id, key_id, signature, app_info);
if (description)
gtk_hotkey_info_set_description (info, description);
clean_up:
g_free (group);
if (signature) g_free (signature);
if (description) g_free (description);
if (app_info_id) g_free (app_info_id);
if (app_info) g_object_unref (app_info);
return info;
}
开发者ID:SpOOnman,项目名称:claws,代码行数:59,代码来源:gtk-hotkey-key-file-registry.c
示例17: pk_plugin_sqlite_add_filename_details
/**
* pk_plugin_sqlite_add_filename_details:
**/
static gint
pk_plugin_sqlite_add_filename_details (PkPlugin *plugin,
const gchar *filename,
const gchar *package,
const gchar *md5)
{
gchar *statement;
gchar *error_msg = NULL;
sqlite3_stmt *sql_statement = NULL;
gint rc = -1;
gint show;
GDesktopAppInfo *info;
/* find out if we should show desktop file in menus */
info = g_desktop_app_info_new_from_filename (filename);
if (info == NULL) {
g_warning ("could not load desktop file %s", filename);
goto out;
}
show = g_app_info_should_show (G_APP_INFO (info));
g_object_unref (info);
g_debug ("add filename %s from %s with md5: %s (show: %i)",
filename, package, md5, show);
/* the row might already exist */
statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'",
filename);
sqlite3_exec (plugin->priv->db, statement, NULL, NULL, NULL);
g_free (statement);
/* prepare the query, as we don't escape it */
rc = sqlite3_prepare_v2 (plugin->priv->db,
"INSERT INTO cache (filename, package, show, md5) "
"VALUES (?, ?, ?, ?)",
-1, &sql_statement, NULL);
if (rc != SQLITE_OK) {
g_warning ("SQL failed to prepare: %s",
sqlite3_errmsg (plugin->priv->db));
goto out;
}
/* add data */
sqlite3_bind_text (sql_statement, 1, filename, -1, SQLITE_STATIC);
sqlite3_bind_text (sql_statement, 2, package, -1, SQLITE_STATIC);
sqlite3_bind_int (sql_statement, 3, show);
sqlite3_bind_text (sql_statement, 4, md5, -1, SQLITE_STATIC);
/* save this */
sqlite3_step (sql_statement);
rc = sqlite3_finalize (sql_statement);
if (rc != SQLITE_OK) {
g_warning ("SQL error: %s\n", error_msg);
sqlite3_free (error_msg);
goto out;
}
out:
return rc;
}
开发者ID:kaltsi,项目名称:PackageKit,代码行数:62,代码来源:pk-plugin-scan-desktop-files.c
示例18: desktop_activate_cb
/* Take a desktop file and execute it */
static void
desktop_activate_cb (DbusmenuMenuitem * mi, guint timestamp, gpointer data)
{
GAppInfo * appinfo = G_APP_INFO(data);
g_return_if_fail(appinfo != NULL);
g_app_info_launch(appinfo, NULL, NULL, NULL);
return;
}
开发者ID:spo11,项目名称:archlinux,代码行数:9,代码来源:session-service.c
示例19: cinnamon_app_get_description
const char *
cinnamon_app_get_description (CinnamonApp *app)
{
if (app->entry)
return g_app_info_get_description (G_APP_INFO (gmenu_tree_entry_get_app_info (app->entry)));
else
return NULL;
}
开发者ID:City-busz,项目名称:Cinnamon,代码行数:8,代码来源:cinnamon-app.c
示例20: exo_open_launch_desktop_file
static gboolean
exo_open_launch_desktop_file (const gchar *arg)
{
#ifdef HAVE_GIO_UNIX
GFile *gfile;
gchar *contents;
gsize length;
gboolean result;
GKeyFile *key_file;
GDesktopAppInfo *appinfo;
/* try to open a file from the arguments */
gfile = g_file_new_for_commandline_arg (arg);
if (G_UNLIKELY (gfile == NULL))
return FALSE;
/* load the contents of the file */
result = g_file_load_contents (gfile, NULL, &contents, &length, NULL, NULL);
g_object_unref (G_OBJECT (gfile));
if (G_UNLIKELY (!result || length == 0))
return FALSE;
/* create the key file */
key_file = g_key_file_new ();
result = g_key_file_load_from_data (key_file, contents, length, G_KEY_FILE_NONE, NULL);
g_free (contents);
if (G_UNLIKELY (!result))
{
g_key_file_free (key_file);
return FALSE;
}
/* create the appinfo */
appinfo = g_desktop_app_info_new_from_keyfile (key_file);
g_key_file_free (key_file);
if (G_UNLIKELY (appinfo == NULL))
return FALSE;
/* try to launch a (non-hidden) desktop file */
if (G_LIKELY (!g_desktop_app_info_get_is_hidden (appinfo)))
result = g_app_info_launch (G_APP_INFO (appinfo), NULL, NULL, NULL);
else
result = FALSE;
g_object_unref (G_OBJECT (appinfo));
#ifndef NDEBUG
g_debug ("launching desktop file %s", result ? "succeeded" : "failed");
#endif
return result;
#else /* !HAVE_GIO_UNIX */
g_critical (_("Launching desktop files is not supported when %s is compiled "
"without GIO-Unix features."), g_get_prgname ());
return FALSE;
#endif
}
开发者ID:EricKoegel,项目名称:exo,代码行数:58,代码来源:main.c
注:本文中的G_APP_INFO函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论