~alexlauni/libunity-webapps/strip-desktopfile-spaces

« back to all changes in this revision

Viewing changes to src/webapps-service/unity-webapps-service.c

  • Committer: Maxim Ermilov
  • Date: 2012-09-19 06:03:05 UTC
  • Revision ID: maxim.ermilov@canonical.com-20120919060305-pvhl72tuce1tk174
firefoxChromeless: create link for extensions dir only in debug mode

Show diffs side-by-side

added added

removed removed

Lines of Context:
846
846
                           G_FILE_CREATE_NONE, NULL, NULL, NULL);
847
847
  g_free (data);
848
848
 
 
849
#ifdef UNITY_WEBAPPS_ENABLE_DEBUG
849
850
  default_extensions_path = g_strdup_printf ("%s/extensions", default_dir_path);
850
851
  if (!g_file_test (default_extensions_path, G_FILE_TEST_IS_DIR))
851
852
    {
855
856
 
856
857
  create_link (extensions, "/extensions");
857
858
  create_link (extensions_ini, "/extensions.ini");
 
859
#endif
858
860
 
859
861
#undef create_link
860
862
  res = TRUE;
869
871
  return res;
870
872
}
871
873
 
 
874
static GFile*
 
875
_firefox_get_profiles_dir (void)
 
876
{
 
877
  gchar *tmp = g_strdup_printf ("%s/.mozilla/firefox/", g_get_home_dir ());
 
878
  GFile *res = g_file_new_for_path (tmp);
 
879
 
 
880
  g_free (tmp);
 
881
 
 
882
  return res;
 
883
}
 
884
 
872
885
static gchar*
873
886
_firefox_get_profile_for_app (const gchar *name,
874
887
                              const gchar *domain)
875
888
{
876
889
  gchar *res = NULL;
877
 
  gchar* tmp = g_strdup_printf ("%s/.mozilla/firefox/", g_get_home_dir ());
 
890
  gchar* tmp = NULL;
878
891
 
879
 
  GFile *dir = g_file_new_for_path (tmp);
880
 
  g_free (tmp);
 
892
  GFile *dir = _firefox_get_profiles_dir ();
881
893
  GFile *profiles_file = g_file_get_child (dir, "profiles.ini");
882
894
 
883
895
  GKeyFile *profiles = g_key_file_new ();
889
901
      GFile *location = _firefox_profile_get_location (profiles, dir, id);
890
902
      if (location)
891
903
        {
892
 
          res = g_strdup (id);
 
904
          res = g_file_get_path (location);
893
905
          g_object_unref (location);
894
906
        }
895
907
      else
896
908
        {
897
909
          if (_firefox_profile_create (profiles, id, dir, profiles_file))
898
910
            {
899
 
              res = g_strdup (id);
 
911
              res = g_file_get_path (location);
900
912
            }
901
913
        }
902
914
      g_free (id);
927
939
 
928
940
  if (g_str_has_suffix (exe_name, "firefox"))
929
941
    {
930
 
      gchar *profile_name = _firefox_get_profile_for_app (name, domain);
 
942
      gchar *profile_path = _firefox_get_profile_for_app (name, domain);
931
943
 
932
 
      if (profile_name)
933
 
        return g_strdup_printf ("%s --chromeless -no-remote -P %s '%%s'", exe_name, profile_name);
 
944
      if (profile_path)
 
945
        {
 
946
          return g_strdup_printf ("%s --chromeless -no-remote -profile %s '%%s'", exe_name, profile_path);
 
947
        }
934
948
    }
935
949
 
936
950
  return g_strdup_printf ("%s --chromeless --new-window '%%s'", exe_name);