[gnome-shell] app-system: Remove lookup_app_for_path



commit 40c966fcd6ce593c5dae07330188a5f6e6294a30
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Apr 20 17:23:37 2013 -0400

    app-system: Remove lookup_app_for_path
    
    It's absurdly silly. Just modify the one place that uses it
    to be better.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=698486

 src/shell-app-system.c     |   36 ------------------------------------
 src/shell-app-system.h     |    2 --
 src/shell-window-tracker.c |    5 ++++-
 3 files changed, 4 insertions(+), 39 deletions(-)
---
diff --git a/src/shell-app-system.c b/src/shell-app-system.c
index 5efcce4..f508efb 100644
--- a/src/shell-app-system.c
+++ b/src/shell-app-system.c
@@ -297,42 +297,6 @@ shell_app_system_lookup_app (ShellAppSystem   *self,
 }
 
 /**
- * shell_app_system_lookup_app_for_path:
- * @system: a #ShellAppSystem
- * @desktop_path: (type utf8): UTF-8 encoded absolute file name
- *
- * Find or create a #ShellApp corresponding to a given absolute file
- * name which must be in the standard paths (XDG_DATA_DIRS).  For
- * files outside the datadirs, this function returns %NULL.
- *
- * Return value: (transfer none): The #ShellApp for id, or %NULL if none
- */
-ShellApp *
-shell_app_system_lookup_app_for_path (ShellAppSystem   *system,
-                                      const char       *desktop_path)
-{
-  const char *basename;
-  const char *app_path;
-  ShellApp *app;
-
-  basename = g_strrstr (desktop_path, "/");
-  if (basename)
-    basename += 1;
-  else
-    basename = desktop_path;
-
-  app = shell_app_system_lookup_app (system, basename);
-  if (!app)
-    return NULL;
-
-  app_path = g_desktop_app_info_get_filename (shell_app_get_app_info (app));
-  if (strcmp (desktop_path, app_path) != 0)
-    return NULL;
-
-  return app;
-}
-
-/**
  * shell_app_system_lookup_heuristic_basename:
  * @system: a #ShellAppSystem
  * @id: Probable application identifier
diff --git a/src/shell-app-system.h b/src/shell-app-system.h
index 2fc294c..1eb15e9 100644
--- a/src/shell-app-system.h
+++ b/src/shell-app-system.h
@@ -41,8 +41,6 @@ ShellAppSystem *shell_app_system_get_default (void);
 
 ShellApp       *shell_app_system_lookup_app                   (ShellAppSystem  *system,
                                                                const char      *id);
-ShellApp       *shell_app_system_lookup_app_for_path          (ShellAppSystem  *system,
-                                                               const char      *desktop_path);
 ShellApp       *shell_app_system_lookup_heuristic_basename    (ShellAppSystem  *system,
                                                                const char      *id);
 
diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c
index ed9d9b4..e1d563f 100644
--- a/src/shell-window-tracker.c
+++ b/src/shell-window-tracker.c
@@ -844,6 +844,7 @@ ShellApp *
 shell_startup_sequence_get_app (ShellStartupSequence *sequence)
 {
   const char *appid;
+  char *basename;
   ShellAppSystem *appsys;
   ShellApp *app;
 
@@ -851,8 +852,10 @@ shell_startup_sequence_get_app (ShellStartupSequence *sequence)
   if (!appid)
     return NULL;
 
+  basename = g_path_get_basename (appid);
   appsys = shell_app_system_get_default ();
-  app = shell_app_system_lookup_app_for_path (appsys, appid);
+  app = shell_app_system_lookup_app (appsys, basename);
+  g_free (basename);
   return app;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]