这篇教程C++ G_IS_APP_INFO函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中G_IS_APP_INFO函数的典型用法代码示例。如果您正苦于以下问题:C++ G_IS_APP_INFO函数的具体用法?C++ G_IS_APP_INFO怎么用?C++ G_IS_APP_INFO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了G_IS_APP_INFO函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: panel_app_info_launch_urisgbooleanpanel_app_info_launch_uris (GAppInfo *appinfo, GList *uris, GdkScreen *screen, guint32 timestamp, GError **error){ GdkAppLaunchContext *context; GError *local_error; gboolean retval; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); context = gdk_app_launch_context_new (); gdk_app_launch_context_set_screen (context, screen); gdk_app_launch_context_set_timestamp (context, timestamp); local_error = NULL; retval = g_app_info_launch_uris (appinfo, uris, (GAppLaunchContext *) context, &local_error); g_object_unref (context); if ((local_error == NULL) && (retval == TRUE)) return TRUE; return _panel_launch_handle_error (g_app_info_get_name (appinfo), screen, local_error, error);}
开发者ID:Lyude,项目名称:mate-panel,代码行数:32,
示例2: g_app_info_equal/** * g_app_info_equal: * @appinfo1: the first #GAppInfo. * @appinfo2: the second #GAppInfo. * * Checks if two #GAppInfo<!-- -->s are equal. * * Returns: %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise. **/gbooleang_app_info_equal (GAppInfo *appinfo1, GAppInfo *appinfo2){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo1), FALSE); g_return_val_if_fail (G_IS_APP_INFO (appinfo2), FALSE); if (G_TYPE_FROM_INSTANCE (appinfo1) != G_TYPE_FROM_INSTANCE (appinfo2)) return FALSE; iface = G_APP_INFO_GET_IFACE (appinfo1); return (* iface->equal) (appinfo1, appinfo2);}
开发者ID:Andais,项目名称:glib,代码行数:25,
示例3: dentry_is_gappJS_EXPORT_APIgboolean dentry_is_gapp(Entry* e){ if(G_IS_APP_INFO(e)) return TRUE; else return FALSE;}
开发者ID:CannedFish,项目名称:dde,代码行数:7,
示例4: panel_app_info_launch_urigbooleanpanel_app_info_launch_uri (GAppInfo *appinfo, const gchar *uri, GdkScreen *screen, guint32 timestamp, GError **error){ GList *uris; gboolean retval; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); uris = NULL; if (uri) uris = g_list_prepend (uris, (gpointer) uri); retval = panel_app_info_launch_uris (appinfo, uris, screen, timestamp, error); g_list_free (uris); return retval;}
开发者ID:Lyude,项目名称:mate-panel,代码行数:25,
示例5: panel_app_info_launch_urisstatic gbooleanpanel_app_info_launch_uris (GAppInfo *appinfo, GList *uris, GdkScreen *screen, guint32 timestamp, GError **error){ GdkAppLaunchContext *context; GError *local_error; GdkDisplay *display; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); display = gdk_screen_get_display (screen); context = gdk_display_get_app_launch_context (display); gdk_app_launch_context_set_screen (context, screen); gdk_app_launch_context_set_timestamp (context, timestamp); local_error = NULL; g_app_info_launch_uris (appinfo, uris, (GAppLaunchContext *) context, &local_error); g_object_unref (context); return _panel_launch_handle_error (g_app_info_get_name (appinfo), screen, local_error, error);}
开发者ID:zeldin,项目名称:sysmenu-applet,代码行数:30,
示例6: get_hotkey_info_from_key_filestatic 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,
示例7: xfdashboard_application_tracker_is_running_by_app_infogboolean xfdashboard_application_tracker_is_running_by_app_info(XfdashboardApplicationTracker *self, GAppInfo *inAppInfo){ g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION_TRACKER(self), FALSE); g_return_val_if_fail(G_IS_APP_INFO(inAppInfo), FALSE); return(_xfdashboard_application_tracker_find_item_by_app_info(self, inAppInfo) ? TRUE : FALSE);}
开发者ID:Zeioth,项目名称:xfdashboard,代码行数:8,
示例8: _xfdashboard_application_tracker_find_item_by_app_info/* Find application tracker item by desktop application info */static XfdashboardApplicationTrackerItem* _xfdashboard_application_tracker_find_item_by_app_info(XfdashboardApplicationTracker *self, GAppInfo *inAppInfo){ g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION_TRACKER(self), NULL); g_return_val_if_fail(G_IS_APP_INFO(inAppInfo), NULL); return(_xfdashboard_application_tracker_find_item_by_desktop_id(self, g_app_info_get_id(inAppInfo)));}
开发者ID:Zeioth,项目名称:xfdashboard,代码行数:9,
示例9: _app_activate_cbstatic void_app_activate_cb (OlAppChooserWidget *chooser, GAppInfo *app_info, OlPlayerChooser *window){ ol_assert (G_IS_APP_INFO (app_info)); _launch_app (window, app_info);}
开发者ID:AhmadMAlam,项目名称:osd-lyrics-1,代码行数:8,
示例10: g_app_info_get_executable/** * g_app_info_get_executable: * @appinfo: a #GAppInfo * * Gets the executable's name for the installed application. * * Returns: a string containing the @appinfo's application * binaries name **/const char *g_app_info_get_executable (GAppInfo *appinfo){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL); iface = G_APP_INFO_GET_IFACE (appinfo); return (* iface->get_executable) (appinfo);}
开发者ID:Andais,项目名称:glib,代码行数:20,
示例11: g_app_info_get_icon/** * g_app_info_get_icon: * @appinfo: a #GAppInfo. * * Gets the icon for the application. * * Returns: (transfer none): the default #GIcon for @appinfo. **/GIcon *g_app_info_get_icon (GAppInfo *appinfo){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL); iface = G_APP_INFO_GET_IFACE (appinfo); return (* iface->get_icon) (appinfo);}
开发者ID:Andais,项目名称:glib,代码行数:19,
示例12: g_app_info_supports_files/** * g_app_info_supports_files: * @appinfo: a #GAppInfo. * * Checks if the application accepts files as arguments. * * Returns: %TRUE if the @appinfo supports files. **/gbooleang_app_info_supports_files (GAppInfo *appinfo){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); iface = G_APP_INFO_GET_IFACE (appinfo); return (* iface->supports_files) (appinfo);}
开发者ID:Andais,项目名称:glib,代码行数:19,
示例13: g_app_info_should_show/** * g_app_info_should_show: * @appinfo: a #GAppInfo. * * Checks if the application info should be shown in menus that * list available applications. * * Returns: %TRUE if the @appinfo should be shown, %FALSE otherwise. **/gbooleang_app_info_should_show (GAppInfo *appinfo){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); iface = G_APP_INFO_GET_IFACE (appinfo); return (* iface->should_show) (appinfo);}
开发者ID:Andais,项目名称:glib,代码行数:20,
示例14: g_app_info_dup/** * g_app_info_dup: * @appinfo: a #GAppInfo. * * Creates a duplicate of a #GAppInfo. * * Returns: a duplicate of @appinfo. **/GAppInfo *g_app_info_dup (GAppInfo *appinfo){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL); iface = G_APP_INFO_GET_IFACE (appinfo); return (* iface->dup) (appinfo);}
开发者ID:Andais,项目名称:glib,代码行数:19,
示例15: g_app_info_get_commandline/** * g_app_info_get_commandline: * @appinfo: a #GAppInfo * * Gets the commandline with which the application will be * started. * * Returns: a string containing the @appinfo's commandline, * or %NULL if this information is not available * * Since: 2.20 **/const char *g_app_info_get_commandline (GAppInfo *appinfo){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL); iface = G_APP_INFO_GET_IFACE (appinfo); if (iface->get_commandline) return (* iface->get_commandline) (appinfo); return NULL;}
开发者ID:Andais,项目名称:glib,代码行数:26,
示例16: g_app_info_delete/** * g_app_info_delete: * @appinfo: a #GAppInfo * * Tries to delete a #GAppInfo. * * On some platforms, there may be a difference between user-defined * #GAppInfo<!-- -->s which can be deleted, and system-wide ones which * cannot. See g_app_info_can_delete(). * * Returns: %TRUE if @appinfo has been deleted * * Since: 2.20 */gbooleang_app_info_delete (GAppInfo *appinfo){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); iface = G_APP_INFO_GET_IFACE (appinfo); if (iface->do_delete) return (* iface->do_delete) (appinfo); return FALSE; }
开发者ID:Andais,项目名称:glib,代码行数:28,
示例17: g_app_info_set_as_default_for_type/** * g_app_info_set_as_default_for_type: * @appinfo: a #GAppInfo. * @content_type: the content type. * @error: a #GError. * * Sets the application as the default handler for a given type. * * Returns: %TRUE on success, %FALSE on error. **/gbooleang_app_info_set_as_default_for_type (GAppInfo *appinfo, const char *content_type, GError **error){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); g_return_val_if_fail (content_type != NULL, FALSE); iface = G_APP_INFO_GET_IFACE (appinfo); return (* iface->set_as_default_for_type) (appinfo, content_type, error);}
开发者ID:Andais,项目名称:glib,代码行数:24,
示例18: g_app_info_launch_uris/** * g_app_info_launch_uris: * @appinfo: a #GAppInfo * @uris: (element-type char*): a #GList containing URIs to launch. * @launch_context: (allow-none): a #GAppLaunchContext or %NULL * @error: a #GError * * Launches the application. Passes @uris to the launched application * as arguments, using the optional @launch_context to get information * about the details of the launcher (like what screen it is on). * On error, @error will be set accordingly. * * To lauch the application without arguments pass a %NULL @uris list. * * Note that even if the launch is successful the application launched * can fail to start if it runs into problems during startup. There is * no way to detect this. * * Returns: %TRUE on successful launch, %FALSE otherwise. **/gbooleang_app_info_launch_uris (GAppInfo *appinfo, GList *uris, GAppLaunchContext *launch_context, GError **error){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); iface = G_APP_INFO_GET_IFACE (appinfo); return (* iface->launch_uris) (appinfo, uris, launch_context, error);}
开发者ID:Andais,项目名称:glib,代码行数:34,
示例19: g_app_info_can_remove_supports_type/** * g_app_info_can_remove_supports_type: * @appinfo: a #GAppInfo. * * Checks if a supported content type can be removed from an application. * * Returns: %TRUE if it is possible to remove supported * content types from a given @appinfo, %FALSE if not. **/gbooleang_app_info_can_remove_supports_type (GAppInfo *appinfo){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); iface = G_APP_INFO_GET_IFACE (appinfo); if (iface->can_remove_supports_type) return (* iface->can_remove_supports_type) (appinfo); return FALSE;}
开发者ID:Andais,项目名称:glib,代码行数:23,
示例20: g_app_info_get_display_name/** * g_app_info_get_display_name: * @appinfo: a #GAppInfo. * * Gets the display name of the application. The display name is often more * descriptive to the user than the name itself. * * Returns: the display name of the application for @appinfo, or the name if * no display name is available. * * Since: 2.24 **/const char *g_app_info_get_display_name (GAppInfo *appinfo){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL); iface = G_APP_INFO_GET_IFACE (appinfo); if (iface->get_display_name == NULL) return (* iface->get_name) (appinfo); return (* iface->get_display_name) (appinfo);}
开发者ID:Andais,项目名称:glib,代码行数:26,
示例21: xfdashboard_application_tracker_get_window_list_by_app_infoconst GList* xfdashboard_application_tracker_get_window_list_by_app_info(XfdashboardApplicationTracker *self, GAppInfo *inAppInfo){ XfdashboardApplicationTrackerItem *item; g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION_TRACKER(self), NULL); g_return_val_if_fail(G_IS_APP_INFO(inAppInfo), NULL); /* Get application tracker item for requested desktop ID */ item=_xfdashboard_application_tracker_find_item_by_app_info(self, inAppInfo); if(!item) return(NULL); /* Return list of windows for found application tracker item */ return(item->windows);}
开发者ID:Zeioth,项目名称:xfdashboard,代码行数:15,
示例22: ev_attachment_launch_appstatic gbooleanev_attachment_launch_app (EvAttachment *attachment, GdkScreen *screen, guint32 timestamp, GError **error){ gboolean result; GList *files = NULL; GdkAppLaunchContext *context; GdkDisplay *display; GError *ioerror = NULL; g_assert (G_IS_FILE (attachment->priv->tmp_file)); g_assert (G_IS_APP_INFO (attachment->priv->app)); files = g_list_prepend (files, attachment->priv->tmp_file); display = screen ? gdk_screen_get_display (screen) : gdk_display_get_default (); context = gdk_display_get_app_launch_context (display); gdk_app_launch_context_set_screen (context, screen); gdk_app_launch_context_set_timestamp (context, timestamp); result = g_app_info_launch (attachment->priv->app, files, G_APP_LAUNCH_CONTEXT (context), &ioerror); g_object_unref (context); if (!result) { g_set_error (error, EV_ATTACHMENT_ERROR, (gint) result, _("Couldn't open attachment “%s”: %s"), attachment->priv->name, ioerror->message); g_list_free (files); g_error_free (ioerror); return FALSE; } g_list_free (files); return TRUE;}
开发者ID:linuxmint,项目名称:xreader,代码行数:45,
示例23: _xfdashboard_application_tracker_item_new/* Create new application tracker item */static XfdashboardApplicationTrackerItem* _xfdashboard_application_tracker_item_new(GAppInfo *inAppInfo, XfdashboardWindowTrackerWindow *inWindow){ XfdashboardApplicationTrackerItem *item; g_return_val_if_fail(G_IS_APP_INFO(inAppInfo), NULL); g_return_val_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_WINDOW(inWindow), NULL); /* Create new application item and set up */ item=g_new0(XfdashboardApplicationTrackerItem, 1); item->pid=xfdashboard_window_tracker_window_get_pid(inWindow); item->appInfo=g_object_ref(inAppInfo); item->desktopID=g_strdup(g_app_info_get_id(inAppInfo)); item->windows=g_list_prepend(item->windows, inWindow); /* Return newly created application tracker item */ return(item);}
开发者ID:Zeioth,项目名称:xfdashboard,代码行数:19,
示例24: g_app_info_set_as_default_for_extension/** * g_app_info_set_as_default_for_extension: * @appinfo: a #GAppInfo. * @extension: a string containing the file extension (without the dot). * @error: a #GError. * * Sets the application as the default handler for the given file extension. * * Returns: %TRUE on success, %FALSE on error. **/gbooleang_app_info_set_as_default_for_extension (GAppInfo *appinfo, const char *extension, GError **error){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); g_return_val_if_fail (extension != NULL, FALSE); iface = G_APP_INFO_GET_IFACE (appinfo); if (iface->set_as_default_for_extension) return (* iface->set_as_default_for_extension) (appinfo, extension, error); g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "g_app_info_set_as_default_for_extension not supported yet"); return FALSE;}
开发者ID:Andais,项目名称:glib,代码行数:29,
示例25: photos_glib_app_info_launch_urigbooleanphotos_glib_app_info_launch_uri (GAppInfo *appinfo, const gchar *uri, GAppLaunchContext *launch_context, GError **error){ GList *uris = NULL; gboolean ret_val; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); g_return_val_if_fail (uri != NULL && uri[0] != '/0', FALSE); g_return_val_if_fail (launch_context == NULL || G_IS_APP_LAUNCH_CONTEXT (launch_context), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); uris = g_list_prepend (uris, g_strdup (uri)); ret_val = g_app_info_launch_uris (appinfo, uris, launch_context, error); g_list_free_full (uris, g_free); return ret_val;}
开发者ID:GNOME,项目名称:gnome-photos,代码行数:19,
示例26: activate_open_with_application_itemstatic voidactivate_open_with_application_item (GtkMenuItem *menuitem, gpointer data){ GthBrowser *browser = data; GList *items; GList *file_list; GList *uris; GList *scan; GAppInfo *appinfo; GdkAppLaunchContext *context; GError *error = NULL; items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser))); file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items); uris = NULL; for (scan = file_list; scan; scan = scan->next) { GthFileData *file_data = scan->data; uris = g_list_prepend (uris, g_file_get_uri (file_data->file)); } uris = g_list_reverse (uris); appinfo = g_object_get_data (G_OBJECT (menuitem), "appinfo"); g_return_if_fail (G_IS_APP_INFO (appinfo)); context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (browser))); gdk_app_launch_context_set_timestamp (context, 0); gdk_app_launch_context_set_icon (context, g_app_info_get_icon (appinfo)); if (! g_app_info_launch_uris (appinfo, uris, G_APP_LAUNCH_CONTEXT (context), &error)) { _gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not perform the operation"), error); g_clear_error (&error); } g_object_unref (context); g_list_free (uris); _g_object_list_unref (file_list); _gtk_tree_path_list_free (items);}
开发者ID:linuxmint,项目名称:pix,代码行数:41,
示例27: g_app_info_remove_supports_type/** * g_app_info_remove_supports_type: * @appinfo: a #GAppInfo. * @content_type: a string. * @error: a #GError. * * Removes a supported type from an application, if possible. * * Returns: %TRUE on success, %FALSE on error. **/gbooleang_app_info_remove_supports_type (GAppInfo *appinfo, const char *content_type, GError **error){ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); g_return_val_if_fail (content_type != NULL, FALSE); iface = G_APP_INFO_GET_IFACE (appinfo); if (iface->remove_supports_type) return (* iface->remove_supports_type) (appinfo, content_type, error); g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "g_app_info_remove_supports_type not supported yet"); return FALSE;}
开发者ID:Andais,项目名称:glib,代码行数:31,
示例28: dentry_should_moveJS_EXPORT_APIgboolean dentry_should_move(Entry* e){ GFile* file = e; if (G_IS_APP_INFO(e)) { file = _get_gfile_from_gapp(e); } if (!g_file_is_native(file)) { if (file != e) g_object_unref(file); return FALSE; } GFileInfo* info = g_file_query_info (file, "access::can-delete", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, NULL); if (file != e) g_object_unref(file); gboolean can_delete = g_file_info_get_attribute_boolean(info, "access::can-delete"); g_object_unref(info); return can_delete;}
开发者ID:CannedFish,项目名称:dde,代码行数:24,
示例29: _xfdashboard_application_tracker_get_desktop_id_from_window_names/* Get desktop ID from window names. * Callee is responsible to free result with g_object_unref(). */static GAppInfo* _xfdashboard_application_tracker_get_desktop_id_from_window_names(XfdashboardApplicationTracker *self, XfdashboardWindowTrackerWindow *inWindow){ XfdashboardApplicationTrackerPrivate *priv; GAppInfo *foundAppInfo; gchar **names; gchar **iter; GList *apps; g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION_TRACKER(self), NULL); g_return_val_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_WINDOW(inWindow), NULL); priv=self->priv; foundAppInfo=NULL; /* Get list of applications */ apps=xfdashboard_application_database_get_all_applications(priv->appDatabase); /* Get window's names */ names=xfdashboard_window_tracker_window_get_instance_names(inWindow); /* Iterate through window's names to try to find matching desktop file */ iter=names; while(iter && *iter) { GAppInfo *appInfo; gchar *iterName; gchar *iterNameLowerCase; /* Build desktop ID from iterated name */ if(!g_str_has_suffix(*iter, ".desktop")) iterName=g_strconcat(*iter, ".desktop", NULL); else iterName=g_strdup(*iter); iterNameLowerCase=g_utf8_strdown(iterName, -1); /* Lookup application from unmodified name */ appInfo=xfdashboard_application_database_lookup_desktop_id(priv->appDatabase, iterName); /* Lookup application from to-lower-case converted name if previous * lookup with unmodified name failed. */ if(!appInfo) { /* Lookup application from lower-case name */ appInfo=xfdashboard_application_database_lookup_desktop_id(priv->appDatabase, iterNameLowerCase); } /* If no application was found for the name it may be an application * located in a subdirectory. Then the desktop ID is prefixed with * the subdirectory's name followed by a dash. So iterate through all * applications and lookup with glob pattern '*-' followed by name * and suffix '.desktop'. */ if(!appInfo) { GList *iterApps; GList *foundSubdirApps; gchar *globName; GPatternSpec *globPattern; GAppInfo *globAppInfo; /* Build glob pattern */ globAppInfo=NULL; globName=g_strconcat("*-", iterNameLowerCase, NULL); globPattern=g_pattern_spec_new(globName); /* Iterate through application and collect applications matching * glob pattern. */ foundSubdirApps=NULL; for(iterApps=apps; iterApps; iterApps=g_list_next(iterApps)) { if(!G_IS_APP_INFO(iterApps->data)) continue; globAppInfo=G_APP_INFO(iterApps->data); if(g_pattern_match_string(globPattern, g_app_info_get_id(globAppInfo))) { foundSubdirApps=g_list_prepend(foundSubdirApps, globAppInfo); g_debug("Found possible application '%s' for window '%s' using pattern '%s'", g_app_info_get_id(globAppInfo), xfdashboard_window_tracker_window_get_title(inWindow), globName); } } /* If exactly one application was collected because it matched * the glob pattern then we found the application. */ if(g_list_length(foundSubdirApps)==1) { appInfo=G_APP_INFO(g_object_ref(G_OBJECT(foundSubdirApps->data))); g_debug("Found exactly one application named '%s' for window '%s' using pattern '%s'", g_app_info_get_id(appInfo), xfdashboard_window_tracker_window_get_title(inWindow), globName); }//.........这里部分代码省略.........
开发者ID:AtheistSpacePirate,项目名称:xfdashboard,代码行数:101,
注:本文中的G_IS_APP_INFO函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ G_IS_ASYNC_RESULT函数代码示例 C++ G_IO_STREAM函数代码示例 |